/* agy-gateway Obsidian Dark Theme — inspired by cc-gateway */

:root {
  color-scheme: dark;
  --bg-0: #0b0d12;
  --bg-1: #11141b;
  --bg-2: #161a23;
  --bg-3: #1b2030;
  --bg-hover: rgba(255, 255, 255, 0.038);
  --border-1: #232938;
  --border-2: #2d354c;
  --text-1: #e8eaf0;
  --text-2: #aeb5c4;
  --text-3: #6f778b;
  --accent: #5b6cff;
  --accent-2: #8a7bff;
  --sub-1: #4ec98a;
  --sub-2: #4ea9ff;
  --success: #4ec98a;
  --warning: #f0b03f;
  --danger: #ff6b6b;
  --info: #4ea9ff;
  --cyan: #38d6ff;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--sans);
  font-size: 13.5px;
  background: var(--bg-0);
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2b3140;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3b4459; background-clip: content-box; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  color: #b9c4ff;
}

pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  background: #0d1017;
  border: 1px solid var(--border-1);
  border-radius: 8px;
  padding: 12px 14px;
  overflow: auto;
  margin: 0;
  color: #d7deee;
  white-space: pre-wrap;
  word-break: break-word;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.num {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.hidden { display: none !important; }

/* ─── Boot loader ────────────────────────────────────────────────────── */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-3);
  font-size: 13px;
}
.boot-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--border-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Login View (Dual Obsidian Glassmorphism) ───────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}
.login-bg.variant-super {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(91, 108, 255, 0.11), transparent 70%),
    var(--bg-0);
}
.login-bg.variant-sub {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(78, 201, 138, 0.11), transparent 70%),
    var(--bg-0);
}
.login-orb {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  pointer-events: none;
  animation: orbFloat 18s ease-in-out infinite;
}
.variant-super .login-orb.a { background: #5b6cff; top: -180px; left: -160px; }
.variant-super .login-orb.b { background: #8a7bff; bottom: -210px; right: -160px; animation-delay: -8s; }
.variant-sub .login-orb.a { background: #4ec98a; top: -180px; left: -160px; }
.variant-sub .login-orb.b { background: #4ea9ff; bottom: -210px; right: -160px; animation-delay: -8s; }
@keyframes orbFloat {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(38px, -28px, 0); }
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(400px, 100%);
  background: rgba(22, 26, 35, 0.86);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  padding: 28px 26px 24px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}
.login-brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(11, 13, 18, 0.72);
  border: 1px solid var(--border-1);
  margin-bottom: 18px;
}
.login-role-tab {
  border: none;
  background: transparent;
  color: var(--text-3);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}
.login-role-tab:hover { color: var(--text-1); }
.login-role-tab.active.super {
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.25), rgba(138, 123, 255, 0.18));
  color: #cdd3ff;
  box-shadow: inset 0 0 0 1px rgba(91, 108, 255, 0.4);
}
.login-role-tab.active.sub {
  background: linear-gradient(135deg, rgba(78, 201, 138, 0.22), rgba(78, 169, 255, 0.16));
  color: #9bf0c2;
  box-shadow: inset 0 0 0 1px rgba(78, 201, 138, 0.4);
}
.login-hint {
  color: var(--text-2);
  font-size: 12.5px;
  margin: 0 0 14px;
}
.login-field { margin-bottom: 12px; position: relative; }
.login-err {
  color: var(--danger);
  font-size: 12.5px;
  margin: 8px 0 0;
  min-height: 18px;
}
.login-submit {
  width: 100%;
  margin-top: 14px;
  height: 42px;
  font-size: 14px;
  font-weight: 600;
}
.login-shake { animation: shake 0.36s ease; }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

/* ─── App Shell ──────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--bg-0);
}

.shell-sider {
  width: 226px;
  flex: 0 0 226px;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  transition: width 200ms ease, flex-basis 200ms ease;
  overflow: hidden;
  z-index: 20;
}
.shell-sider.collapsed {
  width: 68px;
  flex-basis: 68px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 16px;
  height: 58px;
  border-bottom: 1px solid var(--border-1);
  flex: 0 0 58px;
  white-space: nowrap;
  overflow: hidden;
}
.shell-sider.collapsed .brand-row {
  padding: 0;
  justify-content: center;
}
.shell-sider.collapsed .brand-text { display: none; }
.brand-logo { display: flex; align-items: center; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.nav-list {
  flex: 1 1 auto;
  padding: 10px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 39px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: 0.82; }
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text-1); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.2), rgba(138, 123, 255, 0.1));
  color: #cdd4ff;
  box-shadow: inset 0 0 0 1px rgba(91, 108, 255, 0.28);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: #9aa6ff; }
.role-sub .nav-item.active {
  background: linear-gradient(135deg, rgba(78, 201, 138, 0.18), rgba(78, 169, 255, 0.1));
  color: #a6f2cb;
  box-shadow: inset 0 0 0 1px rgba(78, 201, 138, 0.3);
}
.role-sub .nav-item.active svg { color: #6ce29b; }
.shell-sider.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}
.shell-sider.collapsed .nav-item span { display: none; }

.nav-sep {
  height: 1px;
  background: var(--border-1);
  margin: 6px 8px;
}

.sider-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: none;
  border-top: 1px solid var(--border-1);
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 42px;
  transition: background 140ms ease, color 140ms ease;
}
.sider-toggle-bar svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.78;
  transition: transform 200ms ease, opacity 140ms ease;
}
.sider-toggle-bar:hover { background: rgba(255, 255, 255, 0.045); color: var(--text-1); }
.sider-toggle-bar:hover svg { opacity: 1; }
.shell-sider.collapsed .sider-toggle-bar { padding: 0; }
.shell-sider.collapsed .sider-toggle-bar span { display: none; }
.shell-sider.collapsed .sider-toggle-bar svg { transform: rotate(180deg); }

.shell-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-0);
}

.shell-header {
  height: 58px;
  flex: 0 0 58px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-1);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 15;
}
.header-left { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: transparent;
  color: var(--text-2);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mobile-menu-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 45;
  display: none;
}
.mobile-backdrop.open { display: block; }

.viewas-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 5px 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.18), rgba(78, 169, 255, 0.1));
  border: 1px solid rgba(91, 108, 255, 0.36);
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}
.viewas-banner strong { color: #d5daff; font-weight: 600; }
.viewas-exit {
  border: 1px solid rgba(91, 108, 255, 0.42);
  background: rgba(91, 108, 255, 0.24);
  color: #e6e9ff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.viewas-exit:hover { background: rgba(91, 108, 255, 0.38); }

.user-menu-wrap { position: relative; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: var(--bg-2);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 140ms;
}
.user-chip:hover { border-color: var(--border-2); }
.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.user-avatar.super { background: linear-gradient(135deg, #5b6cff, #8a7bff); }
.user-avatar.sub { background: linear-gradient(135deg, #4ec98a, #4ea9ff); }

.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 172px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52);
  z-index: 60;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.dropdown-item svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.82; }
.dropdown-item:hover { background: rgba(255, 255, 255, 0.06); }
.dropdown-item.danger { color: #ff8b8b; }
.dropdown-divider { height: 1px; background: var(--border-1); margin: 4px 6px; }

.shell-content {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

/* ─── Header Realtime Telemetry Pill ─────────────────────────────────── */
.rt-root { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.rt-wrap { position: relative; }
.rt-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  height: 34px;
  padding: 0 13px 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  color: var(--text-2);
  font: inherit;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
}
.rt-pill:hover {
  border-color: rgba(91, 108, 255, 0.45);
  background: linear-gradient(180deg, rgba(91, 108, 255, 0.10), rgba(91, 108, 255, 0.04));
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.10);
}
.rt-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4b5266;
  flex: 0 0 auto;
}
.rt-dot.ok { background: var(--success); }
.rt-dot.warn { background: var(--warning); }
.rt-dot.danger { background: var(--danger); }
.rt-dot.ok::after, .rt-dot.warn::after, .rt-dot.danger::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0;
  animation: rtPulse 2s ease-out infinite;
}
.rt-dot.ok::after { border-color: var(--success); }
.rt-dot.warn::after { border-color: var(--warning); }
.rt-dot.danger::after { border-color: var(--danger); }
@keyframes rtPulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}
.rt-spark { display: block; width: 54px; height: 18px; flex: 0 0 auto; overflow: visible; }
.rt-kv { display: inline-flex; align-items: baseline; gap: 5px; }
.rt-k { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-3); }
.rt-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.rt-v.warn { color: var(--warning); }
.rt-v.danger { color: var(--danger); }
.rt-vsep { width: 1px; height: 15px; background: var(--border-2); opacity: 0.7; }
.rt-if { display: inline-flex; align-items: center; gap: 5px; }
.rt-if-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
}
.rt-if.live .rt-if-dot { background: var(--cyan); }
.rt-if.live .rt-if-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--cyan);
  animation: rtPulse 1.5s ease-out infinite;
}
.rt-if.live .rt-v { color: #7ae5ff; }

.rt-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 372px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 13px;
  padding: 15px 16px 13px;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.6);
  z-index: 80;
  display: none;
}
.rt-wrap.open .rt-popover { display: block; }
.rt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.rt-card-head strong { font-size: 13.5px; font-weight: 600; }
.rt-hero {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(11, 13, 18, 0.55);
  border: 1px solid var(--border-1);
  margin-bottom: 10px;
}
.rt-hero-sep { background: var(--border-1); }
.rt-hero-v { display: block; font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; color: var(--text-1); line-height: 1.15; }
.rt-hero-k { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }
.rt-if-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-1);
  margin-bottom: 10px;
}
.rt-if-row.live {
  background: rgba(56, 214, 255, 0.08);
  border-color: rgba(56, 214, 255, 0.26);
}
.rt-stack {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 7px;
}
.rt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 11px;
}
.rt-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.rt-swatch { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.rt-bars-wrap {
  height: 54px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 4px 2px 0;
  border-bottom: 1px solid var(--border-1);
}
.rt-bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}
.rt-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  background: rgba(120, 134, 255, 0.55);
  transition: background 120ms;
}
.rt-bar.current { background: #8f9bff; }
.rt-bar.zero { background: rgba(255, 255, 255, 0.09); height: 2px !important; }
.rt-bar-col:hover .rt-bar { background: #b3bcff; }

/* ─── Page Chrome ────────────────────────────────────────────────────── */
.page {
  padding: 20px 26px 32px;
  max-width: 1520px;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.page-subtitle {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-3);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-spacer { flex: 1 1 auto; }

/* ─── Buttons, Inputs, Switches, Pills ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 140ms ease;
}
.btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.btn:hover:not(:disabled) { border-color: #3f4b6a; background: var(--bg-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, #5b6cff, #6f7cff);
  border-color: rgba(120, 134, 255, 0.7);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6b7bff, #818dff);
  box-shadow: 0 4px 16px rgba(91, 108, 255, 0.32);
}
.btn.emerald {
  background: linear-gradient(135deg, #2ca96c, #3ab88f);
  border-color: rgba(78, 201, 138, 0.6);
  color: #fff;
  font-weight: 600;
}
.btn.emerald:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(78, 201, 138, 0.3);
}
.btn.danger {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.34);
  color: #ff9494;
}
.btn.danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.24);
  border-color: rgba(255, 107, 107, 0.55);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: var(--text-1); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.14);
}
.input.sm, .select.sm { height: 32px; padding: 4px 10px; font-size: 12.5px; }
.input::placeholder, .textarea::placeholder { color: #5d6579; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d869b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.select:hover, .input:hover:not(:focus) { border-color: #3a4460; }
.select option { background: var(--bg-2); color: var(--text-1); }
.textarea { min-height: 76px; resize: vertical; font-family: var(--mono); font-size: 12px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-3);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 140ms;
}
.seg-btn:hover { color: var(--text-1); }
.seg-btn.active {
  background: var(--bg-3);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.pill.ok { background: rgba(78, 201, 138, 0.13); color: #6ce29b; border-color: rgba(78, 201, 138, 0.28); }
.pill.err { background: rgba(255, 107, 107, 0.13); color: #ff8b8b; border-color: rgba(255, 107, 107, 0.28); }
.pill.warn { background: rgba(240, 176, 63, 0.13); color: #f2be6b; border-color: rgba(240, 176, 63, 0.28); }
.pill.info { background: rgba(78, 169, 255, 0.13); color: #7bc1ff; border-color: rgba(78, 169, 255, 0.28); }
.pill.accent { background: rgba(91, 108, 255, 0.14); color: #a5b0ff; border-color: rgba(91, 108, 255, 0.30); }
.pill.ultra { background: linear-gradient(135deg, rgba(138, 123, 255, 0.22), rgba(240, 176, 63, 0.18)); color: #e2ceff; border-color: rgba(167, 139, 250, 0.42); }
.pill.cyan { background: rgba(56, 214, 255, 0.13); color: #74e4ff; border-color: rgba(56, 214, 255, 0.32); }
.pill.muted { background: rgba(255, 255, 255, 0.045); color: var(--text-3); border-color: rgba(255, 255, 255, 0.08); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Custom Toggle Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  cursor: pointer;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #272e40;
  border: 1px solid var(--border-2);
  transition: background 160ms, border-color 160ms;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cfd5e4;
  transition: transform 160ms ease, background 160ms;
}
.switch input:checked + .switch-track {
  background: rgba(78, 201, 138, 0.28);
  border-color: rgba(78, 201, 138, 0.6);
}
.switch input:checked + .switch-track::after {
  transform: translateX(16px);
  background: #6ce29b;
}

/* ─── Cards & Panels ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2, .card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ─── Dashboard KPIs ─────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  transition: border-color 160ms;
}
.kpi-card:hover { border-color: var(--border-2); }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.85;
}
.kpi-card[data-tone="cost"]::before { background: linear-gradient(90deg, #5b6cff, #8a7bff); }
.kpi-card[data-tone="req"]::before { background: linear-gradient(90deg, #4ec98a, #38d6ff); }
.kpi-card[data-tone="tok"]::before { background: linear-gradient(90deg, #4ea9ff, #7d8bff); }
.kpi-card[data-tone="hit"]::before { background: linear-gradient(90deg, #f0b03f, #ff8f5b); }

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi-sub { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.kpi-value {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.15;
}
.kpi-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.kpi-delta { font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.kpi-delta.up { color: #6ce29b; }
.kpi-delta.down { color: #ff8b8b; }
.kpi-delta.new { color: #7bc1ff; }
.kpi-delta.flat { color: var(--text-3); }

.kpi-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-mini {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 11px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.kpi-mini .k { font-size: 12px; color: var(--text-3); }
.kpi-mini .v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 700; color: var(--text-1); }

/* Live Telemetry Strip (Concurrency / RPM / TPM / SLA / TTFT) */
.live-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.live-tile {
  background: linear-gradient(180deg, rgba(27, 32, 48, 0.7), rgba(22, 26, 35, 0.9));
  border: 1px solid var(--border-1);
  border-radius: 11px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.live-tile.active {
  border-color: rgba(56, 214, 255, 0.36);
  background: linear-gradient(180deg, rgba(56, 214, 255, 0.08), rgba(22, 26, 35, 0.92));
}
.live-tile-k {
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-tile-v {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
}
.live-tile-sub { font-size: 11px; color: var(--text-3); }

/* Account Pool Health Bar */
.pool-health-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: center;
}
.ac-bar {
  display: flex;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 10px;
  gap: 2px;
}
.ac-seg.ok { background: var(--success); }
.ac-seg.warn { background: var(--warning); }
.ac-seg.err { background: var(--danger); }
.ac-seg.muted { background: #5a6275; }
.ac-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.ac-tile {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ac-tile-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ac-tile-dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(78, 201, 138, 0.16); }
.ac-tile-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px rgba(240, 176, 63, 0.16); }
.ac-tile-dot.err { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.16); }
.ac-tile-dot.muted { background: #6b7387; }
.ac-tile-k { font-size: 11.5px; color: var(--text-3); display: block; }
.ac-tile-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; }

/* ─── Multi-Series Chart ─────────────────────────────────────────────── */
.ms-wrap { position: relative; }
.ms-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ms-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 150ms, border-color 150ms;
}
.ms-legend-btn.focused { border-color: var(--border-2); color: var(--text-1); }
.ms-legend-btn.dimmed { opacity: 0.35; }
.ms-swatch { width: 8px; height: 8px; border-radius: 50%; }
.ms-peak { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 600; }
.ms-svg-box { position: relative; width: 100%; height: 270px; }
.ms-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ms-tooltip {
  position: absolute;
  top: 12px;
  pointer-events: none;
  background: rgba(22, 26, 35, 0.95);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 9px 12px;
  min-width: 175px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  z-index: 10;
}
.ms-tip-title {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-1);
  padding-bottom: 4px;
}
.ms-tip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 3px 0;
}
.ms-tip-k { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.ms-tip-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-1); }

/* ─── Tables ─────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: var(--bg-1);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #151a25;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-1);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(35, 41, 56, 0.72);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
table.data-table tfoot td {
  background: #151a25;
  border-top: 1px solid var(--border-2);
  font-weight: 600;
}
.right { text-align: right !important; }
.center { text-align: center !important; }

.cost-bar-cell { display: flex; flex-direction: column; gap: 4px; min-width: 96px; }
.cost-bar { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.cost-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5b6cff, #8a7bff); }

.hit-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.hit-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.hit-fill { height: 100%; border-radius: 999px; }
.hit-fill.ok { background: var(--success); }
.hit-fill.warn { background: var(--warning); }
.hit-fill.low { background: #ff8c42; }
.hit-fill.idle { background: rgba(255, 255, 255, 0.14); }
.hit-num { font-variant-numeric: tabular-nums; font-size: 12px; width: 44px; text-align: right; color: var(--text-2); }

/* ─── Friendly Account Pool & Quota Bars (CLIProxyAPI + cc-gateway) ──── */
.status-tabs {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 140ms;
}
.status-tab:hover { border-color: var(--border-2); color: var(--text-1); }
.status-tab.active {
  background: rgba(91, 108, 255, 0.14);
  border-color: rgba(91, 108, 255, 0.42);
  color: #cdd4ff;
  font-weight: 600;
}
.status-tab .cnt {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.pool-quota-banner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.pq-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 11px;
  padding: 11px 14px;
}
.pq-k { font-size: 11.5px; color: var(--text-3); display: flex; justify-content: space-between; align-items: center; }
.pq-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 700; margin-top: 3px; }

/* ─── View Mode Switcher (Card / List) & cc-gateway Card Grid ───────── */
.view-switch {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 9px;
  border: 1px solid var(--border-1);
  background: var(--bg-1);
}
.vs-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.vs-btn svg { width: 14px; height: 14px; }
.vs-btn:hover { color: var(--text-1); }
.vs-btn.on {
  color: var(--text-1);
  background: rgba(91, 108, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(91, 108, 255, 0.38);
  font-weight: 600;
}

.acct-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 14px;
  padding-top: 2px;
}

.acct-grid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 42%), var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 13px;
  padding: 13px 16px 12px;
  gap: 11px;
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.acct-grid-card:hover {
  border-color: var(--border-2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.30);
  transform: translateY(-1px);
}
.acct-grid-card.status-err {
  border-color: rgba(255, 107, 107, 0.30);
}
.acct-grid-card.status-warn {
  border-color: rgba(240, 176, 63, 0.28);
}
.acct-grid-card.status-err::before,
.acct-grid-card.status-warn::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  border-radius: 13px 13px 0 0;
  background: linear-gradient(90deg, #ff6b6b, rgba(255, 107, 107, 0.15));
}
.acct-grid-card.status-warn::before {
  background: linear-gradient(90deg, #f0b03f, rgba(240, 176, 63, 0.15));
}
.acct-grid-card.status-disabled {
  opacity: 0.78;
}
.acct-grid-card.status-disabled .acg-label { color: var(--text-2); }
.acct-grid-card.is-open {
  border-color: rgba(138, 123, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(138, 123, 255, 0.15), 0 10px 26px rgba(0, 0, 0, 0.30);
}

.acg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.acg-top-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.acg-top-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.acg-more-wrap { position: relative; }
.acg-more-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 140ms, border-color 140ms, color 140ms;
}
.acg-more-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-1);
  color: var(--text-1);
}

.acg-ident {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.acg-label-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.acg-label {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acg-email {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* 3-tile stats row (在途 / 今日 / 累计 & Credits) — matching cc-gateway AccountRowItem card */
.acg-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.acg-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.acg-stat.live {
  background: rgba(56, 214, 255, 0.075);
  border-color: rgba(56, 214, 255, 0.24);
}
.acg-stat-k {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.03em;
}
.acg-stat-v {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.acg-stat-v.money { color: #7fd0a0; }
.acg-stat-v.live-num { color: #6fe0ff; display: inline-flex; align-items: center; gap: 6px; }
.acg-stat-v.idle-num { color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.acg-stat-sub {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.acg-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.acg-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.acg-foot-meta {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 14px;
  min-width: 0;
}
.acg-fm-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.acg-fm-k { font-size: 10px; font-weight: 600; color: var(--text-3); }
.acg-fm-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.acg-foot-acts {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

/* Compact list mode */
.acct-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.acct-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 13px 16px;
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) 150px minmax(280px, 1.5fr) auto;
  gap: 16px;
  align-items: center;
  transition: border-color 150ms, background 150ms;
  cursor: pointer;
}
.acct-card:hover {
  border-color: #364060;
  background: #181d28;
}
.acct-card.status-err { border-left: 3px solid var(--danger); }
.acct-card.status-warn { border-left: 3px solid var(--warning); }
.acct-card.status-ok { border-left: 3px solid var(--success); }
.acct-card.status-disabled { border-left: 3px solid #52596c; opacity: 0.78; }
.acct-card.is-open {
  border-color: rgba(138, 123, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(138, 123, 255, 0.14);
}

.acct-ident { min-width: 0; }
.acct-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.acct-id { font-family: var(--sans); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--text-3); }
.acct-label { font-weight: 600; font-size: 14px; color: var(--text-1); }
.acct-email {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.acct-metrics {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.acct-m-row { display: flex; justify-content: space-between; gap: 8px; }
.acct-m-k { color: var(--text-3); }
.acct-m-v { font-family: var(--sans); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-1); }

/* Quota Progress Bars */
.qbars {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.qbar-item { display: flex; flex-direction: column; gap: 3px; }
.qbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}
.qbar-name {
  color: var(--text-2);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qbar-right {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  font-family: var(--sans); font-variant-numeric: tabular-nums;
}
.qbar-reset { font-size: 10.5px; color: var(--text-3); }
.qbar-pct { font-weight: 700; font-size: 11.5px; min-width: 36px; text-align: right; }
.qbar-pct.ok { color: #6ce29b; }
.qbar-pct.warn { color: #f2be6b; }
.qbar-pct.low { color: #ff9a5b; }
.qbar-pct.zero { color: #ff7b7b; }
.qbar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.qbar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 250ms ease;
}
.qbar-fill.ok { background: linear-gradient(90deg, #39b879, #6ce29b); }
.qbar-fill.warn { background: linear-gradient(90deg, #d8962a, #f3c46b); }
.qbar-fill.low { background: linear-gradient(90deg, #e0682c, #ff9b5e); }
.qbar-fill.zero { background: #ff6b6b; }

.acct-cooldown-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.acct-err-strip {
  grid-column: 1 / -1;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-family: var(--mono);
  background: rgba(255, 107, 107, 0.09);
  border: 1px solid rgba(255, 107, 107, 0.24);
  color: #ffa1a1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-err-strip.warn {
  background: rgba(240, 176, 63, 0.09);
  border-color: rgba(240, 176, 63, 0.24);
  color: #f4c878;
}

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

/* ─── Modals & Slide-Over Drawer ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}
.modal-box {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 15px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.65);
  padding: 20px 22px;
}
.modal-box.wide { width: min(680px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-1);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row { margin-bottom: 12px; }
.form-row.full { grid-column: 1 / -1; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.form-help { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  margin-bottom: 8px;
}
.toggle-row strong { font-size: 13px; display: block; }
.toggle-row span { font-size: 11.5px; color: var(--text-3); }

/* Slide-Over Drawer (Account Quota Inspector) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.68);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
  z-index: 85;
}
.drawer-panel {
  width: min(740px, 100vw);
  height: 100%;
  background: var(--bg-1);
  border-left: 1px solid var(--border-2);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 22px 28px;
}
.drawer-section {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 15px 16px;
  margin-bottom: 14px;
}
.drawer-section h4 {
  margin: 0 0 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quota-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.quota-group-card {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 12px 14px;
}
.quota-group-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quota-group-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
  line-height: 1.4;
}
.model-quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 8px;
}
.model-q-row {
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 8px;
  padding: 9px 11px;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  font-size: 12.5px;
}
.kv-item .k { color: var(--text-3); font-size: 11px; display: block; }
.kv-item .v { font-family: var(--mono); color: var(--text-1); word-break: break-all; }

/* ─── Wire Inspector 4-Panel Split ───────────────────────────────────── */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wire-pre { max-height: 380px; }

/* ─── Toasts ─────────────────────────────────────────────────────────── */
#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  color: var(--text-1);
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  max-width: 440px;
  animation: toastIn 160ms ease;
}
.toast-item.ok { border-left-color: var(--success); }
.toast-item.err { border-left-color: var(--danger); }
.toast-item.warn { border-left-color: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-state {
  text-align: center;
  padding: 42px 18px;
  color: var(--text-3);
  font-size: 13px;
}

/* ─── Proxy Test Geo Card, Timezone Picker & 2-Step OAuth Wizard ─────── */
.wiz-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
}
.wiz-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
}
.wiz-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-2);
  color: var(--text-3);
}
.wiz-step.active { color: var(--text-1); font-weight: 600; }
.wiz-step.active .wiz-step-num {
  background: linear-gradient(135deg, #5b6cff, #8a7bff);
  border-color: rgba(138, 123, 255, 0.65);
  color: #fff;
}
.wiz-step.done { color: #6ce29b; }
.wiz-step.done .wiz-step-num {
  background: rgba(78, 201, 138, 0.18);
  border-color: rgba(78, 201, 138, 0.5);
  color: #6ce29b;
}
.wiz-sep {
  flex: 1;
  height: 1px;
  background: var(--border-1);
}

.proxy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}
.proxy-row .input { flex: 1; min-width: 0; }
.test-btn { flex-shrink: 0; white-space: nowrap; height: auto; }

.geo-card {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}
.geo-card.bad {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.05);
}
.geo-line { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.geo-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.geo-chip.lat.fast { color: #6ce29b; border-color: rgba(78, 201, 138, 0.38); }
.geo-chip.lat.mid { color: #f2be6b; border-color: rgba(240, 176, 63, 0.38); }
.geo-chip.lat.slow { color: #ff8b8b; border-color: rgba(255, 107, 107, 0.38); }
.geo-chip.tz { color: #a7b3ff; border-color: rgba(91, 108, 255, 0.42); }
.geo-sub {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--mono);
}
.geo-warn { color: #f0b03f; font-size: 12px; }
.geo-ok { color: #6ce29b; font-size: 12px; }
.geo-err { color: #ff8b8b; font-size: 12.5px; font-weight: 600; }

.tz-input-wrap { position: relative; }
.tz-input-wrap .input { padding-right: 32px; }
.tz-clear-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tz-clear-btn:hover { background: rgba(255, 255, 255, 0.14); color: var(--text-1); }

/* OAuth Redirect Mode Cards */
.redirect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.redirect-card {
  appearance: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border-1);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.005));
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.redirect-card:hover { border-color: var(--border-2); }
.redirect-card.active {
  border-color: rgba(91, 108, 255, 0.72);
  background: linear-gradient(180deg, rgba(91, 108, 255, 0.13), rgba(91, 108, 255, 0.03));
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.14);
}
.rc-top { display: flex; align-items: center; gap: 7px; }
.rc-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--text-3);
  position: relative;
}
.redirect-card.active .rc-dot { border-color: var(--accent); }
.redirect-card.active .rc-dot::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--accent);
}
.rc-title { font-weight: 600; font-size: 12.5px; color: var(--text-1); }
.rc-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: #b7c3ff;
  background: rgba(91, 108, 255, 0.16);
  border: 1px solid rgba(91, 108, 255, 0.35);
}
.rc-uri {
  font-size: 11px;
  color: #7bc1ff;
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  border-radius: 6px;
  padding: 3px 7px;
  word-break: break-all;
}
.rc-desc { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--text-3); }

/* OAuth Step 2 Vertical Timeline */
.redirect-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  border: 1px solid rgba(91, 108, 255, 0.38);
  background: var(--bg-1);
}
.rb-label { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.rb-uri { flex: 1; min-width: 0; font-size: 11.5px; color: #7bc1ff; background: transparent; border: 0; padding: 0; word-break: break-all; }
.oa-timeline { list-style: none; margin: 0 0 12px; padding: 0; }
.oa-timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 15px; }
.oa-timeline li:last-child { padding-bottom: 4px; }
.oa-timeline li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: 2px;
  width: 1px;
  background: var(--border-2);
}
.oa-step-no {
  flex-shrink: 0;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #b8c2ff;
  background: rgba(91, 108, 255, 0.16);
  border: 1px solid rgba(91, 108, 255, 0.42);
}
.oa-step-body { flex: 1; min-width: 0; padding-top: 2px; }
.oa-step-title { font-size: 13px; color: var(--text-2); line-height: 1.55; margin-bottom: 6px; }
.oa-step-title strong { color: var(--text-1); }
.url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: 9px;
}
.url-code {
  flex: 1;
  font-size: 11px;
  background: transparent;
  border: none;
  word-break: break-all;
  white-space: pre-wrap;
  padding: 0;
  color: var(--text-2);
  max-height: 68px;
  overflow-y: auto;
}
.url-actions { display: flex; gap: 6px; flex-shrink: 0; }
.parse-hint { margin-top: 6px; font-size: 12px; color: #6ce29b; }
.parse-hint.warn { color: #f2be6b; }
.parse-hint.bad { color: #ff8b8b; }
.parse-code {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-0);
  border: 1px solid var(--border-1);
}
.pc-k { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); flex-shrink: 0; }
.parse-code code { font-size: 11.5px; color: var(--text-1); background: transparent; border: 0; padding: 0; word-break: break-all; }

/* ─── TagInput & Model Whitelist Category Presets (cc-gateway style) ─── */
.mwl-editor { display: flex; flex-direction: column; gap: 9px; }
.mwl-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.mwl-lead {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  margin-right: 2px;
}
.mwl-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 10px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--bg-1);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}
.mwl-chip:hover {
  border-color: #46537a;
  color: var(--text-1);
  background: var(--bg-3);
}
.mwl-ico { width: 12px; height: 12px; flex-shrink: 0; }
.mwl-cnt {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-3);
}

/* Partial state: distinct half-circle indicator + dashed warm/family border */
.mwl-partial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  border: 1.5px solid currentColor;
}
.mwl-chip.state-partial {
  border-style: dashed;
  color: #f5cc7d;
  border-color: rgba(240, 176, 63, 0.58);
  background: rgba(240, 176, 63, 0.10);
  box-shadow: 0 0 0 2px rgba(240, 176, 63, 0.08);
}
.mwl-chip.state-partial .mwl-cnt {
  background: rgba(240, 176, 63, 0.22);
  color: #ffe0a3;
}
.mwl-chip.state-partial.tone-gemini {
  color: #8fd0ff;
  border-color: rgba(78, 169, 255, 0.62);
  background: rgba(78, 169, 255, 0.10);
  box-shadow: 0 0 0 2px rgba(78, 169, 255, 0.08);
}
.mwl-chip.state-partial.tone-gemini .mwl-cnt { background: rgba(78, 169, 255, 0.22); color: #cdeaff; }
.mwl-chip.state-partial.tone-claude {
  color: #cbb8ff;
  border-color: rgba(167, 139, 250, 0.62);
  background: rgba(167, 139, 250, 0.10);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.08);
}
.mwl-chip.state-partial.tone-claude .mwl-cnt { background: rgba(167, 139, 250, 0.22); color: #e5dcff; }
.mwl-chip.state-partial.tone-gpt {
  color: #8ce9b5;
  border-color: rgba(78, 201, 138, 0.62);
  background: rgba(78, 201, 138, 0.10);
  box-shadow: 0 0 0 2px rgba(78, 201, 138, 0.08);
}
.mwl-chip.state-partial.tone-gpt .mwl-cnt { background: rgba(78, 201, 138, 0.22); color: #c7f9de; }

/* Full selected state: crisp solid accent tint per model family */
.mwl-chip.state-full {
  font-weight: 600;
  color: #d6dcff;
  border-color: rgba(91, 108, 255, 0.72);
  background: linear-gradient(135deg, rgba(91, 108, 255, 0.26), rgba(138, 123, 255, 0.16));
  box-shadow: 0 0 0 2px rgba(91, 108, 255, 0.14);
}
.mwl-chip.state-full .mwl-cnt { background: rgba(91, 108, 255, 0.34); color: #eef0ff; }
.mwl-chip.state-full.tone-gemini {
  color: #cbeaff;
  border-color: rgba(78, 169, 255, 0.75);
  background: linear-gradient(135deg, rgba(78, 169, 255, 0.25), rgba(56, 214, 255, 0.14));
  box-shadow: 0 0 0 2px rgba(78, 169, 255, 0.14);
}
.mwl-chip.state-full.tone-gemini .mwl-cnt { background: rgba(78, 169, 255, 0.34); color: #eef8ff; }
.mwl-chip.state-full.tone-claude {
  color: #e6ddff;
  border-color: rgba(167, 139, 250, 0.75);
  background: linear-gradient(135deg, rgba(138, 123, 255, 0.28), rgba(192, 132, 252, 0.16));
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.14);
}
.mwl-chip.state-full.tone-claude .mwl-cnt { background: rgba(167, 139, 250, 0.34); color: #f6f2ff; }
.mwl-chip.state-full.tone-gpt {
  color: #c8f9de;
  border-color: rgba(78, 201, 138, 0.75);
  background: linear-gradient(135deg, rgba(78, 201, 138, 0.24), rgba(56, 214, 255, 0.12));
  box-shadow: 0 0 0 2px rgba(78, 201, 138, 0.14);
}
.mwl-chip.state-full.tone-gpt .mwl-cnt { background: rgba(78, 201, 138, 0.34); color: #ecfff5; }

.mwl-clear {
  appearance: none;
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.mwl-clear:hover { color: #ff9494; background: rgba(255, 107, 107, 0.10); }

/* TagInput container (mirrors cc-gateway/web/src/components/TagInput.vue) */
.tag-input-wrap { width: 100%; }
.tag-input {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 98px;
  max-height: 230px;
  overflow-y: auto;
  padding: 10px 12px 26px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  cursor: text;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.tag-input:hover { border-color: var(--accent); }
.tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 108, 255, 0.18);
}
.tag-input.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.14);
  animation: tagShake 0.25s ease;
}
.tag-input.is-disabled { opacity: 0.55; cursor: not-allowed; }
@keyframes tagShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 6px 3px 9px;
  background: rgba(91, 108, 255, 0.12);
  border: 1px solid rgba(91, 108, 255, 0.35);
  border-radius: 6px;
  line-height: 1.4;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.tag-chip:hover {
  background: rgba(91, 108, 255, 0.19);
  border-color: rgba(138, 123, 255, 0.55);
}
.tag-chip.is-dup {
  background: rgba(240, 176, 63, 0.20);
  border-color: var(--warning);
  transform: scale(1.04);
}
.tag-chip.is-armed {
  background: rgba(255, 107, 107, 0.16);
  border-color: var(--danger);
}
.tag-text {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex: none;
  transition: background 120ms ease, color 120ms ease;
}
.tag-x:hover { background: rgba(255, 107, 107, 0.22); color: var(--danger); }
.tag-entry {
  flex: 1 1 160px;
  min-width: 160px;
  padding: 3px 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}
.tag-entry::placeholder { color: var(--text-3); font-family: var(--sans); }
.tag-count {
  position: absolute;
  right: 10px;
  bottom: 6px;
  font-size: 11px;
  color: var(--text-3);
  user-select: none;
  pointer-events: none;
  font-family: var(--sans); font-variant-numeric: tabular-nums;
}
.tag-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
  line-height: 1.45;
}

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1160px) {
  .kpi-grid, .kpi-mini-grid, .pool-quota-banner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acct-card { grid-template-columns: 1fr 1fr; }
  .pool-health-body { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .mobile-menu-btn { display: inline-flex; }
  .shell-sider {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    width: 240px !important;
  }
  .shell-sider.mobile-open { transform: translateX(0); }
  .rt-root { display: none; }
  .page { padding: 14px 14px 28px; }
  .kpi-grid, .kpi-mini-grid, .live-strip, .ac-tiles, .pool-quota-banner, .acct-card, .split-2, .form-grid, .kv-grid, .redirect-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
 * v2 polish layer — depth, motion, refined tables & the request-log page
 * ═══════════════════════════════════════════════════════════════════════ */

/* Ambient depth: faint top glow behind content, translucent header. */
.shell-content {
  background:
    radial-gradient(1200px 420px at 18% -8%, rgba(91, 108, 255, 0.075), transparent 60%),
    radial-gradient(900px 360px at 100% -10%, rgba(56, 214, 255, 0.04), transparent 60%),
    var(--bg-0);
}
.shell-header {
  background: rgba(17, 20, 27, 0.82);
  backdrop-filter: saturate(140%) blur(10px);
}
.shell-sider { background: linear-gradient(180deg, #121620 0%, #0f121a 100%); }
.nav-item { position: relative; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #8a7bff, #5b6cff);
  box-shadow: 0 0 10px rgba(91, 108, 255, 0.6);
}
.role-sub .nav-item.active::before { background: linear-gradient(180deg, #6ce29b, #4ea9ff); box-shadow: 0 0 10px rgba(78, 201, 138, 0.5); }

.page-title > span:first-child {
  background: linear-gradient(180deg, #ffffff 0%, #c9cfe0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Cards: soft top highlight + depth. */
.card, .kpi-card, .drawer-section {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 120px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 8px 24px rgba(0, 0, 0, 0.18);
}
.card-head h2, .card-head h3 { letter-spacing: -0.01em; }

/* Tables: sticky header, calmer separators, clear hover. */
.table-wrap {
  background: linear-gradient(180deg, rgba(22, 26, 35, 0.9), rgba(17, 20, 27, 0.9));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}
table.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #141924;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #7a8297;
  padding: 11px 14px;
}
table.data-table td { padding: 11px 14px; border-bottom-color: rgba(42, 49, 66, 0.55); }
table.data-table tbody tr { transition: background 120ms ease; }
table.data-table tbody tr:hover td { background: rgba(91, 108, 255, 0.045); }

/* Buttons & focus */
.btn { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:focus-visible, .seg-btn:focus-visible, .nav-item:focus-visible, .input:focus-visible, .select:focus-visible {
  outline: 2px solid rgba(91, 108, 255, 0.55);
  outline-offset: 1px;
}
.seg { background: rgba(13, 16, 23, 0.8); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; }
.seg-btn.active { background: linear-gradient(180deg, #222941, #1b2133); color: #e4e8ff; }

/* Empty state with icon */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state > svg { width: 30px; height: 30px; opacity: 0.35; }
.empty-state .boot-spinner { width: 22px; height: 22px; }

/* Motion: drawer slide, modal pop */
.drawer-backdrop { animation: fadeIn 160ms ease; }
.drawer-panel { animation: drawerIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.drawer-panel.wide { width: min(920px, 100vw); }
.modal-backdrop { animation: fadeIn 140ms ease; }
.modal-box { animation: modalIn 180ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drawerIn { from { transform: translateX(28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes modalIn { from { transform: translateY(8px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { background: linear-gradient(180deg, #181d29, #151a24); }
.drawer-body { background: var(--bg-1); }

/* ─── Request log page ───────────────────────────────────────────────── */
.lk-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.lk-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 90px);
  border: 1px solid var(--border-1);
  border-radius: 12px;
  padding: 13px 15px 12px;
  transition: border-color 160ms, transform 160ms;
}
.lk-card:hover { border-color: var(--border-2); }
.lk-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  opacity: 0.8;
  background: linear-gradient(90deg, #5b6cff, #8a7bff);
}
.lk-card[data-tone="ok"]::after { background: linear-gradient(90deg, #4ec98a, #38d6ff); }
.lk-card[data-tone="ttft"]::after { background: linear-gradient(90deg, #fbbf24, #f472b6); }
.lk-card[data-tone="dur"]::after { background: linear-gradient(90deg, #38bdf8, #a78bfa); }
.lk-card[data-tone="cost"]::after { background: linear-gradient(90deg, #8a7bff, #f472b6); }
.lk-card[data-tone="hit"]::after { background: linear-gradient(90deg, #f0b03f, #ff8f5b); }
.lk-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.lk-value {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.lk-sub { margin-top: 5px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lk-value.tone-ok { color: #6ce29b; }
.lk-value.tone-warn { color: #f2be6b; }
.lk-value.tone-err { color: #ff8b8b; }
.lk-value.lat-excellent, .dstat-v.lat-excellent { color: #34d399; }
.lk-value.lat-good, .dstat-v.lat-good { color: #86efac; }
.lk-value.lat-warn, .dstat-v.lat-warn { color: #fbbf24; }
.lk-value.lat-crit, .dstat-v.lat-crit { color: #f87171; }

.agg-card { padding: 16px 18px; }
.agg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.agg-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.agg-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.agg-cat {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 104px;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-1);
}
.agg-cat-k { font-size: 11px; color: var(--text-3); }
.agg-cat-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.agg-cat-p { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.lg-toolbar { gap: 8px; }
.search-box { position: relative; width: 236px; }
.search-box svg { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box .input { padding-left: 31px; }
.chk-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: all 140ms;
}
.chk-chip input { accent-color: #f0b03f; margin: 0; }
.chk-chip.on { border-color: rgba(240, 176, 63, 0.5); background: rgba(240, 176, 63, 0.1); color: #f2be6b; }
.result-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.live-dot.on { background: #4ec98a; animation: livePulse 1.4s ease-out infinite; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(78, 201, 138, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(78, 201, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(78, 201, 138, 0); }
}

.lg-table-wrap { max-height: calc(100vh - 210px); overflow: auto; }
.lg-table td { vertical-align: middle; }
.lg-row, .tr-row { cursor: pointer; }
.lg-row.is-err td:first-child, .tr-row.is-err td:first-child { box-shadow: inset 3px 0 0 rgba(255, 107, 107, 0.75); }
.lg-time .t-main { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-1); }
.lg-time .t-sub, .cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.cell-main { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.model-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.model-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 8px currentColor; }
.model-dot.lg { width: 10px; height: 10px; }
.model-name { font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cost-cell { font-weight: 700; color: #cfd5ff; }
.chev { color: var(--text-3); font-size: 18px; line-height: 1; transition: transform 140ms, color 140ms; }
.lg-row:hover .chev, .tr-row:hover .chev { color: var(--text-1); transform: translateX(2px); }

/* Latency cell (cc-gateway): tone bar + 首字/总耗时 + per-row phase strip */
.latency-cell { display: flex; gap: 10px; align-items: stretch; min-height: 34px; }
.latency-bar { width: 3px; border-radius: 2px; background: var(--border-1); flex-shrink: 0; }
.latency-bar.lat-excellent { background: linear-gradient(180deg, #6ee7b7 0%, #10b981 100%); box-shadow: 0 0 5px rgba(52, 211, 153, 0.35); }
.latency-bar.lat-good { background: linear-gradient(180deg, #86efac 0%, #34d399 100%); opacity: 0.85; }
.latency-bar.lat-warn { background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%); box-shadow: 0 0 6px rgba(251, 191, 36, 0.45); }
.latency-bar.lat-crit {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.55);
  animation: lat-pulse 2.2s ease-in-out infinite;
}
@keyframes lat-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 12px rgba(248, 113, 113, 0.85); }
}
.latency-rows { display: flex; flex-direction: column; gap: 2px; min-width: 0; justify-content: center; flex: 1; }
.latency-row { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; line-height: 1.2; }
.latency-label { font-size: 10px; color: var(--text-3); letter-spacing: 0.04em; flex-shrink: 0; min-width: 32px; }
.latency-value { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.latency-value.lat-excellent { color: #34d399; }
.latency-value.lat-good { color: #86efac; }
.latency-value.lat-warn { color: #fbbf24; }
.latency-value.lat-crit { color: #f87171; text-shadow: 0 0 8px rgba(248, 113, 113, 0.25); }
.latency-dash { font-size: 12px; color: var(--text-3); }
.lat-strip {
  display: flex;
  height: 3px;
  margin-top: 4px;
  max-width: 120px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
}
.lat-strip span { height: 100%; }

/* TTFT phase breakdown (cc-gateway style) */
.ttft-bd { display: flex; flex-direction: column; gap: 11px; width: 100%; }
.ttft-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
}
.ttft-bar.lg { height: 16px; border-radius: 8px; }
.ttft-seg { height: 100%; min-width: 2px; box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.35); transition: filter 0.15s ease; }
.ttft-seg:last-child { box-shadow: none; }
.ttft-seg:hover { filter: brightness(1.18); }
.ttft-legend { display: flex; flex-wrap: wrap; gap: 7px 18px; }
.ttft-li { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; line-height: 1.4; cursor: default; }
.ttft-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ttft-li-label { color: var(--text-1); }
.ttft-li-cat { font-size: 10px; padding: 0 6px; border-radius: 999px; line-height: 16px; color: var(--text-3); background: rgba(148, 163, 184, 0.14); }
.ttft-li-cat.cat-网络 { color: #7dd3fc; background: rgba(56, 189, 248, 0.14); }
.ttft-li-cat.cat-上游 { color: #c4b5fd; background: rgba(167, 139, 250, 0.14); }
.ttft-li-cat.cat-模型 { color: #fcd34d; background: rgba(251, 191, 36, 0.14); }
.ttft-li-cat.cat-网关 { color: #cbd5e1; background: rgba(100, 116, 139, 0.18); }
.ttft-li-val { color: var(--text-1); font-variant-numeric: tabular-nums; font-weight: 600; }
.ttft-li-pct { color: var(--text-3); font-variant-numeric: tabular-nums; }
.ttft-verdict {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 7px 11px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--vc) 10%, transparent);
  border-left: 2px solid var(--vc);
}
.ttft-verdict-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--vc); flex: 0 0 auto; box-shadow: 0 0 8px var(--vc); }
.ttft-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ttft-empty { font-size: 12.5px; color: var(--text-3); padding: 4px 0; }

/* Drawer content blocks */
.dstat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dstat {
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border-1);
  min-width: 0;
}
.dstat-k { font-size: 11.5px; color: var(--text-3); }
.dstat-v { margin-top: 3px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dstat-s { margin-top: 2px; font-size: 11px; color: var(--text-3); }
.bill-line {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--border-2);
  font-size: 12.5px; color: var(--text-2);
}
.bill-line strong { font-size: 18px; color: #cfd5ff; font-variant-numeric: tabular-nums; }
.kv-list { display: grid; gap: 7px; font-size: 12.5px; }
.kv-list > div { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.kv-list > div > span:first-child { flex: 0 0 72px; color: var(--text-3); }
.copyable { cursor: pointer; transition: background 120ms, border-color 120ms; word-break: break-all; }
.copyable:hover { background: rgba(91, 108, 255, 0.14); border-color: rgba(91, 108, 255, 0.4); }
.drawer-error {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.drawer-error strong { color: #ff9b9b; font-size: 12.5px; }
.drawer-error pre { margin-top: 6px; background: rgba(0, 0, 0, 0.25); border-color: rgba(255, 107, 107, 0.2); color: #ffc2c2; max-height: 180px; }

/* Wire capture tabs */
.wire-tabs-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wire-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.wire-tab {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-1);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 140ms;
}
.wire-tab span { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wire-tab:hover { color: var(--text-1); border-color: var(--border-2); }
.wire-tab.active { background: rgba(91, 108, 255, 0.14); border-color: rgba(91, 108, 255, 0.45); color: #dfe3ff; font-weight: 600; }
.wire-head { max-height: 170px; margin-bottom: 8px; color: #b7c3ff; }
.wire-body-wrap { position: relative; }
.wire-body-wrap .wire-pre { max-height: 460px; }
.wire-copy { position: absolute; top: 6px; right: 6px; z-index: 1; background: rgba(22, 26, 35, 0.9) !important; }

@media (max-width: 1280px) {
  .lk-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .lk-grid, .dstat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { width: 100%; }
}
