/* ==========================================================================
   Round Gateway — Admin Dashboard theme
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #060a13;
  --bg-deep: #030711;
  --bg-elevated: #0b1220;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-hover: #162238;
  --bg-input: rgba(6, 11, 20, 0.68);
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text: #e8eefc;
  --text-muted: #8fa0bd;
  --text-dim: #62738f;
  --primary: #5b8cff;
  --primary-2: #7c5cff;
  --primary-hover: #4a7cf5;
  --accent: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --info: #38bdf8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 22px 50px -30px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 100px -32px rgba(0, 0, 0, 0.95);
  --gradient: linear-gradient(135deg, #5b8cff, #7c5cff 52%, #22d3ee);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 12% -12%, rgba(91, 140, 255, 0.14), transparent 60%),
    radial-gradient(900px 540px at 102% -4%, rgba(34, 211, 238, 0.09), transparent 58%),
    radial-gradient(800px 700px at 50% 118%, rgba(124, 92, 255, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(91, 140, 255, 0.34);
  color: #fff;
}

.hidden {
  display: none !important;
}

code,
pre {
  font-family: var(--mono);
}

code {
  font-size: 0.92em;
  color: #c3d3f2;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--text-muted);
}

a {
  color: var(--primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbars ------------------------------------------------------------------ */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

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

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ==========================================================================
   AUTH GATE
   ========================================================================== */

.auth-gate {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow-x: hidden;
}

.auth-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(640px 420px at 18% 18%, rgba(91, 140, 255, 0.2), transparent 65%),
    radial-gradient(560px 400px at 86% 82%, rgba(34, 211, 238, 0.13), transparent 65%);
  pointer-events: none;
}

.auth-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 72%);
  pointer-events: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  width: min(1040px, 100%);
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  overflow: hidden;
  background: rgba(8, 14, 26, 0.82);
  box-shadow: 0 50px 130px -50px #000, inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px);
  animation: authIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 46px 42px;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(560px 300px at 10% 0%, rgba(91, 140, 255, 0.18), transparent 68%),
    linear-gradient(160deg, rgba(15, 25, 44, 0.86), rgba(7, 12, 23, 0.9));
  overflow: hidden;
}

.auth-aside::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -130px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.22), transparent 68%);
  pointer-events: none;
}

.auth-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.auth-brand-tag {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 14px 34px -10px rgba(91, 140, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
}

.auth-copy {
  position: relative;
  z-index: 1;
  margin: auto 0;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(91, 140, 255, 0.28);
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.09);
  color: #a7c0ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-copy h2 {
  margin: 16px 0 12px;
  font-size: clamp(27px, 3.1vw, 37px);
  line-height: 1.14;
  letter-spacing: -0.035em;
  font-weight: 760;
}

.auth-copy h2 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-copy p {
  margin: 0;
  max-width: 390px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 26px;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.auth-feature-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.09);
  color: var(--ok);
}

.auth-feature-icon svg {
  width: 14px;
  height: 14px;
}

.auth-feature strong {
  color: var(--text);
  font-weight: 600;
}

.auth-terminal {
  position: relative;
  z-index: 1;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(3, 7, 17, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.auth-terminal-dots {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.auth-terminal-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.22);
}

.auth-terminal-dots span:first-child {
  background: rgba(251, 113, 133, 0.65);
}

.auth-terminal-dots span:nth-child(2) {
  background: rgba(251, 191, 36, 0.6);
}

.auth-terminal-dots span:nth-child(3) {
  background: rgba(52, 211, 153, 0.6);
}

.auth-terminal code {
  display: block;
  font-size: 10.5px;
  line-height: 1.8;
  color: #94a8cc;
}

.auth-terminal .ok-text {
  color: #6ee7b7;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 46px 40px;
  margin: 0;
}

.auth-heading h1 {
  margin: 0 0 6px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.auth-heading p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
}

.auth-hint {
  margin: 2px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: center;
}

.auth-hint a {
  color: var(--primary);
  text-decoration: none;
}

.auth-hint a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   APP SHELL / SIDEBAR
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 23px 17px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(12, 20, 35, 0.94), rgba(6, 11, 20, 0.985));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
}

.sidebar .brand {
  padding: 1px 7px;
}

.sidebar .brand-mark {
  width: 41px;
  height: 41px;
  border-radius: 13px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-version {
  padding: 1px 6px;
  border: 1px solid rgba(91, 140, 255, 0.24);
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.1);
  color: #9dbcff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  margin-top: 1px;
  font-size: 10px;
  color: var(--text-dim);
}

.nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.nav-label {
  margin: 17px 10px 6px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nav-label:first-child {
  margin-top: 0;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.065);
  color: var(--text);
}

.nav-item.active {
  color: #dce8ff;
  background: linear-gradient(90deg, rgba(91, 140, 255, 0.18), rgba(124, 92, 255, 0.07));
  border-color: rgba(91, 140, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--gradient);
  box-shadow: 0 0 16px rgba(91, 140, 255, 0.8);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.88;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-text {
  flex: 1;
  min-width: 0;
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 19px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.nav-item.active .nav-count {
  background: rgba(91, 140, 255, 0.22);
  color: #cfe0ff;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.auto-refresh-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(148, 163, 184, 0.045);
}

.auto-refresh-title {
  font-size: 12px;
  font-weight: 650;
}

.auto-refresh-sub {
  margin-top: 1px;
  font-size: 10px;
  color: var(--text-dim);
}

.sidebar-note {
  padding-top: 2px;
  text-align: center;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  display: flex;
  align-items: center;
  width: 40px;
  height: 22px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.switch-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch-track {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 18px -2px rgba(91, 140, 255, 0.55);
}

.switch input:checked + .switch-track .switch-thumb {
  background: #fff;
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-overlay {
  display: none;
}

.sidebar-toggle {
  display: none;
  flex-shrink: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   MAIN / TOPBAR
   ========================================================================== */

.main-content {
  --main-pad-x: 34px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 0 var(--main-pad-x) 58px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 calc(-1 * var(--main-pad-x));
  padding: 21px var(--main-pad-x) 17px;
  background: rgba(6, 10, 19, 0.97);
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  box-shadow: 0 22px 38px -32px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(18px);
}

.topbar-left {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}

.page-heading {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 3px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.eyebrow-sep {
  opacity: 0.45;
}

#last-updated {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-muted);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.11);
  animation: pulse 2.2s ease-in-out infinite;
}

.topbar h2 {
  margin: 4px 0 3px;
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.topbar p {
  max-width: 760px;
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.tab-panel.active {
  display: flex;
  animation: fadeUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, #5b8cff, #7c5cff);
  color: #fff;
  box-shadow: 0 12px 28px -14px rgba(91, 140, 255, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d9aff, #8b6cff);
  box-shadow: 0 15px 32px -13px rgba(91, 140, 255, 1);
}

.btn.secondary {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.06);
  color: var(--text);
}

.btn.secondary:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(148, 163, 184, 0.1);
}

.btn.ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.07);
  color: var(--text);
}

.btn.danger {
  border-color: rgba(251, 113, 133, 0.22);
  background: rgba(251, 113, 133, 0.09);
  color: #fda4af;
}

.btn.danger:hover:not(:disabled) {
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.15);
}

.btn.small {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
}

.btn.small svg {
  width: 13px;
  height: 13px;
}

.btn.icon-only {
  width: 28px;
  height: 28px;
  padding: 0;
}

.btn.icon-only svg {
  width: 14px;
  height: 14px;
}

.btn.full {
  width: 100%;
}

.btn-lg {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13.5px;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

td.actions-column .row-actions,
th.actions-column .row-actions {
  flex-wrap: nowrap;
}

/* ==========================================================================
   CARDS / OVERVIEW
   ========================================================================== */

.card {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(17, 27, 46, 0.78), rgba(9, 15, 27, 0.72));
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.card-header h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.card-header .muted {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.6;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(21, 32, 53, 0.86), rgba(9, 16, 29, 0.76));
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--stat-accent, var(--primary));
  opacity: 0.85;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -78px;
  right: -62px;
  width: 165px;
  height: 165px;
  border-radius: 50%;
  background: var(--stat-glow, rgba(91, 140, 255, 0.2));
  filter: blur(16px);
  pointer-events: none;
}

.stat-card.accent-blue {
  --stat-accent: #5b8cff;
  --stat-glow: rgba(91, 140, 255, 0.24);
}

.stat-card.accent-violet {
  --stat-accent: #a78bfa;
  --stat-glow: rgba(167, 139, 250, 0.22);
}

.stat-card.accent-cyan {
  --stat-accent: #22d3ee;
  --stat-glow: rgba(34, 211, 238, 0.19);
}

.stat-card.accent-amber {
  --stat-accent: #fbbf24;
  --stat-glow: rgba(251, 191, 36, 0.16);
}

.stat-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--stat-accent, var(--primary));
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-kicker {
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-value {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 13px;
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-value-sub {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-meter {
  position: relative;
  z-index: 1;
  height: 4px;
  margin: 13px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.11);
}

.stat-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--stat-accent, var(--primary)), var(--accent));
  transition: width 0.4s ease;
}

.stat-sub {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.stat-sub code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(3, 7, 17, 0.4);
  font-size: 9.5px;
  color: #b7c8e8;
}

.stat-sub .sep {
  color: var(--text-dim);
}

.stat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.stat-chip-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.05);
  font-size: 9.5px;
  color: var(--text-muted);
}

.stat-chip strong {
  color: var(--text);
  font-weight: 650;
}

.overview-split {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 16px;
}

.overview-split > .card {
  display: flex;
  flex-direction: column;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(118px, 1fr);
  flex: 1;
  gap: 10px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(148, 163, 184, 0.035);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 140, 255, 0.34);
  background: rgba(91, 140, 255, 0.085);
}

.quick-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(91, 140, 255, 0.18);
  border-radius: 10px;
  background: rgba(91, 140, 255, 0.11);
  color: #aec7ff;
}

.quick-icon svg {
  width: 16px;
  height: 16px;
}

.quick-title {
  font-size: 12.5px;
  font-weight: 650;
}

.quick-sub {
  margin-top: -6px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-dim);
}

.flow-list {
  display: flex;
  flex-direction: column;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.032);
}

.flow-node-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--flow-color, var(--primary));
}

.flow-node-icon svg {
  width: 15px;
  height: 15px;
}

.flow-node-title {
  font-size: 11.5px;
  font-weight: 650;
}

.flow-node-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.flow-arrow {
  width: 1px;
  height: 15px;
  margin-left: 26px;
  border-left: 1px dashed rgba(148, 163, 184, 0.25);
}

.flow-note {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Endpoint rows -------------------------------------------------------------- */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(3, 7, 17, 0.32);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.endpoint-row:hover {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.045);
}

.endpoint-row code {
  white-space: nowrap;
}

.endpoint-row .muted {
  font-size: 11px;
}

.endpoint-copy {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.endpoint-copy:hover {
  border-color: rgba(91, 140, 255, 0.32);
  background: rgba(91, 140, 255, 0.1);
  color: #b8ceff;
}

.endpoint-copy svg {
  width: 13px;
  height: 13px;
}

.steps-list {
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps-list li {
  counter-increment: step;
  position: relative;
  padding: 11px 12px 11px 45px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.028);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 11px;
  top: 11px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(91, 140, 255, 0.24);
  border-radius: 8px;
  background: rgba(91, 140, 255, 0.13);
  color: #a9c3ff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.steps-list li strong {
  color: var(--text);
  font-weight: 650;
}

/* ==========================================================================
   TOOLBARS / TABLE CARDS / SEARCH
   ========================================================================== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar > .muted {
  max-width: 820px;
  font-size: 12px;
  line-height: 1.65;
}

.toolbar > .muted strong {
  color: var(--text);
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.022);
}

.table-card-head h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.table-card-head p {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 248px;
  height: 37px;
  padding: 8px 12px 8px 34px;
  border-color: var(--border);
  border-radius: 9px;
  background: rgba(3, 7, 17, 0.43);
  font-size: 11.5px;
}

.search-box input::-webkit-search-cancel-button {
  filter: invert(0.55);
  cursor: pointer;
}

.compact-select {
  width: auto;
  min-width: 154px;
  height: 37px;
  padding-top: 7px;
  padding-bottom: 7px;
  border-color: var(--border);
  border-radius: 9px;
  background-color: rgba(3, 7, 17, 0.43);
  font-size: 11.5px;
}

.result-count {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.045);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.list-toolbar .search-box {
  flex: 1;
  max-width: 360px;
}

.list-toolbar .search-box input {
  width: 100%;
}

/* ==========================================================================
   TABLES / ENTITIES / BADGES
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0b1424;
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: rgba(91, 140, 255, 0.045);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.actions-column {
  white-space: nowrap;
}

td code {
  font-size: 10.5px;
  color: #b8cbea;
}

.cell-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 160px;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entity-avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex-shrink: 0;
  border: 1px solid hsl(var(--avatar-hue, 220), 65%, 60%, 0.24);
  border-radius: 9px;
  background: hsl(var(--avatar-hue, 220), 70%, 50%, 0.13);
  color: hsl(var(--avatar-hue, 220), 85%, 74%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.entity-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 285px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-muted);
}

.cell-sub .sep {
  color: var(--text-dim);
}

.cell-error {
  display: block;
  max-width: 270px;
  overflow: hidden;
  color: #fda4af;
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge.ok {
  background: rgba(52, 211, 153, 0.11);
  color: #6ee7b7;
}

.badge.ok::before,
.badge.warn::before,
.badge.error::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.badge.warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
}

.badge.error {
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
}

.badge.info {
  background: rgba(56, 189, 248, 0.11);
  color: #7dd3fc;
}

.badge.neutral {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
}

.mini-meter {
  height: 3px;
  margin: 6px 0 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.mini-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ok), var(--accent));
}

/* Empty state ---------------------------------------------------------------- */
.empty-row td {
  padding: 0 !important;
  border: 0 !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 38px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-dim);
}

.empty-icon svg {
  width: 20px;
  height: 20px;
}

.empty-state strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
}

.empty-state span {
  max-width: 390px;
  font-size: 11px;
  line-height: 1.6;
}

.empty-card {
  padding: 0;
}

/* ==========================================================================
   ROUTE CARDS
   ========================================================================== */

.route-card {
  padding: 0;
  overflow: hidden;
}

.route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.route-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.route-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.08);
  color: #67e8f9;
}

.route-icon svg {
  width: 17px;
  height: 17px;
}

.route-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.route-title-row code {
  color: #dbe7ff;
  font-size: 14px;
  font-weight: 650;
}

.route-desc {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-muted);
}

.route-targets {
  padding: 13px 20px 17px;
}

.route-targets .endpoint-row {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto;
}

.target-meta {
  font-size: 10px !important;
  text-align: right;
}

.route-count {
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span,
.field > label {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.45;
}

.field > span code,
.field > label code {
  font-size: 9.5px;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(148, 163, 184, 0.32);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(6, 11, 20, 0.86);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

textarea {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  resize: vertical;
}

select {
  padding-right: 34px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238fa0bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.field.actions-field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.checks-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 8px;
  padding-top: 3px;
}

.check-pill {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.028);
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.55;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check-pill:hover {
  border-color: var(--border-strong);
  background: rgba(148, 163, 184, 0.045);
}

.check-pill input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  flex-shrink: 0;
}

.check-pill code {
  font-size: 9.5px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.field-label-row > span,
.field-label-row > label:not(.file-inline-btn) {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 550;
  line-height: 1.45;
}

.field-label-row > span code {
  font-size: 9.5px;
}

.field-hint {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.55;
}

.field-hint strong {
  color: var(--text-muted);
  font-weight: 650;
}

/* Playground key inspector -------------------------------------------------- */
.pg-key-status {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(3, 7, 17, 0.34);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.pg-key-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.08);
}

.pg-key-status-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pg-key-status-text strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-key-status-text span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-key-status .badge {
  flex-shrink: 0;
  margin-left: auto;
}

.pg-key-status[data-state="loading"] {
  border-color: rgba(251, 191, 36, 0.26);
  background: rgba(251, 191, 36, 0.06);
}

.pg-key-status[data-state="loading"] .pg-key-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
  animation: pulse 1.6s ease-in-out infinite;
}

.pg-key-status[data-state="ok"] {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.055);
}

.pg-key-status[data-state="ok"] .pg-key-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.pg-key-status[data-state="error"] {
  border-color: rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.06);
}

.pg-key-status[data-state="error"] .pg-key-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1);
}

#pg-result-bar {
  margin-top: 12px;
}

.file-inline-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.06);
  color: #9dbcff;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.file-inline-btn:hover {
  border-color: var(--primary);
}

.input-with-action {
  position: relative;
}

.input-with-action input {
  padding-right: 44px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.input-action:hover {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
}

.input-action svg {
  width: 17px;
  height: 17px;
}

.input-action .icon-eye-off {
  display: none;
}

.input-action.is-visible .icon-eye {
  display: none;
}

.input-action.is-visible .icon-eye-off {
  display: block;
}

/* ==========================================================================
   CODE / LISTS / ALERTS
   ========================================================================== */

.code-block {
  margin: 8px 0 0;
  padding: 13px 15px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(3, 7, 17, 0.62);
  color: #c7d5f2;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted-box {
  color: var(--text-muted);
}

.subhead {
  margin: 15px 0 3px;
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.55;
}

.alert.error {
  border-color: rgba(251, 113, 133, 0.32);
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
}

.alert.success {
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.09);
  color: #bbf7d0;
}

.code-inline {
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(3, 7, 17, 0.45);
  word-break: break-all;
}

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.07);
  font-size: 11px;
  line-height: 1.6;
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal {
  width: min(680px, calc(100vw - 32px));
  max-width: 680px;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.modal-wide {
  width: min(900px, calc(100vw - 32px));
  max-width: 900px;
}

.modal::backdrop {
  background: rgba(2, 5, 12, 0.78);
  backdrop-filter: blur(6px);
}

.modal-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 88vh;
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: linear-gradient(160deg, #111c31, #0a1220);
  box-shadow: var(--shadow-lg);
}

dialog[open] .modal-card {
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-kicker {
  margin-bottom: 3px;
  color: var(--primary);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.dropzone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: rgba(3, 7, 17, 0.42);
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(91, 140, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.08);
}

.dropzone-main {
  font-size: 12px;
  color: var(--text-muted);
}

.dropzone-main strong {
  color: var(--text);
}

.smart-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 310px;
  padding: 12px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(3, 7, 17, 0.45);
}

.smart-config-list {
  margin: 4px 0 0;
  padding-left: 18px;
  color: #bbf7d0;
  font-size: 11px;
  line-height: 1.7;
}

.smart-result table th,
.smart-result table td {
  padding: 7px 10px;
  font-size: 10.5px;
}

/* ==========================================================================
   TOASTS
   ========================================================================== */

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  position: relative;
  min-width: 260px;
  max-width: 430px;
  padding: 11px 15px 11px 33px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(13, 22, 38, 0.97);
  box-shadow: 0 18px 50px -18px #000;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  backdrop-filter: blur(16px);
  animation: toastIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12);
  transform: translateY(-50%);
}

.toast.ok::before {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.toast.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.12);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes authIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.03);
  }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .overview-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 286px;
    height: 100vh;
    transform: translateX(-104%);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 30px 0 90px rgba(0, 0, 0, 0.6);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    background: rgba(2, 5, 12, 0.64);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(3px);
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  body.nav-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  .sidebar-toggle {
    display: grid;
  }

  .main-content {
    --main-pad-x: 22px;
    padding: 0 var(--main-pad-x) 50px;
  }
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(520px, 100%);
  }

  .auth-aside {
    display: none;
  }

  .auth-card {
    padding: 38px 32px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 14px;
  }

  .topbar-actions {
    width: auto;
    margin-left: auto;
  }

  .topbar-actions .btn {
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  .table-card-head {
    align-items: flex-start;
  }

  .table-tools {
    width: 100%;
  }

  .search-box {
    flex: 1;
    min-width: 190px;
  }

  .search-box input {
    width: 100%;
  }

  .compact-select {
    flex: 1;
    min-width: 140px;
  }

  .route-targets .endpoint-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .target-meta {
    grid-column: 1 / -1;
    text-align: left;
  }

  .card {
    padding: 17px;
  }

  .card-header {
    flex-direction: column;
    gap: 9px;
  }
}

@media (max-width: 560px) {
  .main-content {
    --main-pad-x: 14px;
    padding: 0 var(--main-pad-x) 42px;
  }

  .topbar {
    padding-top: 14px;
    padding-bottom: 12px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .pg-key-status {
    align-items: flex-start;
  }

  .pg-key-status-text span {
    white-space: normal;
  }

  .eyebrow {
    font-size: 8.5px;
    letter-spacing: 0.1em;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .auth-gate {
    padding: 16px;
  }

  .auth-card {
    padding: 30px 21px;
    gap: 15px;
  }

  .auth-heading h1 {
    font-size: 22px;
  }

  .auth-shell {
    border-radius: 20px;
  }

  .modal {
    width: calc(100vw - 20px);
  }

  .modal-card {
    padding: 17px;
    border-radius: 16px;
  }

  .modal-header {
    gap: 9px;
  }

  .modal-footer .btn {
    flex: 1;
  }

  .stat-value {
    font-size: 27px;
  }

  .table-card-head {
    padding: 15px;
  }

  .btn {
    padding: 9px 12px;
  }

  .toast-container {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
