/* Custom select controls and scrollbar polish. */

html {
  scrollbar-color: rgba(148, 163, 184, .42) rgba(15, 23, 42, .42);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, .45);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(15, 23, 42, .45);
  border-radius: 999px;
  background: rgba(148, 163, 184, .42);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, .62);
}

select.native-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.custom-select-button {
  width: 100% !important;
  min-height: 42px;
  justify-content: space-between !important;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(96, 130, 180, .32) !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, rgba(32, 46, 68, .96), rgba(27, 39, 56, .96)) !important;
  color: #e5eefb !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.custom-select.open .custom-select-button,
.custom-select-button:focus-visible {
  border-color: rgba(96, 165, 250, .72) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-caret {
  flex: 0 0 auto;
  color: #c7d2fe;
  font-size: 16px;
  line-height: 1;
}

.custom-select-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 120;
  max-height: min(340px, calc(100vh - 220px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(96, 130, 180, .28);
  border-radius: 12px;
  background: #101827;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .03);
  scrollbar-color: rgba(148, 163, 184, .46) rgba(15, 23, 42, .72);
  scrollbar-width: thin;
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 2px;
}

.custom-select-menu::-webkit-scrollbar {
  width: 8px;
}

.custom-select-menu::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 999px;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  border: 2px solid #0f172a;
  border-radius: 999px;
  background: rgba(148, 163, 184, .5);
}

.custom-select-option {
  width: 100% !important;
  min-height: 34px !important;
  justify-content: flex-start !important;
  padding: 7px 10px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: #e5e7eb !important;
  font-size: 14px !important;
  font-weight: 650 !important;
  text-align: left !important;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: rgba(59, 130, 246, .18) !important;
  color: #f8fbff !important;
}

.custom-select-option.selected {
  background: rgba(59, 130, 246, .28) !important;
  color: #dbeafe !important;
}

@media (max-width: 767px) {
  :root {
    --mobile-x: 14px;
  }

  html {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    background: #0d1117 !important;
  }

  body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 100svh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    background:
      radial-gradient(circle at 50% -12%, rgba(59, 130, 246, .13), transparent 36%),
      linear-gradient(180deg, #080d15 0%, #0d1117 34%, #0f172a 100%) !important;
  }

  .app {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 100svh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    background: transparent !important;
  }

  .sidebar {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: calc(10px + env(safe-area-inset-top)) var(--mobile-x) 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    background: rgba(8, 13, 21, .92) !important;
  }

  .sidebar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(126, 154, 197, .18);
  }

  .sidebar-head {
    width: 100% !important;
    min-height: 52px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .brand {
    max-width: calc(100% - 118px);
    justify-content: center !important;
    gap: 10px !important;
    font-size: 24px !important;
    line-height: 1 !important;
  }

  .settings-menu {
    position: absolute !important;
    left: var(--mobile-x) !important;
    top: calc(10px + env(safe-area-inset-top)) !important;
    z-index: 80 !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .settings-summary {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    border-radius: 16px !important;
  }

  .settings-actions {
    left: 0 !important;
    top: 58px !important;
    width: min(286px, calc(100vw - 28px)) !important;
  }

  .overview-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 12px 0 0 !important;
    padding: 13px !important;
    border-radius: 18px !important;
  }

  .stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .stat-card {
    min-height: 88px !important;
    padding: 13px 12px !important;
  }

  .main {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 18px var(--mobile-x) calc(124px + env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
  }

  .topbar {
    width: 100% !important;
    margin: 0 0 18px !important;
  }

  .topbar h1,
  h1 {
    font-size: 27px !important;
    line-height: 1.18 !important;
  }

  .topbar p,
  p {
    font-size: 15px !important;
  }

  .filter-card,
  .panel,
  .mobile-list,
  .mobile-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: hidden !important;
  }

  .filter-card {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 13px !important;
    padding: 14px !important;
    border-radius: 18px !important;
  }

  .filter-field,
  .custom-select,
  .custom-select-button,
  input,
  select,
  button,
  .button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .custom-select-menu {
    left: 0 !important;
    right: 0 !important;
    max-height: 42vh !important;
  }

  .custom-select-button {
    min-height: 46px;
    font-size: 16px !important;
  }

  .custom-select-option {
    min-height: 40px !important;
    font-size: 15px !important;
  }

  .switch-field {
    width: auto !important;
    justify-content: flex-start !important;
    padding: 4px 2px 0 !important;
  }

  .panel {
    border-radius: 18px !important;
  }

  .panel-head {
    align-items: center !important;
    gap: 10px !important;
  }

  .table-wrap {
    display: none !important;
  }

  .mobile-list {
    display: grid !important;
    gap: 12px !important;
    padding: 12px !important;
  }

  .mobile-card {
    padding: 14px !important;
    border-radius: 15px !important;
  }

  .mobile-card h2 {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .mobile-card-foot {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  .source-button {
    max-width: 100% !important;
  }
}

@supports (min-height: 100dvh) {
  @media (max-width: 767px) {
    body,
    .app {
      min-height: 100dvh !important;
    }
  }
}
