:root {
  --bg: #f4f6f5; --card: #fff; --text: #1d2321; --muted: #66706c; --line: #e2e7e5;
  --brand: #0e7c66; --brand-2: #0a5c4c; --red: #b3261e; --amber: #a86400; --blue: #1f5fbf;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111615; --card: #1a2120; --text: #e8eeec; --muted: #9aa6a2; --line: #2b3533;
          --brand: #2fb394; --brand-2: #1f8b72; --red: #f2726a; --amber: #e3a23b; --blue: #6ea0ef; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* CSS display rules must not override the hidden attribute */
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Nastaliq Urdu", sans-serif;
       background: var(--bg); color: var(--text); }
header { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center;
         padding: 10px 16px; background: var(--brand-2); color: #fff; }
header #who { margin-left: auto; opacity: .85; font-size: 13px; }
nav { display: flex; gap: 4px; padding: 8px 16px; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); }
nav a { padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; white-space: nowrap; }
nav a.on { background: var(--brand); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 16px; } h2 { font-size: 17px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 22px; } .stat span { color: var(--muted); font-size: 13px; }
.stat.red b { color: var(--red); } .stat.green b { color: var(--brand); } .stat.amber b { color: var(--amber); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
tr.click { cursor: pointer; } tr.click:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.table-wrap { overflow-x: auto; }
form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
label { display: block; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 10px; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; }
button { padding: 10px 16px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font: inherit; cursor: pointer; }
button.red { background: var(--red); } button.gray { background: var(--muted); } button.blue { background: var(--blue); }
button.ghost { background: transparent; border: 1px solid rgba(255,255,255,.5); padding: 6px 12px; }
button.icon { background: transparent; font-size: 20px; padding: 0 6px; display: none; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--line); }
.pill.red { background: var(--red); color: #fff; } .pill.green { background: var(--brand); color: #fff; } .pill.amber { background: var(--amber); color: #fff; }
.muted { color: var(--muted); font-size: 13px; }
.code { font: 700 32px/1.2 ui-monospace, monospace; letter-spacing: 4px; color: var(--brand); }
#qr { background: #fff; padding: 12px; display: inline-block; border-radius: 8px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; color: #fff;
         padding: 10px 18px; border-radius: 8px; z-index: 10; max-width: 90vw; }
.login { max-width: 380px; margin: 10vh auto; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; } .toolbar input, .toolbar select { width: auto; flex: 1; min-width: 140px; margin: 0; }
@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .hide-sm { display: none; }
}
