:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --text: #17201b;
  --muted: #5f6d65;
  --line: #e1e7e3;
  --brand: #0b7a4b;
  --brand-ink: #ffffff;
  --brand-soft: #e4f3eb;
  --warn: #a15c07;
  --warn-soft: #fdf1d8;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --code: #f0f3f1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1311;
    --panel: #161d1a;
    --text: #e6ede9;
    --muted: #97a79e;
    --line: #26312c;
    --brand: #34b278;
    --brand-ink: #06140d;
    --brand-soft: #16301f;
    --warn: #f0b354;
    --warn-soft: #3a2c12;
    --danger: #f2877c;
    --danger-soft: #3b1714;
    --code: #1d2622;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Noto Sans Bengali", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.hidden { display: none !important; }
a { color: var(--brand); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
pre { background: var(--code); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; }

.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 17px; padding: 0 8px; }
.brand span { display: block; font-size: 11px; color: var(--muted); }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
nav a { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
nav a small { color: var(--muted); font-size: 11px; width: 100%; margin-top: -3px; }
nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; margin-left: auto; }
.me { font-size: 12px; color: var(--muted); padding: 0 8px; display: flex; justify-content: space-between; gap: 8px; }

.view { padding: 28px 32px; max-width: 1150px; width: 100%; }
h1 { font-size: 22px; margin: 0 0 4px; }
h1 + .sub { color: var(--muted); margin: 0 0 20px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 180px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit;
}
textarea { min-height: 80px; font-family: ui-monospace, monospace; font-size: 12.5px; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; color: var(--brand); }
button:disabled { opacity: 0.6; cursor: default; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--code); color: var(--muted); }
.pill.paid, .pill.matched, .pill.succeeded, .pill.online { background: var(--brand-soft); color: var(--brand); }
.pill.pending, .pill.unmatched { background: var(--warn-soft); color: var(--warn); }
.pill.failed, .pill.offline, .pill.expired, .pill.cancelled { background: var(--danger-soft); color: var(--danger); }
.pill.test { background: var(--warn-soft); color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.callout { border-radius: 10px; padding: 10px 12px; background: var(--brand-soft); margin: 10px 0; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.secret { background: var(--warn-soft); border-radius: 10px; padding: 12px; margin: 10px 0; }
.qr-preview { width: 220px; height: 220px; background: #fff; border-radius: 10px; border: 1px solid var(--line); padding: 6px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button.active { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 600; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth .panel { width: 100%; max-width: 380px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { flex-direction: row; overflow-x: auto; }
  nav a { flex: 0 0 auto; }
  nav a small { display: none; }
  .view { padding: 18px 16px; }
  .kv { grid-template-columns: 1fr; }
}
