/* MCP Gateway dashboard — modern systematic dark mode.
   Token-driven: every color, radius, spacing, and shadow used below is
   defined once here, so the whole UI stays visually consistent. */

/* Sarabun (Google Fonts), self-hosted under /fonts — the dashboard's CSP is
   font-src 'self', so nothing is fetched from fonts.googleapis.com at runtime. */
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sarabun-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sarabun-400-thai.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/sarabun-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/sarabun-500-thai.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/sarabun-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/sarabun-600-thai.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sarabun-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sarabun-700-thai.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}

:root {
  /* Surfaces — layered from base to most-elevated */
  --surface-0: #08090d; /* page background */
  --surface-1: #0e1015; /* sidebar, titlebar */
  --surface-2: #14161d; /* cards */
  --surface-3: #1a1d26; /* nested / hovered surfaces */
  --surface-4: #21242f; /* inputs, code fields */

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text-primary: #f3f5f9;
  --text-secondary: #a4acbb;
  --text-tertiary: #6b7385;
  --text-disabled: #454b58;

  /* Brand accent — bold electric violet */
  --accent-9: #3b0f6b;
  --accent-8: #5b1fb0;
  --accent-7: #7c3aed;
  --accent-6: #9a5cf7;
  --accent-5: #c9b3fb;
  --accent-soft: rgba(124, 58, 237, 0.16);
  --accent-glow: rgba(139, 63, 245, 0.55);
  --accent-contrast: #fdfbff;

  /* Semantic */
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, 0.13);
  --danger: #f5566a;
  --danger-soft: rgba(245, 86, 106, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);

  /* Scale */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, 0.6);
  --shadow-ring: 0 0 0 3px var(--accent-soft);

  --font-sans: "Sarabun", "Segoe UI Variable Text", "Segoe UI", -apple-system, "Leelawadee UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", ui-monospace, Consolas, "Courier New", monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--surface-0);
  background-image: radial-gradient(circle at 12% -10%, rgba(139, 63, 245, 0.12), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(52, 211, 153, 0.05), transparent 38%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1,
h2,
h3 {
  font-family: inherit;
}

/* ── Scrollbars ──────────────────────────────── */

@supports (scrollbar-width: thin) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
}

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

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

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #363c4c;
  background-clip: padding-box;
}

/* ── Accessibility utility ───────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Icons ───────────────────────────────────── */

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

.icon-sm {
  width: 12px;
  height: 12px;
  stroke-width: 2.1;
}

.icon-lg {
  width: 20px;
  height: 20px;
}

/* Material Symbols icons ship as filled compound paths, not open strokes —
   this overrides the default line-icon rendering for those specific symbols. */
.icon-fill {
  fill: currentColor;
  stroke: none;
}

/* ── Title bar ───────────────────────────────── */

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 24px 13px 14px;
  background: rgba(14, 16, 21, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.badge-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-5);
  background: var(--accent-soft);
  border: 1px solid rgba(139, 63, 245, 0.32);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--surface-2);
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.pill.offline .dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.lang-switch {
  display: flex;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 6px 15px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent-7);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ── Layout ──────────────────────────────────── */

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-1);
  overflow-y: auto;
}

.nav-item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-item .icon {
  color: var(--text-tertiary);
  transition: color 0.15s var(--ease);
}

.nav-item:hover .icon {
  color: var(--text-secondary);
}

.nav-item.active .icon {
  color: var(--accent-6);
}

.nav-item::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--accent-6);
  transition: height 0.18s var(--ease);
}

.nav-item:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--text-primary);
  font-weight: 650;
  background: linear-gradient(90deg, var(--accent-soft), transparent 85%);
}

.nav-item.active::before {
  height: 18px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}

.foot-label {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.foot-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--success);
  margin-top: 2px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 64px;
  min-width: 0;
}

/* ── Views ───────────────────────────────────── */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 0.22s var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.view-head.compact {
  margin-bottom: 16px;
  align-items: center;
}

h1 {
  font-size: 26px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

h2 {
  font-size: 14.5px;
  margin: 0 0 14px;
  font-weight: 650;
  color: var(--text-primary);
  letter-spacing: -0.1px;
}

.subtitle {
  margin: 5px 0 0;
  color: var(--text-tertiary);
  font-size: 13.5px;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Cards ───────────────────────────────────── */

.card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* The one permanent, recommended ChatGPT connection path - visually distinct
   from a plain card so it reads as "this one, not the Cloudflare card below". */
.card-highlight {
  border-color: rgba(52, 211, 153, 0.35);
  background: linear-gradient(120deg, var(--success-soft), var(--surface-2) 65%);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.mini-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px 18px;
  transition: border-color 0.15s var(--ease);
}

.mini-card:hover {
  border-color: var(--border);
}

.mini-label {
  font-size: 10.5px;
  letter-spacing: 1.1px;
  color: var(--text-tertiary);
  font-weight: 650;
  text-transform: uppercase;
}

.mini-value {
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
  word-break: break-all;
  margin-top: 3px;
  font-family: var(--font-mono);
  letter-spacing: -0.2px;
}

/* ── Home hero ───────────────────────────────── */

.page-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 30px 24px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(150deg, rgba(124, 58, 237, 0.16), var(--surface-2) 55%);
  box-shadow: var(--shadow-md);
}

.page-hero-glow {
  position: absolute;
  inset: -45% -8% auto auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(154, 92, 247, 0.35), transparent 70%);
  pointer-events: none;
}

.page-hero-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--accent-5);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-hero-heading h1 {
  margin: 0;
}

.page-hero-heading .subtitle {
  margin-top: 6px;
}

.hero-status {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.hero-orb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.hero-orb-core {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d8fce9, var(--success) 46%, #0f7a53);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14), 0 6px 18px -4px rgba(52, 211, 153, 0.6);
}

.hero-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(52, 211, 153, 0.35);
  animation: hero-pulse 2.4s var(--ease) infinite;
}

@keyframes hero-pulse {
  0% {
    transform: scale(0.55);
    opacity: 0.9;
  }
  80%,
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.hero-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

/* ── Controls ────────────────────────────────── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.08s var(--ease),
    box-shadow 0.15s var(--ease);
  white-space: nowrap;
}

.btn .icon {
  color: var(--text-tertiary);
}

.btn:hover:not(:disabled) {
  background: var(--surface-4);
  border-color: var(--border-strong);
}

.btn:hover:not(:disabled) .icon {
  color: var(--text-secondary);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-ring);
}

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

/* Bold, high-saturation electric-violet gradient with a real glow — the
   primary call to action reads as deliberate, not another flat SaaS button. */
.btn-primary {
  background: linear-gradient(160deg, var(--accent-6) 0%, var(--accent-7) 45%, var(--accent-9) 130%);
  border-color: rgba(180, 140, 255, 0.45);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 0 0 1px rgba(124, 58, 237, 0.25),
    0 10px 26px -8px var(--accent-glow);
}

.btn-primary .icon {
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(160deg, #ad78f9 0%, var(--accent-6) 45%, var(--accent-8) 130%);
  border-color: rgba(201, 179, 251, 0.6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.26) inset, 0 0 0 1px rgba(154, 92, 247, 0.35),
    0 14px 32px -8px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Green "go" gradient for the tunnel start action specifically, distinct from
   the violet .btn-primary used for the app's other primary actions. */
.btn-start {
  background: linear-gradient(160deg, #6ee7b7 0%, var(--success) 45%, #0f7a53 130%);
  border-color: rgba(110, 231, 183, 0.45);
  color: #06341f;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 0 0 1px rgba(52, 211, 153, 0.25),
    0 10px 26px -8px rgba(52, 211, 153, 0.55);
}

.btn-start .icon {
  color: #06341f;
}

.btn-start:hover:not(:disabled) {
  background: linear-gradient(160deg, #a7f3d0 0%, #6ee7b7 45%, var(--success) 130%);
  border-color: rgba(167, 243, 208, 0.6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.26) inset, 0 0 0 1px rgba(52, 211, 153, 0.35),
    0 14px 32px -8px rgba(52, 211, 153, 0.6);
  transform: translateY(-1px);
}

.btn-start:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-danger {
  background: transparent;
  border-color: rgba(245, 86, 106, 0.35);
  color: #ff9aa6;
}

.btn-danger .icon {
  color: #ff9aa6;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #ffb3bc;
}

.btn-danger:hover:not(:disabled) .icon {
  color: #ffb3bc;
}

.input,
.select {
  width: 100%;
  background: var(--surface-4);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13.5px;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input::placeholder {
  color: var(--text-disabled);
}

.input:hover,
.select:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--accent-7);
  box-shadow: var(--shadow-ring);
}

.select {
  cursor: pointer;
}

.search-field {
  position: relative;
}

.search-field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-field-input {
  padding-left: 36px;
}

.search-field:focus-within .search-field-icon {
  color: var(--accent-6);
}

.row-inline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.row-inline .input,
.row-inline .select {
  flex: 1;
  min-width: 180px;
}

.row-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 550;
  margin: 14px 0 6px;
}

.hint {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: 8px 0 0;
  line-height: 1.55;
}

.code-field {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 10px;
  word-break: break-all;
  color: var(--accent-5);
}

.tunnel-state {
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.tunnel-state.running {
  color: var(--success);
}

.tunnel-state.error {
  color: var(--danger);
}

.warn-box {
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(245, 165, 36, 0.24);
  background: var(--warning-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.55;
  color: #f4cb8e;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--surface-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}

.switch input:checked + .slider {
  background: var(--accent-7);
  border-color: var(--accent-7);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: #fff;
}

.switch input:focus-visible + .slider {
  box-shadow: var(--shadow-ring);
}

/* ── Tabs ────────────────────────────────────── */

.tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 16px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  font-family: inherit;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--surface-1);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab .icon {
  color: inherit;
}

/* ── Lists ───────────────────────────────────── */

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-empty {
  color: var(--text-tertiary);
  padding: 20px;
  background: var(--surface-1);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  text-align: center;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.15s var(--ease);
}

.list-row:hover {
  border-color: var(--border);
}

.list-row.active-row {
  border-color: rgba(139, 63, 245, 0.4);
  background: linear-gradient(90deg, var(--accent-soft), var(--surface-1) 70%);
}

.list-main {
  min-width: 0;
  flex: 1;
}

.list-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.list-row.active-row .list-title {
  color: var(--accent-5);
}

.list-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  word-break: break-all;
  margin-top: 4px;
}

.list-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.tag-READ {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.24);
}

.tag-WRITE {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.24);
}

.tag-EXECUTE {
  background: var(--accent-soft);
  color: var(--accent-5);
  border-color: rgba(139, 63, 245, 0.32);
}

.tag-DANGEROUS {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(245, 86, 106, 0.28);
}

.tag-ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.24);
}

.tag-warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(245, 165, 36, 0.26);
}

.tag-fail,
.tag-deny,
.tag-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(245, 86, 106, 0.28);
}

/* ── Log output ──────────────────────────────── */

.log-output {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: #b6bfd1;
}

/* ── Toast ───────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  max-width: 80vw;
  z-index: 50;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast #toast-icon {
  color: var(--success);
}

.toast.error #toast-icon {
  color: var(--danger);
}

.toast.error {
  border-color: rgba(245, 86, 106, 0.4);
}

.hidden {
  display: none !important;
}
