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

:root, [data-theme="dark"] {
  --bg: #0b0f19;
  --surface: #111827;
  --surface-2: #1a2234;
  --surface-3: #243047;
  --border: rgba(255,255,255,.08);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-glow: rgba(99,102,241,.25);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --sidebar-w: 260px;
  --font: 'Inter', system-ui, sans-serif;
  --topbar-bg: rgba(17,24,39,.6);
  --input-placeholder: #64748b;
  --code-bg: var(--surface-2);
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #e2e8f0;
  --border: rgba(15,23,42,.1);
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-glow: rgba(79,70,229,.15);
  --shadow: 0 4px 24px rgba(15,23,42,.08);
  --topbar-bg: rgba(255,255,255,.85);
  --input-placeholder: #94a3b8;
  --code-bg: #f1f5f9;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,.18), transparent),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.login-logo h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.login-logo p { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sidebar-brand-text h2 { font-size: .95rem; font-weight: 700; }
.sidebar-brand-text span { font-size: .72rem; color: var(--text-muted); }

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 8px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 500;
  transition: all .15s;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-2);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }

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

.theme-toggle-sidebar {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
}

.topbar-balances {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-balance-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.topbar-balance-pill.smspva {
  border-color: rgba(99,102,241,.3);
  background: linear-gradient(135deg, rgba(99,102,241,.1), var(--surface-2));
}

.topbar-balance-pill.fivesim {
  border-color: rgba(56,189,248,.3);
  background: linear-gradient(135deg, rgba(56,189,248,.1), var(--surface-2));
}

.topbar-balance-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.topbar-balance-value {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.topbar-balance-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar-balance-dot.ok { background: var(--success); }
.topbar-balance-dot.low { background: var(--danger); }

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

.sidebar-balance-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.sidebar-balance-card.smspva {
  border-color: rgba(99,102,241,.25);
  background: linear-gradient(135deg, rgba(99,102,241,.08), transparent);
}

.sidebar-balance-card.fivesim {
  border-color: rgba(56,189,248,.25);
  background: linear-gradient(135deg, rgba(56,189,248,.08), transparent);
}

.sidebar-balance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.sidebar-balance-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.sidebar-balance-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.sidebar-balance-dot.ok { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.sidebar-balance-dot.low { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,.5); }

.sidebar-balance-value {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.sidebar-balance-sub {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-section-bottom {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.1); color: var(--danger); border-color: rgba(239,68,68,.3); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.topbar-meta { font-size: .82rem; color: var(--text-muted); }
.content { padding: 28px 32px 48px; }

.menu-toggle {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}

/* ── Cards & Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent), #a78bfa); }
.stat-card.green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.blue::before { background: linear-gradient(90deg, #38bdf8, #60a5fa); }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 700; letter-spacing: -.03em; }
.stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Panel / Card ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-header h3 { font-size: .95rem; font-weight: 600; }
.panel-body { padding: 0; }
.panel-body.padded { padding: 22px; }

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--input-placeholder); }
.form-select { cursor: pointer; }
.form-select option { background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { padding: 7px 14px; font-size: .8rem; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 12px 18px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
th.sortable:hover { color: var(--text); }
th.sort-active { color: var(--accent-2); }
th .sort-arrow { opacity: .7; font-size: .65rem; margin-left: 2px; }
tbody td {
  padding: 13px 18px;
  font-size: .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.02); }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: .8rem; }
.td-muted { color: var(--text-muted); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-success { background: rgba(34,197,94,.15); color: #4ade80; }
.badge-success .badge-dot { background: #4ade80; }
.badge-warning { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-warning .badge-dot { background: #fbbf24; }
.badge-danger { background: rgba(239,68,68,.15); color: #f87171; }
.badge-danger .badge-dot { background: #f87171; }
.badge-info { background: rgba(56,189,248,.15); color: #38bdf8; }
.badge-info .badge-dot { background: #38bdf8; }

/* ── Filters ── */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.search-input {
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .85rem;
  outline: none;
  min-width: 200px;
}
.search-input:focus { border-color: var(--accent); }

/* ── Channel pills ── */
.channel-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.channel-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
}
.channel-pill:hover { border-color: var(--accent); color: var(--text); }
.channel-pill.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-2);
}

/* ── Empty / Loading ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 12px; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.boot-screen p {
  color: var(--text-muted);
  font-size: .88rem;
}

.boot-screen .spinner { margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 360px;
}
.toast-success { background: #14532d; color: #bbf7d0; border: 1px solid rgba(34,197,94,.3); }
.toast-error { background: #450a0a; color: #fecaca; border: 1px solid rgba(239,68,68,.3); }
.toast-info { background: #1e1b4b; color: #c7d2fe; border: 1px solid rgba(99,102,241,.3); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Give Free form ── */
.give-free-form {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.give-free-form .form-group { margin-bottom: 0; flex: 1; min-width: 240px; }

/* ── Chart bars (daily log) ── */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 16px 0; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bar {
  width: 100%; max-width: 48px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  transition: height .4s ease;
  min-height: 4px;
}
.chart-bar.timeout { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.chart-label { font-size: .65rem; color: var(--text-muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chart-value { font-size: .72rem; font-weight: 600; }

/* Daily bar chart — full width, date top / amount bottom */
.daily-bar-chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-height: 240px;
  padding: 4px 0 0;
}

.daily-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.daily-bar-date-top {
  text-align: center;
  margin-bottom: 10px;
  min-height: 38px;
}

.daily-bar-pair {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  flex: 1;
  width: 100%;
  max-width: 72px;
}

.daily-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 100%;
}

.daily-bar-track {
  width: 100%;
  flex: 1;
  min-height: 120px;
  max-height: 160px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px 8px 4px 4px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.daily-bar-fill {
  width: 100%;
  border-radius: 6px 6px 2px 2px;
  transition: height .35s ease;
  min-height: 0;
}

.daily-bar-item.success .daily-bar-fill {
  background: linear-gradient(180deg, #4ade80, #16a34a);
}

.daily-bar-item.timeout .daily-bar-fill {
  background: linear-gradient(180deg, #fbbf24, #d97706);
}

.daily-bar-num {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 8px;
  min-height: 1.3em;
}

.daily-bar-item.success .daily-bar-num { color: #22c55e; }
.daily-bar-item.timeout .daily-bar-num { color: #f59e0b; }

.daily-bar-date {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.daily-bar-weekday {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 900px) {
  .daily-bar-num { font-size: 1rem; }
  .daily-bar-date { font-size: .72rem; }
  .daily-bar-track { min-height: 100px; }
}

@media (max-width: 600px) {
  .daily-bar-chart { gap: 3px; }
  .daily-bar-num { font-size: .9rem; }
  .daily-bar-weekday { display: none; }
}

/* legacy daily rows — kept for reference */
.daily-chart { display: flex; flex-direction: column; gap: 14px; }
.daily-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
}
.daily-date { font-size: .82rem; font-weight: 600; color: var(--text); }
.daily-date span { display: block; font-size: .7rem; font-weight: 400; color: var(--text-muted); }
.daily-track {
  height: 28px;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}
.daily-seg { height: 100%; transition: width .3s ease; min-width: 2px; }
.daily-seg.success { background: linear-gradient(90deg, #16a34a, #22c55e); }
.daily-seg.timeout { background: linear-gradient(90deg, #d97706, #f59e0b); }
.daily-seg.other { background: var(--surface-3); }
.daily-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: .75rem; min-width: 200px; justify-content: flex-end;
}
.daily-stat { white-space: nowrap; }
.daily-stat strong { font-weight: 700; }
.daily-stat.ok { color: #22c55e; }
.daily-stat.warn { color: #f59e0b; }
.daily-stat.total { color: var(--text); }
.daily-legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding-top: 8px; font-size: .78rem; color: var(--text-muted);
}
.daily-legend-item { display: flex; align-items: center; gap: 6px; }
.daily-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}
.settings-grid .form-group { margin-bottom: 0; }
.settings-note {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 10px;
}
.filter-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 12px;
}
.filter-toggle-row .channel-pills { margin-bottom: 0; }

.countries-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--border);
}

.customer-toggle-large {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: all .15s;
}

.customer-toggle-large:hover {
  border-color: var(--accent);
  color: var(--text);
}

.customer-toggle-large.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-2);
}

.customer-toggle-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.customer-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-toggle-text strong {
  font-size: .95rem;
  font-weight: 600;
  color: inherit;
}

.customer-toggle-text small {
  font-size: .75rem;
  opacity: .85;
}

.timeline-chart-wrap { width: 100%; overflow-x: auto; }
.timeline-chart { width: 100%; height: auto; min-height: 280px; display: block; }
.timeline-grid { stroke: var(--border); stroke-width: 1; }
.timeline-axis-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }
.timeline-line { stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.timeline-line.total { stroke: var(--accent-2); }
.timeline-line.success { stroke: #22c55e; stroke-width: 2; opacity: .9; }
.timeline-line.timeout { stroke: #f59e0b; stroke-width: 2; opacity: .9; }
.timeline-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: .78rem;
  color: var(--text-muted);
}
.timeline-legend-item { display: flex; align-items: center; gap: 8px; }
.timeline-legend-line {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.timeline-legend-line.total { background: var(--accent-2); }
.timeline-legend-line.success { background: #22c55e; }
.timeline-legend-line.timeout { background: #f59e0b; }
.timeline-meta { margin-left: auto; font-size: .72rem; opacity: .85; }

@media (max-width: 768px) {
  .timeline-meta { margin-left: 0; width: 100%; }
}

/* ── Responsive ── */
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }

.data-source-note {
  font-size: .78rem;
  color: var(--text-muted);
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.data-source-note code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .75rem;
}

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.pagination-info { font-size: .82rem; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 6px; }

.os-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: .72rem; font-weight: 600;
}
.os-ios { background: rgba(99,102,241,.12); color: var(--accent-2); }
.os-and { background: rgba(34,197,94,.12); color: var(--success); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 16px; flex-wrap: wrap; gap: 12px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
  .topbar-balances { justify-content: flex-end; }
  .overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
  .overlay.show { display: block; }
}
