/* ── Qoder Proxy Design System ──────────────────────────────────────────── */

:root {
  /* ── Neutral base (Zinc) ──────────────────────────────────────────── */
  --bg-base: #0a0a0b;
  --bg-surface: #141416;
  --bg-elevated: #1c1c1f;
  --bg-hover: #26262a;
  --bg-active: #2e2e33;

  /* ── Accent (Indigo, single) ───────────────────────────────────────── */
  --accent: #6366f1;
  --accent-hover: #5558e3;
  --accent-subtle: rgba(99, 102, 241, 0.12);
  --accent-text: #a5b4fc;

  /* ── Text scale (clear hierarchy) ─────────────────────────────────── */
  --text-primary: #fafafa;
  --text-secondary: #d4d4d8;
  --text-tertiary: #a1a1aa;
  --text-muted: #71717a;
  --text-faint: #52525b;

  /* ── Borders ───────────────────────────────────────────────────────── */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* ── Overlays ─────────────────────────────────────────────────────── */
  --overlay-bg: rgba(0, 0, 0, 0.72);
  --backdrop-dim: rgba(0, 0, 0, 0.5);

  /* ── Semantic colors (status only) ────────────────────────────────── */
  --success: #22c55e;
  --warning: #eab308;
  --warning-strong: #f97316;
  --danger: #ef4444;

  /* ── Radii (tighter, more technical) ──────────────────────────────── */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ── Shadows (subtle, layered) ─────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  /* ── Fonts (Geist) ─────────────────────────────────────────────────── */
  --font-sans: 'Geist', 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'SFMono-Regular', monospace;
  --sidebar-width: 260px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Layout ────────────────────────────────────────────────────────────── */

.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo-prompt {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
}

.sidebar-logo-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-mono);
}

.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }

.sidebar-section {
  padding: 16px 8px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
  text-decoration: none;
  position: relative;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.sidebar-item.active {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-item svg {
  width: 18px; height: 18px;
  stroke-width: 1.75;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 120ms var(--ease);
}

.sidebar-item:hover svg {
  transform: scale(1.05);
}

.sidebar-item.active svg { color: var(--text-secondary); }

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.sidebar-footer-item:hover { background: rgba(255,255,255,0.04); color: var(--text-secondary); }

.sidebar-footer-item svg { width: 15px; height: 15px; color: var(--text-muted); }

.sidebar-server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.sidebar-server-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse-dot 2.5s ease-in-out infinite;
}

.sidebar-server-text {
  color: var(--text-tertiary);
}

.sidebar-server-uptime {
  margin-left: auto;
  color: var(--text-faint);
}

/* ── Main Content ──────────────────────────────────────────────────────── */

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 36px 40px;
  min-height: 100vh;
  position: relative;
}

.main-header { margin-bottom: 28px; }

.main-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.main-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Cards Grid ────────────────────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color 150ms var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Panel (larger sections) ───────────────────────────────────────────── */

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-action {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
  transition: color 120ms var(--ease);
}

.panel-action:hover { color: var(--accent-hover); }

/* ── Table ─────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

/* ── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: none;
  letter-spacing: 0.01em;
}

.badge-ok { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.badge-warn { background: rgba(234, 179, 8, 0.14); color: #fde047; }
.badge-error { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }
.badge-info { background: var(--accent-subtle); color: var(--accent-text); }
.badge-neutral { background: rgba(255,255,255,0.06); color: var(--text-tertiary); }

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok .badge-dot {
  animation: pulse-dot 2.5s ease-in-out infinite;
}

/* ── Button ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
  white-space: nowrap;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-tertiary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

/* ── Command Palette ───────────────────────────────────────────────────── */

.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(12px);
  z-index: 100;
  opacity: 0;
  transition: opacity 160ms var(--ease);
  pointer-events: none;
}

.cmd-backdrop.open { opacity: 1; pointer-events: auto; }

.cmd-palette {
  position: fixed;
  left: 50%;
  top: 18%;
  z-index: 101;
  width: min(680px, calc(100vw - 48px));
  max-height: 65vh;
  transform: translateX(-50%) scale(0.98);
  opacity: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  pointer-events: none;
}

.cmd-palette.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.cmd-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
}

.cmd-search svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.cmd-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: inherit;
}

.cmd-search input::placeholder { color: var(--text-muted); }

.cmd-results { padding: 6px; overflow-y: auto; max-height: calc(65vh - 56px); }

.cmd-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms var(--ease);
}

.cmd-item:hover { background: rgba(255,255,255,0.05); }

.cmd-item.selected {
  background: var(--accent-subtle);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.cmd-item-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  color: var(--text-tertiary);
}

.cmd-item-icon svg { width: 14px; height: 14px; }

.cmd-item-text { flex: 1; }

.cmd-item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.cmd-item.selected .cmd-item-label { color: var(--text-primary); }

.cmd-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cmd-item-kbd {
  display: flex; gap: 4px;
}

.cmd-item-kbd kbd {
  padding: 2px 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Utility ───────────────────────────────────────────────────────────── */

.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-faint); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast.show { 
  opacity: 1; 
  transform: translateX(0); 
}

.toast-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
}

.toast-success::before { background: var(--success); }
.toast-success { color: #86efac; }

.toast-error::before { background: var(--danger); }
.toast-error { color: #fca5a5; }

.toast-info::before { background: var(--accent); }
.toast-info { color: var(--accent-text); }

.toast-warn::before { background: var(--warning); }
.toast-warn { color: #fde047; }

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop-dim);
  backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  transition: opacity 160ms var(--ease);
  pointer-events: none;
}

.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 91;
  width: min(460px, calc(100vw - 48px));
  transform: translate(-50%, -50%) scale(0.97);
  opacity: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  pointer-events: none;
  overflow: hidden;
}

.modal.open { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 14px;
  height: 14px;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-field { margin-bottom: 14px; }

.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.modal-field input {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 150ms var(--ease);
}

.modal-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.modal-field input::placeholder { color: var(--text-faint); }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── Action Buttons (icon-only small) ──────────────────────────────────── */

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text-secondary); }
.btn-icon.danger:hover { background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.btn-icon svg { width: 14px; height: 14px; }

/* ── Section Label ─────────────────────────────────────────────────────── */

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 10px;
  font-family: var(--font-mono);
}

/* ── Cards Grid 2-col ─────────────────────────────────────────────────── */

.cards-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* ── Cards Grid 4-col ─────────────────────────────────────────────────── */

.cards-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Quota Bar ─────────────────────────────────────────────────────────── */

.quota-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.quota-bar-track.quota-bar-lg {
  height: 8px;
  border-radius: 4px;
}

.quota-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-out;
  position: relative;
  overflow: hidden;
}

.quota-bar-fill.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out 0.5s 1;
}

.quota-bar-fill.high { background: var(--success); }
.quota-bar-fill.medium { background: var(--warning); }
.quota-bar-fill.low { background: var(--warning-strong); }
.quota-bar-fill.critical { background: var(--danger); }

.request-bar {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 12px;
}

.request-bar-cell {
  flex: 1;
  border-radius: 2px;
  min-width: 0;
}

.request-bar-cell.success {
  background: rgba(34, 197, 94, 0.7);
}

.request-bar-cell.error {
  background: rgba(239, 68, 68, 0.8);
}

.request-bar-cell.empty {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Account Quota Cards Grid ──────────────────────────────────────────── */

.quota-account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quota-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 150ms var(--ease);
}

.quota-card:hover {
  border-color: var(--border-strong);
}

.quota-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quota-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.quota-card-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quota-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quota-card-label {
  font-size: 12px;
  color: var(--text-muted);
}

.quota-card-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.quota-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
}

.quota-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.quota-card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.quota-card-actions {
  display: flex;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Dropdown ──────────────────────────────────────────────────────────── */

.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
  padding: 4px;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 150ms var(--ease), color 150ms var(--ease);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 14px;
  height: 14px;
}

/* ── Small Button (removed duplicate, merged into button section) ─────── */

.btn-danger-text {
  color: var(--text-muted);
}

.btn-danger-text:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}

/* ── Button States ─────────────────────────────────────────────────────── */

.btn-loading {
  opacity: 0.5;
  cursor: wait;
  pointer-events: none;
}

.btn-loading svg {
  animation: spin 1s linear infinite;
}

.btn-success {
  color: #86efac !important;
  border-color: rgba(134, 239, 172, 0.3) !important;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

/* ── Priority Selector ──────────────────────────────────────────────────── */

.quota-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.priority-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.priority-label {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  display: none;
}

.priority-input {
  width: 38px;
  padding: 3px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
  transition: border-color 150ms var(--ease);
  -moz-appearance: textfield;
  font-family: var(--font-mono);
}

.priority-input::-webkit-inner-spin-button,
.priority-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.priority-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.priority-input::placeholder {
  color: var(--text-faint);
}

.priority-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}

.priority-clear-btn:hover {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
}

/* ── Dashboard Account Rows ───────────────────────────────────────────── */

.dash-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  transition: background 150ms var(--ease);
}

.dash-account-row:hover {
  background: var(--bg-hover);
}

.dash-account-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 80px;
}

.dash-account-priority {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  min-width: 24px;
  text-align: center;
  font-family: var(--font-mono);
}

.dash-account-stats {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
  font-family: var(--font-mono);
}

.badge-sm {
  font-size: 10px;
  padding: 1px 7px;
}

.request-bar-sm {
  height: 8px;
  width: 180px;
  flex-shrink: 0;
}

.request-bar-sm .request-bar-cell {
  border-radius: 1px;
}

/* ── Features Page ─────────────────────────────────────────────────────── */

.feature-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 150ms var(--ease);
}

.feature-card:hover {
  border-color: var(--border-strong);
}

.feature-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.feature-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.feature-card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-indicator.status-on {
  background: var(--success);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

.status-indicator.status-off {
  background: var(--text-faint);
}

.status-text {
  color: var(--text-muted);
  font-weight: 500;
}

.feature-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
}

.feature-item-info {
  flex: 1;
}

.feature-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.feature-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-hover);
  transition: background-color 0.2s var(--ease);
  border-radius: 24px;
  border: 1px solid var(--border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
  border-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

input:focus + .slider {
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* Code block styling */
code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  background: var(--bg-base);
  border-radius: 4px;
  color: var(--accent-text);
  border: 1px solid var(--border);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 transparent;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

/* Full screen (1380px+) - 6 columns for account cards */
@media (min-width: 1380px) {
  .main-content {
    padding: 36px 48px;
  }
  
  .quota-account-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .cards-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Half screen (900px - 1379px) - 3 columns for account cards */
@media (max-width: 1379px) and (min-width: 900px) {
  .main-content {
    padding: 28px 32px;
  }
  
  .cards-grid {
    gap: 12px;
  }
  
  .quota-account-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .cards-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet (768px - 899px) */
@media (max-width: 899px) and (min-width: 768px) {
  .sidebar {
    width: 220px;
  }
  
  .main-content {
    margin-left: 220px;
    padding: 24px;
  }
  
  .cards-grid,
  .cards-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  
  .quota-account-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* Mobile (below 768px) */
@media (max-width: 767px) {
  .sidebar {
    width: 56px;
    overflow: hidden;
  }
  
  .sidebar-logo-text,
  .sidebar-logo-badge,
  .sidebar-logo-prompt,
  .sidebar-section,
  .sidebar-item span,
  .sidebar-footer-item span,
  .sidebar-server-status {
    display: none;
  }
  
  .sidebar-logo {
    padding: 14px 12px;
  }
  
  .sidebar-item {
    justify-content: center;
    padding: 0;
  }
  
  .sidebar-item.active::before {
    display: none;
  }
  
  .main-content {
    margin-left: 56px;
    padding: 20px 16px;
  }
  
  .main-title {
    font-size: 18px;
  }
  
  .cards-grid,
  .cards-grid-2,
  .cards-grid-4 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .quota-account-grid {
    grid-template-columns: 1fr;
  }
  
  .table-wrap {
    font-size: 12px;
  }
  
  .modal {
    width: 90vw;
    max-width: 90vw;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .btn {
    padding: 0 11px;
    font-size: 12px;
  }
  
  .toast-container {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  
  .toast {
    font-size: 12px;
  }
  
  .sys-info-grid {
    grid-template-columns: 1fr;
  }
}

/* Extra small mobile (below 480px) */
@media (max-width: 479px) {
  .main-content {
    padding: 14px 10px;
  }
  
  .card,
  .panel {
    padding: 14px;
  }
  
  .quota-card {
    padding: 12px;
  }
  
  .modal-header,
  .modal-footer {
    padding: 12px 14px;
  }
  
  .modal-title {
    font-size: 14px;
  }
}

/* ── Settings Page ────────────────────────────────────────────────────── */

.settings-wrap {
  max-width: 560px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.settings-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.settings-input {
  width: 64px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
  transition: border-color 150ms var(--ease);
  -moz-appearance: textfield;
  font-family: var(--font-mono);
}

.settings-input::-webkit-inner-spin-button,
.settings-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.settings-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.settings-input-unit {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── System Info Panel ─────────────────────────────────────────────────── */

.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.sys-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.sys-info-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.sys-info-value {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── Input/Form Focus Ring ─────────────────────────────────────────────── */

.settings-input:focus,
.priority-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

/* ── Modal Batch Import ─────────────────────────────────────────────────── */

.modal-batch-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-batch-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.modal-batch-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 8px;
  line-height: 1.5;
}

.modal-batch-textarea {
  width: 100%;
  min-height: 110px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  transition: border-color 150ms var(--ease);
  line-height: 1.6;
}

.modal-batch-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-subtle);
}

.modal-batch-textarea::placeholder {
  color: var(--text-muted);
}
