/* ═══════════════════════════════════════════════════════════
   AWS BEDROCK QUOTA CHECKER — Dark Theme
   Palette: GitHub Dark + Electric Blue accents
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-base:     #0D1117;
  --bg-mantle:   #161B22;
  --bg-surface0: #1C2128;
  --bg-surface1: #21262D;
  --bg-surface2: #2D333B;
  --border:      #30363D;
  --border-hi:   #3D444D;

  --text:        #E6EDF3;
  --text-muted:  #8B949E;
  --text-dim:    #6E7681;

  --blue:        #58A6FF;
  --blue-dim:    #1F6FEB;
  --green:       #3FB950;
  --green-dim:   #196C2E;
  --red:         #F85149;
  --red-dim:     #6E1C18;
  --yellow:      #E3B341;
  --yellow-dim:  #735C0F;
  --purple:      #BC8CFF;
  --orange:      #F78166;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;

  --font:        'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.6);
  --transition:  150ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ══════════════════════════════════════════════
   TITLEBAR
   ══════════════════════════════════════════════ */
#titlebar {
  display: flex;
  align-items: center;
  height: 38px;
  background: var(--bg-mantle);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  -webkit-app-region: drag;
  flex-shrink: 0;
  gap: 10px;
}

#titlebar .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  -webkit-app-region: no-drag;
}

#titlebar .logo svg { color: var(--blue); }

#titlebar .spacer { flex: 1; }

#titlebar .win-controls {
  display: flex;
  gap: 6px;
  -webkit-app-region: no-drag;
}

/* ── Custom window controls (Windows/Linux) ─── */
.win-btn {
  width: 28px; height: 28px;
  border: none; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.win-btn:hover { background: var(--bg-surface1); color: var(--text); }
.win-btn.close:hover { background: var(--red-dim); color: var(--red); }

/* ══════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════ */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
#sidebar {
  width: 240px;
  min-width: 200px;
  background: var(--bg-mantle);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  gap: 20px;
  flex-shrink: 0;
}

.sidebar-section {}

.sidebar-section h3 {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

/* ── Proxy status pill ───────────────────────── */
.proxy-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.proxy-status-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.6; transform:scale(.8); }
}

/* ── Stats pills ─────────────────────────────── */
.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.stat-pill {
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.stat-pill .val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--blue);
  line-height: 1;
}

.stat-pill .lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 3px;
}

.stat-pill.success .val { color: var(--green); }
.stat-pill.invalid .val { color: var(--red);   }
.stat-pill.total   .val { color: var(--blue);  }

/* ── Concurrency slider ──────────────────────── */
.threads-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.threads-row label { font-size: 11px; color: var(--text-muted); flex: 1; }
.threads-row .val  { font-family: var(--font-mono); font-size: 12px; color: var(--blue); width: 20px; text-align: right; }

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-surface2);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 6px rgba(88,166,255,.4);
  cursor: pointer;
  transition: transform var(--transition);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── Sidebar buttons ─────────────────────────── */
.sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.sidebar-btn:hover { background: var(--bg-surface1); border-color: var(--border-hi); color: var(--text); }
.sidebar-btn svg   { flex-shrink: 0; color: var(--blue); }

/* ── Main content ────────────────────────────── */
#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 24px;
  gap: 0;
}

#content-inner {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   INPUT CARD
   ══════════════════════════════════════════════ */
.card {
  background: var(--bg-mantle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.card-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.card-header .badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(88,166,255,.3);
}

/* Mode toggle (Bedrock / EC2) */
.mode-toggle {
  display: flex;
  gap: 3px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-left: auto;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: .02em;
}
.mode-btn:hover { color: var(--text-muted); }
.mode-btn.active {
  background: var(--bg-surface2);
  box-shadow: var(--shadow-sm);
}
.mode-btn[data-mode="bedrock"].active { color: var(--purple); }
.mode-btn[data-mode="ec2"].active     { color: var(--orange); }

/* EC2 value badges in table */
.quota-val.ec2-od { color: var(--orange); }
.quota-val.ec2-sp { color: var(--yellow); }
.mode-badge-ec2 {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(247,129,102,.15);
  color: var(--orange);
  border: 1px solid rgba(247,129,102,.3);
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: .04em;
}

/* Tabs inside card */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--bg-surface0);
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
}
.tab-btn.active {
  background: var(--bg-surface2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Input grid ──────────────────────────────── */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.input-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.field input, .field select {
  padding: 8px 12px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field input::placeholder { color: var(--text-dim); }
.field input:focus, .field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}

.field input.mono { font-family: var(--font-mono); font-size: 12px; }

.field select {
  cursor: pointer;
  appearance: none;
  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='%238B949E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.field select option { background: var(--bg-surface1); }

/* ── Bulk textarea ───────────────────────────── */
.bulk-area {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 10px 12px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  outline: none;
  transition: border-color var(--transition);
}
.bulk-area::placeholder { color: var(--text-dim); }
.bulk-area:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(88,166,255,.15); }

/* Smart Parse area — taller, green accent */
.smart-area {
  min-height: 160px;
  font-size: 11.5px;
  line-height: 1.7;
  white-space: pre;
}
.smart-area:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63,185,80,.12); }

.bulk-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

.use-proxy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* ── Checkbox ────────────────────────────────── */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
}

.checkbox-wrap input[type=checkbox] {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-surface0);
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  flex-shrink: 0;
}
.checkbox-wrap input[type=checkbox]:checked {
  background: var(--blue);
  border-color: var(--blue);
}
.checkbox-wrap input[type=checkbox]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 2px;
  width: 5px; height: 8px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  outline: none;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover   { background: #79b8ff; box-shadow: 0 0 12px rgba(88,166,255,.35); }
.btn-primary:active  { transform: scale(.97); }
.btn-primary:disabled{ background: var(--bg-surface2); color: var(--text-dim); cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: var(--bg-surface1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover  { background: var(--bg-surface2); color: var(--text); border-color: var(--border-hi); }
.btn-secondary:active { transform: scale(.97); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(248,81,73,.3);
}
.btn-danger:hover { background: #5c1b18; }

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(63,185,80,.3);
}
.btn-success:hover { background: #1b5c2b; }

.btn-sm { padding: 5px 10px; font-size: 11px; }

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

/* ══════════════════════════════════════════════
   RESULTS SECTION
   ══════════════════════════════════════════════ */
.results-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.results-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.results-header .filter-row {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.filter-chip {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover  { border-color: var(--blue); color: var(--blue); }
.filter-chip.active { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }
.filter-chip.v46    { color: var(--purple); border-color: var(--purple); }
.filter-chip.v46.active { background: rgba(188,140,255,.15); border-color: var(--purple); }

/* ── Table wrapper ───────────────────────────── */
.table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}

.table-wrap table {
  flex: 1;
}

.table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.table-wrap::-webkit-scrollbar-track  { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

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

thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-surface0);
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition);
}
thead th:hover { color: var(--text); }
thead th .sort-icon { margin-left: 4px; opacity: .5; }
thead th.sorted-asc .sort-icon, thead th.sorted-desc .sort-icon { opacity: 1; color: var(--blue); }

tbody tr {
  border-bottom: 1px solid rgba(48,54,61,.5);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface0); }
tbody tr.selected { background: rgba(88,166,255,.07); }

td { padding: 10px 14px; vertical-align: middle; }

/* ── Column widths ───────────────────────────── */
.col-expand { min-width: 160px; }
.col-mono   { font-family: var(--font-mono); font-size: 11px; }
.col-number { text-align: right; font-family: var(--font-mono); font-weight: 600; }

/* ── Status badges ───────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.status-badge.success   { background: rgba(63,185,80,.15);  color: var(--green);  border: 1px solid rgba(63,185,80,.3); }
.status-badge.invalid   { background: rgba(248,81,73,.15);  color: var(--red);    border: 1px solid rgba(248,81,73,.3); }
.status-badge.error     { background: rgba(248,81,73,.1);   color: var(--orange); border: 1px solid rgba(247,129,102,.3); }
.status-badge.no_access { background: rgba(227,179,65,.12); color: var(--yellow); border: 1px solid rgba(227,179,65,.3); }
.status-badge.checking  { background: rgba(88,166,255,.12); color: var(--blue);   border: 1px solid rgba(88,166,255,.3); }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.success .status-dot   { animation: pulse-dot 2s infinite; box-shadow: 0 0 4px currentColor; }
.status-badge.checking .status-dot  { animation: spin .8s linear infinite; background: transparent; border: 2px solid currentColor; border-top-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── TPM/RPM value chips ─────────────────────── */
.quota-val {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.quota-val.zero    { color: var(--text-dim); }
.quota-val.high    { color: var(--green); }
.quota-val.medium  { color: var(--yellow); }
.quota-val.low     { color: var(--red); }

/* ── Version tag ─────────────────────────────── */
.ver-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.ver-tag.v46 { background: rgba(188,140,255,.2); color: var(--purple); border: 1px solid rgba(188,140,255,.4); }
.ver-tag.v4x { background: rgba(88,166,255,.15); color: var(--blue); border: 1px solid rgba(88,166,255,.3); }
.ver-tag.v35 { background: rgba(63,185,80,.12); color: var(--green); border: 1px solid rgba(63,185,80,.3); }
.ver-tag.v3  { background: var(--bg-surface1); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Inference type chip ─────────────────────── */
.inf-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  background: var(--bg-surface1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.inf-chip.cross { background: rgba(88,166,255,.1); color: var(--blue); border-color: rgba(88,166,255,.25); }
.inf-chip.prov  { background: rgba(227,179,65,.1);  color: var(--yellow); border-color: rgba(227,179,65,.25); }
.inf-chip.batch { background: rgba(247,129,102,.1); color: var(--orange); border-color: rgba(247,129,102,.25); }

/* ── Empty state ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 14px;
  color: var(--text-dim);
  flex: 1;
  min-height: 200px;
}
.empty-state svg  { opacity: .15; }
.empty-state h3   { font-size: 15px; color: var(--text-muted); font-weight: 600; }
.empty-state p    { font-size: 12px; text-align: center; max-width: 300px; line-height: 1.7; color: var(--text-dim); }
.empty-state .empty-tips {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.empty-state .tip-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════ */
.progress-wrap {
  height: 3px;
  background: var(--bg-surface1);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 0;
  display: none;
}
.progress-wrap.visible { display: block; }
.progress-bar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue-dim), var(--blue));
  transition: width .3s ease;
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { left: 200%; } }

/* ══════════════════════════════════════════════
   STATUSBAR
   ══════════════════════════════════════════════ */
#statusbar {
  height: 26px;
  background: var(--bg-mantle);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.sb-item { display: flex; align-items: center; gap: 5px; }
.sb-dot  { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.sb-dot.busy { background: var(--yellow); animation: pulse-dot 1s infinite; }

/* ══════════════════════════════════════════════
   SELECT2 (Country dropdown in sidebar)
   ══════════════════════════════════════════════ */
.country-select {
  width: 100%;
  padding: 8px 30px 8px 10px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  appearance: none;
  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='%238B949E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: border-color var(--transition);
}
.country-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(88,166,255,.15); }
.country-select option { background: var(--bg-surface1); }

/* ══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 36px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text);
  pointer-events: auto;
  animation: toast-in .2s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }

@keyframes toast-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes toast-out{ to   { opacity:0; transform:translateY(8px); } }

/* ══════════════════════════════════════════════
   MODAL (Account detail)
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fade-in .15s ease;
}
.modal-overlay.open { display: flex; }
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--bg-mantle);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 680px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modal-in { from { opacity:0; transform:scale(.94); } to { opacity:1; transform:none; } }

.modal-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.modal-header h3 { font-size: 14px; font-weight: 600; flex: 1; }

.modal-body { flex:1; overflow-y: auto; padding: 20px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Detail sections ─────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-item {
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.detail-item .key  { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing:.06em; margin-bottom: 4px; }
.detail-item .val  { font-size: 13px; font-family: var(--font-mono); color: var(--text); word-break: break-all; }

/* ── Mini quota table in modal ───────────────── */
.mini-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.mini-table th { padding: 6px 10px; background: var(--bg-surface0); color: var(--text-dim); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing:.06em; border-bottom: 1px solid var(--border); }
.mini-table td { padding: 7px 10px; border-bottom: 1px solid rgba(48,54,61,.4); }
.mini-table tr:hover td { background: var(--bg-surface0); }

/* ══════════════════════════════════════════════
   ANIMATIONS & UTILITIES
   ══════════════════════════════════════════════ */
.fade-in  { animation: fade-in  .2s ease; }
.spin     { animation: spin .8s linear infinite; display: inline-block; }

.text-green  { color: var(--green)  !important; }
.text-red    { color: var(--red)    !important; }
.text-yellow { color: var(--yellow) !important; }
.text-blue   { color: var(--blue)   !important; }
.text-purple { color: var(--purple) !important; }
.text-muted  { color: var(--text-muted) !important; }
.text-dim    { color: var(--text-dim) !important; }
.bold        { font-weight: 700; }
.mono        { font-family: var(--font-mono); }

/* ══════════════════════════════════════════════
   FORMAT TOGGLE (Simple / Smart Parse inside Bulk tab)
   ══════════════════════════════════════════════ */
.format-toggle {
  display: flex;
  gap: 3px;
  background: var(--bg-surface0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  margin-bottom: 10px;
}
.format-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.format-btn:hover { color: var(--text-muted); }
.format-btn.active {
  background: var(--bg-surface2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.format-btn[data-format="smart"].active { color: var(--green); }

/* ══════════════════════════════════════════════
   HAMBURGER BUTTON (hidden on desktop)
   ══════════════════════════════════════════════ */
#btn-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  -webkit-app-region: no-drag;
  transition: background var(--transition), color var(--transition);
}
#btn-sidebar-toggle:hover { background: var(--bg-surface1); color: var(--text); }

/* Sidebar backdrop overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#sidebar-overlay.visible { display: block; }

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 768 px)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Allow scrolling on body */
  html, body { overflow: auto; height: auto; }
  #app { height: auto; min-height: 100vh; }

  /* Show hamburger */
  #btn-sidebar-toggle { display: flex; }

  /* Titlebar larger touch target */
  #titlebar { height: 48px; padding: 0 12px; gap: 8px; }
  #titlebar .logo span { font-size: 14px; }

  /* ── Sidebar becomes a slide-in drawer ────── */
  #main-layout { flex-direction: column; overflow: visible; }

  #sidebar {
    position: fixed;
    left: -270px;
    top: 48px;
    bottom: 0;
    width: 255px;
    z-index: 100;
    transition: left .22s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    padding: 14px 10px;
  }
  #sidebar.mobile-open { left: 0; }

  /* ── Content fills screen ─────────────────── */
  #content {
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    min-height: 0;
  }

  /* ── Cards ───────────────────────────────── */
  .card { padding: 12px 10px; border-radius: var(--radius-md); margin-bottom: 8px; }
  .card-header { padding-bottom: 10px; flex-wrap: wrap; gap: 6px; }
  .card-header h2 { font-size: 13px; }

  /* Mode toggle full-width on mobile */
  .mode-toggle { margin-left: 0; width: 100%; }

  /* ── Tabs ────────────────────────────────── */
  .tab-bar { overflow-x: auto; gap: 2px; }
  .tab-btn  { padding: 5px 10px; font-size: 11px; white-space: nowrap; }

  /* ── Single check grid → 1 col ───────────── */
  .input-grid-4 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* ── Format toggle full-width ────────────── */
  .format-toggle { width: 100%; }
  .format-btn    { flex: 1; justify-content: center; }

  /* ── Textareas ───────────────────────────── */
  .bulk-area  { min-height: 110px; font-size: 11px; }
  .smart-area { min-height: 140px; font-size: 11px; }

  /* ── Results table ───────────────────────── */
  .results-card { overflow: hidden; }
  .table-wrap   { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .results-header { flex-wrap: wrap; gap: 6px; }
  .filter-row     { flex-wrap: wrap; gap: 4px; overflow-x: auto; }
  .filter-chip    { font-size: 10px; padding: 3px 8px; white-space: nowrap; }

  /* Hide Proxy and Quotas count columns — less useful on mobile */
  #results-table th:nth-child(7),
  #results-table td:nth-child(7),
  #results-table th:nth-child(8),
  #results-table td:nth-child(8) { display: none; }

  #results-table { font-size: 11px; }
  #results-table th,
  #results-table td { padding: 7px 5px; }

  /* ── Statusbar ───────────────────────────── */
  #statusbar { font-size: 10px; padding: 0 10px; height: 24px; }

  /* ── Modal full-screen on mobile ─────────── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
  }
  .detail-grid { grid-template-columns: 1fr; }
  .modal-body  { padding: 14px; }

  /* ── Sidebar sections compact ────────────── */
  .sidebar-section { gap: 0; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat-pill .val { font-size: 16px; }
}
.hidden      { display: none !important; }
