html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f6f8fb;
  color: #111827;
  transition: background-color .2s ease, color .2s ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, .09), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(14, 165, 233, .08), transparent 26rem);
}

.navbar {
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, .82) !important;
  border-color: rgba(15, 23, 42, .08) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .08);
}

.navbar-brand {
  font-weight: 800;
  letter-spacing: .01em;
}

.nav-link {
  font-weight: 650;
  border-radius: .65rem;
  transition: color .16s ease, background-color .16s ease;
}

.nav-link:hover {
  background: rgba(37, 99, 235, .08);
}

.container {
  max-width: 1500px;
}

.card {
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.card-header {
  border-top-left-radius: 1rem !important;
  border-top-right-radius: 1rem !important;
  font-weight: 750;
  background: linear-gradient(180deg, rgba(248, 250, 252, .98), rgba(241, 245, 249, .94));
  border-color: rgba(15, 23, 42, .08);
}

.btn {
  --bs-btn-padding-x: .95rem;
  --bs-btn-padding-y: .48rem;
  border-radius: .7rem;
  font-weight: 750;
  letter-spacing: .01em;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: rgba(37, 99, 235, .75);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  border-color: #2563eb;
  box-shadow: 0 16px 32px rgba(37, 99, 235, .3);
}

.btn-outline-primary,
.btn-outline-secondary {
  background: rgba(255, 255, 255, .72);
  border-color: rgba(37, 99, 235, .24);
  color: #1e40af;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: rgba(37, 99, 235, .72);
}

.btn-outline-danger {
  color: #dc2626;
  background: rgba(255, 255, 255, .7);
  border-color: rgba(220, 38, 38, .35);
}

.btn-outline-danger:hover {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #f97316);
  border-color: #dc2626;
}

.form-control,
.form-select {
  border-radius: .75rem;
  border-color: rgba(37, 99, 235, .18);
  background-color: rgba(255, 255, 255, .86);
}

.form-control:focus,
.form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .14);
}

.badge {
  border-radius: .55rem;
  font-weight: 800;
  letter-spacing: .01em;
}

.badge.text-bg-secondary {
  color: #334155 !important;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1) !important;
}

.table {
  overflow: hidden;
  border-radius: .9rem;
}

.table > :not(caption) > * > * {
  padding: .9rem .75rem;
  border-color: rgba(15, 23, 42, .07);
}

.table thead th {
  color: #1e3a8a;
  font-weight: 850;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
  border-bottom: 1px solid rgba(37, 99, 235, .18);
}

.access-shell {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.access-card {
  width: min(100%, 420px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .92));
}

.pin-input {
  letter-spacing: .4rem;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.api-workspace {
  display: grid;
  grid-template-columns: minmax(420px, 44%) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.api-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 7rem);
  overflow: hidden;
  background: linear-gradient(180deg, #eef4ff 0%, #e8eef8 48%, #f1f5f9 100%);
  border-color: rgba(37, 99, 235, .14);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
}

.api-grid-wrap {
  max-height: calc(100vh - 17rem);
  overflow: auto;
  background: linear-gradient(180deg, rgba(239, 246, 255, .88), rgba(248, 250, 252, .95));
}

.api-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #1e3a8a;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
  border-bottom: 1px solid rgba(37, 99, 235, .18);
}

.api-endpoint-row {
  cursor: pointer;
  transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.api-endpoint-row > * {
  background: rgba(255, 255, 255, .44);
  border-bottom-color: rgba(37, 99, 235, .08);
}

.api-endpoint-row:hover > * {
  background: rgba(219, 234, 254, .78);
}

.api-endpoint-row.table-active > * {
  color: #0f172a !important;
  background: linear-gradient(90deg, rgba(191, 219, 254, .95), rgba(224, 242, 254, .95)) !important;
  box-shadow: inset 4px 0 0 #2563eb;
}

.api-endpoint-row:focus {
  outline: 2px solid #258cfb;
  outline-offset: -2px;
}

.sort-button {
  width: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  background: transparent;
  border: 0;
}

.sort-button::after {
  content: "↕";
  float: right;
  color: #6b7280;
}

.sort-button[data-direction="asc"]::after {
  content: "↑";
}

.sort-button[data-direction="desc"]::after {
  content: "↓";
}

.api-tester-panel {
  min-width: 0;
}

.code-area,
.response-box {
  font-family: Consolas, "Courier New", monospace;
}

.response-box {
  min-height: 120px;
  max-height: 420px;
  overflow: auto;
  padding: 1rem;
  color: #d6deeb;
  background: #111827;
  border-radius: .5rem;
  white-space: pre-wrap;
}

.white-space-pre-wrap {
  white-space: pre-wrap;
}

.kpi-card {
  height: 100%;
  padding: 1rem;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 1rem;
  background: #fff;
}

.kpi-label {
  display: block;
  margin-bottom: .35rem;
  color: #6b7280;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.kpi-card strong {
  font-size: 1.15rem;
}

.kpi-success {
  border-color: rgba(34, 197, 94, .28);
  background: rgba(34, 197, 94, .08);
}

.kpi-warning {
  border-color: rgba(245, 158, 11, .32);
  background: rgba(245, 158, 11, .1);
}

.kpi-danger {
  border-color: rgba(239, 68, 68, .32);
  background: rgba(239, 68, 68, .1);
}

.audio-result-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, .08), rgba(14, 165, 233, .08));
}

body.theme-dark {
  color: #e5e7eb;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .22), transparent 34rem),
    radial-gradient(circle at top right, rgba(14, 165, 233, .14), transparent 30rem),
    linear-gradient(135deg, #020617 0%, #0f172a 48%, #111827 100%);
}

body.theme-dark::before {
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, .20), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(14, 165, 233, .12), transparent 30rem);
}

body.theme-dark .navbar,
body.theme-dark .footer {
  color: #dbeafe;
  background: rgba(2, 6, 23, .78) !important;
  border-color: rgba(148, 163, 184, .16) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .24);
}

body.theme-dark .card,
body.theme-dark .list-group-item,
body.theme-dark .tab-content,
body.theme-dark .table {
  color: #e5e7eb;
  background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(15, 23, 42, .88)) !important;
  border-color: rgba(148, 163, 184, .16) !important;
}

body.theme-dark .table,
body.theme-dark .table > :not(caption) > * > * {
  --bs-table-bg: transparent;
  --bs-table-color: #e5e7eb;
  --bs-table-border-color: rgba(96, 165, 250, .12);
  --bs-table-striped-bg: rgba(15, 23, 42, .55);
  --bs-table-hover-bg: rgba(37, 99, 235, .18);
  --bs-table-active-bg: rgba(37, 99, 235, .28);
  color: #e5e7eb !important;
  background-color: transparent !important;
  border-color: rgba(96, 165, 250, .12) !important;
}

body.theme-dark .table thead th,
body.theme-dark .table thead td {
  color: #bfdbfe !important;
  background: linear-gradient(180deg, rgba(30, 41, 59, .96), rgba(15, 23, 42, .96)) !important;
  border-bottom: 1px solid rgba(96, 165, 250, .22) !important;
}

body.theme-dark .table tbody tr > * {
  background: linear-gradient(90deg, rgba(15, 23, 42, .72), rgba(2, 6, 23, .58)) !important;
}

body.theme-dark .table tbody tr:hover > * {
  color: #f8fafc !important;
  background: linear-gradient(90deg, rgba(37, 99, 235, .28), rgba(14, 165, 233, .14)) !important;
}

body.theme-dark .table .text-muted {
  color: #94a3b8 !important;
}

body.theme-dark .card {
  box-shadow: 0 18px 55px rgba(0, 0, 0, .34) !important;
}

body.theme-dark .card-header {
  background: rgba(15, 23, 42, .72) !important;
  border-color: rgba(148, 163, 184, .14) !important;
}

body.theme-dark .api-sidebar {
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(2, 6, 23, .92)) !important;
  border-color: rgba(96, 165, 250, .18) !important;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .36);
}

body.theme-dark .api-grid-wrap {
  background: linear-gradient(180deg, rgba(2, 6, 23, .82), rgba(15, 23, 42, .86)) !important;
}

body.theme-dark .api-grid,
body.theme-dark .api-grid tbody,
body.theme-dark .api-grid tr,
body.theme-dark .api-grid td,
body.theme-dark .api-grid th {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: transparent;
  --bs-table-active-bg: transparent;
  background-color: transparent !important;
}

body.theme-dark .api-grid thead th {
  background: linear-gradient(180deg, #111827, #0f172a) !important;
  color: #93c5fd;
  border-color: rgba(148, 163, 184, .16);
}

body.theme-dark .api-grid tbody tr {
  border-color: rgba(148, 163, 184, .12);
}

body.theme-dark .api-endpoint-row > * {
  color: #dbeafe;
  background: linear-gradient(90deg, rgba(15, 23, 42, .78), rgba(2, 6, 23, .62)) !important;
  border-bottom: 1px solid rgba(96, 165, 250, .10);
}

body.theme-dark .table-hover > tbody > tr:hover > * {
  color: #f9fafb;
  background: linear-gradient(90deg, rgba(37, 99, 235, .32), rgba(14, 165, 233, .18)) !important;
}

body.theme-dark .table-active > * {
  color: #f9fafb !important;
  background: linear-gradient(90deg, rgba(37, 99, 235, .82), rgba(14, 165, 233, .42)) !important;
  box-shadow: inset 4px 0 0 #38bdf8;
}

body.theme-dark .navbar-brand,
body.theme-dark .nav-link,
body.theme-dark .text-dark,
body.theme-dark .text-muted,
body.theme-dark .form-label,
body.theme-dark .card-header {
  color: #d1d5db !important;
}

body.theme-dark .navbar-brand {
  color: #bfdbfe !important;
  font-weight: 700;
  letter-spacing: .02em;
}

body.theme-dark .nav-link:hover {
  color: #93c5fd !important;
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark strong {
  color: #f8fafc;
}

body.theme-dark .form-control,
body.theme-dark .form-select {
  color: #f9fafb;
  background-color: rgba(2, 6, 23, .72);
  border-color: rgba(96, 165, 250, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

body.theme-dark .kpi-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, .9), rgba(2, 6, 23, .72));
  border-color: rgba(96, 165, 250, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

body.theme-dark .kpi-label {
  color: #93c5fd;
}

body.theme-dark .kpi-success {
  border-color: rgba(34, 197, 94, .32);
  background: linear-gradient(180deg, rgba(22, 101, 52, .3), rgba(15, 23, 42, .82));
}

body.theme-dark .kpi-warning {
  border-color: rgba(245, 158, 11, .32);
  background: linear-gradient(180deg, rgba(146, 64, 14, .32), rgba(15, 23, 42, .82));
}

body.theme-dark .kpi-danger {
  border-color: rgba(239, 68, 68, .34);
  background: linear-gradient(180deg, rgba(127, 29, 29, .34), rgba(15, 23, 42, .82));
}

body.theme-dark .audio-result-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, .22), rgba(14, 165, 233, .12)) !important;
  border: 1px solid rgba(96, 165, 250, .2) !important;
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .22);
}

body.theme-dark .form-control::placeholder {
  color: #64748b;
}

body.theme-dark .nav-tabs {
  border-color: #263244;
}

body.theme-dark .nav-tabs .nav-link {
  color: #cbd5e1;
  border-radius: .8rem .8rem 0 0;
}

body.theme-dark .nav-tabs .nav-link.active {
  color: #f9fafb;
  background: rgba(37, 99, 235, .18);
  border-color: rgba(96, 165, 250, .28) rgba(96, 165, 250, .28) rgba(15, 23, 42, .88);
}

body.theme-dark .response-box {
  color: #dbeafe;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, .98), rgba(15, 23, 42, .96));
  border: 1px solid rgba(96, 165, 250, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

body.theme-dark .btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: rgba(96, 165, 250, .7);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .28);
}

body.theme-dark .btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  border-color: #93c5fd;
}

body.theme-dark .btn-outline-primary,
body.theme-dark .btn-outline-secondary,
body.theme-dark .btn-outline-danger {
  color: #bfdbfe;
  border-color: rgba(147, 197, 253, .38);
  background: rgba(15, 23, 42, .32);
}

body.theme-dark .btn-outline-primary:hover,
body.theme-dark .btn-outline-secondary:hover {
  color: #fff;
  background: rgba(37, 99, 235, .28);
  border-color: #60a5fa;
}

body.theme-dark .btn-outline-danger {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .38);
}

body.theme-dark .btn-outline-danger:hover {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #f97316);
  border-color: #f87171;
}

body.theme-dark .badge.text-bg-primary {
  color: #dbeafe !important;
  background: rgba(37, 99, 235, .72) !important;
  border: 1px solid rgba(147, 197, 253, .28);
}

body.theme-dark .badge.text-bg-secondary {
  color: #e2e8f0 !important;
  background: linear-gradient(135deg, rgba(71, 85, 105, .9), rgba(30, 41, 59, .9)) !important;
  border: 1px solid rgba(148, 163, 184, .24);
}

body.theme-dark .alert-success {
  color: #bbf7d0;
  background: rgba(22, 101, 52, .22);
  border-color: rgba(34, 197, 94, .28);
}

body.theme-dark .alert-warning {
  color: #fde68a;
  background: rgba(146, 64, 14, .24);
  border-color: rgba(245, 158, 11, .32);
}

body.theme-dark .api-grid-wrap,
body.theme-dark .response-box,
body.theme-dark textarea {
  scrollbar-color: #334155 #020617;
}

body.theme-dark .api-grid-wrap::-webkit-scrollbar,
body.theme-dark .response-box::-webkit-scrollbar,
body.theme-dark textarea::-webkit-scrollbar {
  width: .7rem;
  height: .7rem;
}

body.theme-dark .api-grid-wrap::-webkit-scrollbar-track,
body.theme-dark .response-box::-webkit-scrollbar-track,
body.theme-dark textarea::-webkit-scrollbar-track {
  background: #020617;
}

body.theme-dark .api-grid-wrap::-webkit-scrollbar-thumb,
body.theme-dark .response-box::-webkit-scrollbar-thumb,
body.theme-dark textarea::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #1d4ed8, #334155);
  border-radius: 999px;
}

@media (max-width: 1199.98px) {
  .api-workspace {
    grid-template-columns: 1fr;
  }

  .api-sidebar {
    position: static;
    max-height: none;
  }

  .api-grid-wrap {
    max-height: 460px;
  }
}