/* EduBoard Cloud — console interface
   Palette: indigo #3730A3 · mist #F1F2F8 · ink #171630 · amber #B45309 ·
   coral #BE3455 · lilac #C7C4F5 · paper #FFFFFF
   Type: Sora (display) · Inter (body) · IBM Plex Mono (data) */

:root {
  --indigo: #3730a3;
  --indigo-deep: #262183;
  --indigo-soft: #e8e6fa;
  --mist: #f1f2f8;
  --ink: #171630;
  --muted: #63647f;
  --line: #dcdcea;
  --paper: #ffffff;
  --amber: #b45309;
  --amber-bg: #fdf4e3;
  --coral: #be3455;
  --coral-bg: #fceaee;
  --ok: #15803d;
  --ok-bg: #e4f5e9;
  --lilac: #c7c4f5;
  --violet-bg: #f0e7fb;
  --violet: #7c3aed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23, 22, 48, 0.06), 0 4px 16px rgba(23, 22, 48, 0.05);
  --display: "Sora", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--body); background: var(--mist); color: var(--ink); font-size: 14.5px; line-height: 1.55; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; }
button { font-family: var(--body); }
a { color: var(--indigo); }
:focus-visible { outline: 2.5px solid var(--indigo); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- App frame ---------- */
.frame { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(178deg, var(--indigo-deep), #2c2691 60%, #3730a3);
  color: #e9e8f7; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--lilac); color: var(--indigo-deep); display: grid; place-items: center; font-size: 18px; }
.brand b { font-family: var(--display); font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 10.5px; color: #a7a3dd; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: #938eda; padding: 14px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 12px; border-radius: 9px;
  color: #d9d7f2; text-decoration: none; font-weight: 500; font-size: 13.5px; transition: background 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav a.active { background: var(--lilac); color: var(--indigo-deep); font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; opacity: 0.9; }
.nav a .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: rgba(255,255,255,0.14); padding: 1px 7px; border-radius: 99px; }
.nav a.active .count { background: rgba(38, 33, 131, 0.15); }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12px; color: #a7a3dd; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,0.25); color: #d9d7f2; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; margin-top: 8px; }
.side-foot button:hover { background: rgba(255,255,255,0.1); }

.main { padding: 28px 34px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

/* ---------- Cards, tables ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }

.tbl-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; margin-bottom: 16px; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 13px 16px; border-bottom: 1px solid var(--line); background: #f8f8fc; font-weight: 600; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid #eeeef6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8f8fc; }
.tbl .empty td { text-align: center; color: var(--muted); padding: 40px; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.dim { color: var(--muted); font-size: 12.5px; }

/* ---------- Status pills ---------- */
.due-pill {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; padding: 3px 9px;
  border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.due-pill::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: currentColor; }
.due-ok { background: var(--ok-bg); color: var(--ok); }
.due-soon { background: var(--amber-bg); color: var(--amber); }
.due-over { background: var(--coral-bg); color: var(--coral); }
.due-done { background: var(--indigo-soft); color: var(--indigo); }

/* ---------- Stat row ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .v { font-family: var(--display); font-size: 27px; font-weight: 800; line-height: 1.15; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.stat.warn .v { color: var(--amber); }
.stat.bad .v { color: var(--coral); }
.stat.good .v { color: var(--indigo); }

/* ---------- Badges, buttons, forms ---------- */
.badge { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 99px; display: inline-block; }
.b-green { background: var(--ok-bg); color: var(--ok); }
.b-red { background: var(--coral-bg); color: var(--coral); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-blue { background: var(--indigo-soft); color: var(--indigo); }
.b-violet { background: var(--violet-bg); color: var(--violet); }
.b-gray { background: #eef0f5; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; padding: 8px 15px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  text-decoration: none; transition: filter 0.15s, background 0.15s; line-height: 1.4;
  min-height: 38px; box-sizing: border-box;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { filter: brightness(1.14); }
.btn-ghost { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f4f4fa; }
.btn-danger { background: var(--paper); border-color: #f0bfcb; color: var(--coral); }
.btn-danger:hover { background: var(--coral-bg); }
/* Standard height for every card action button (ecard-row, activity rows,
   subscription cards, etc.) — fixed rather than left to grow/shrink with
   padding + font-size alone, so every "View Tests" / "Subscribe" /
   "Practice again" button lines up at the same height across every card,
   whatever its label length. */
.btn-sm { padding: 4.5px 10px; font-size: 12px; border-radius: 7px; min-height: 32px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: #3a3959; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-family: var(--body); font-size: 14px; background: #fcfcfe; color: var(--ink);
}
.input:focus { border-color: var(--indigo); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(55, 48, 163, 0.12); }
textarea.input { resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
/* Checkbox + label rows used throughout (exam editor's 5th-option toggle,
   ranking system's tie-breakers, account/notification switches, …). Built to
   stay crisp whether the label is one short word or wraps to two lines:
   items sit at flex-start (not center) so a wrapped label's SECOND line
   doesn't drag the box into visually centering the checkbox between the
   lines, and the checkbox gets a small optical nudge down (--switch-nudge)
   so it lines up with the cap-height of the first line instead of its own
   top edge. */
.switch { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13.5px; font-weight: 500; line-height: 1.45; padding: 3px 4px; margin: -3px -4px; border-radius: 7px; transition: background .12s ease; }
.switch:hover { background: rgba(79, 70, 229, .06); }
.switch input { accent-color: var(--indigo); width: 17px; height: 17px; margin: 0; flex: 0 0 auto; --switch-nudge: 2px; transform: translateY(var(--switch-nudge)); }
.switch span { padding-top: 1px; }
/* .field label {display:block} (below) outranks the bare .switch selector
   on specificity whenever a switch sits inside a .field wrapper (the 5th-
   option toggle, ranking-system tie-breakers, …), silently collapsing it
   back to a block box and killing the flex alignment/gap. This re-asserts
   it at matching specificity so the switch always wins regardless of where
   it's nested. */
.field label.switch { display: inline-flex; margin-bottom: 0; font-weight: 500; color: inherit; }

/* ---------- Search bar / tabs / pagination ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .input { max-width: 320px; }
.tabs { display: flex; gap: 4px; background: #e6e6f2; padding: 4px; border-radius: 11px; width: max-content; margin-bottom: 16px; }
.tabs button { border: none; background: none; padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--paper); color: var(--indigo); box-shadow: var(--shadow); }
.pager { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(18, 16, 46, 0.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--paper); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 24px; animation: pop 0.18s ease; }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h3 { margin: 0 0 18px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal.wide { max-width: 780px; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--indigo-deep); color: #eeedfa; padding: 11px 18px; border-radius: 11px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-size: 13.5px; animation: pop 0.2s ease; max-width: 380px; }
.toast.err { background: #7a1f36; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background:
  radial-gradient(1000px 500px at 85% -10%, #dedcf6 0%, transparent 60%), var(--mist); padding: 20px; }
.login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 38px 36px; width: 100%; max-width: 400px; }
.login-card h1 { font-size: 24px; margin: 14px 0 4px; text-align: center; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; text-align: center; }
.login-mark { width: 46px; height: 46px; border-radius: 13px; background: var(--indigo); color: var(--lilac); display: grid; place-items: center; font-size: 23px; margin: 0 auto; font-family: var(--display); font-weight: 800; }
.login-logo { width: 72px; height: 72px; border-radius: 16px; object-fit: contain; background: #fff; padding: 4px; margin: 0 auto 4px; display: block; box-shadow: 0 3px 10px rgba(55,48,163,0.12); }

/* ---------- QR grid ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.qr-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.qr-card img { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.qr-card .lnk { font-family: var(--mono); font-size: 11px; background: #f4f4fa; border: 1px solid var(--line); border-radius: 8px; padding: 8px; word-break: break-all; margin-top: 10px; }

/* ---------- Usage meters ---------- */
.meter { height: 8px; background: #e6e6f2; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter > div { height: 100%; background: var(--indigo); border-radius: 99px; }
.meter > div.warn { background: var(--amber); }
.meter > div.bad { background: var(--coral); }

/* ---------- Delivery analytics metrics ---------- */
.metric-row { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 24px; }
.metric { flex: 1; min-width: 140px; text-align: center; padding: 18px; border-radius: 12px; border: 1px solid; }
.metric span { display: block; font-size: 11.5px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.05em; }
.metric b { font-family: var(--display); font-size: 30px; font-weight: 800; display: block; margin-top: 4px; }
.m-green { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.m-blue { background: #eef0fd; border-color: #c5c2f2; color: #312a92; }
.m-red { background: #fef2f4; border-color: #fbcdd7; color: #9f1239; }
.breakdown-h { margin: 0 0 14px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.05em; font-weight: 600; }
.chan { flex: 1; min-width: 140px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8f8fc; }
.chan span { font-size: 14px; font-weight: 500; color: #4b4c6b; }
.chan b { font-family: var(--display); font-size: 22px; display: block; margin-top: 4px; color: var(--ink); }

/* ---------- login / register alternate link ---------- */
.login-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.login-alt a { color: var(--indigo); font-weight: 600; text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

/* ---------- subscription: pricing table + payment ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-bottom: 22px; }
.plan-card { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); position: relative; }
.plan-card.current { border-color: var(--indigo); box-shadow: 0 6px 20px rgba(55,48,163,0.12); }
.plan-name { font-family: var(--display); font-size: 19px; font-weight: 800; }
.plan-price { font-family: var(--display); font-size: 34px; font-weight: 800; color: var(--indigo); line-height: 1; }
.plan-price span { font-family: var(--body); font-size: 14px; font-weight: 500; color: var(--muted); }
.plan-feats { list-style: none; padding: 0; margin: 4px 0 auto; display: flex; flex-direction: column; gap: 7px; }
.plan-feats li { font-size: 14px; color: var(--ink); padding-left: 22px; position: relative; }
.plan-feats li::before { content: "✓"; position: absolute; left: 0; color: var(--indigo); font-weight: 700; }
.plan-save { position: absolute; top: 14px; right: 14px; background: #16a34a; color: #fff; font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.02em; box-shadow: 0 2px 6px rgba(22,163,74,0.35); }
.plan-was { font-size: 12.5px; color: var(--muted); margin: -6px 0 0; }
.plan-was span { opacity: 0.8; }
.pay-amount { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--indigo); margin-bottom: 14px; }
.pay-amount span { font-family: var(--body); font-size: 14px; font-weight: 500; color: var(--muted); }
.pay-steps p { margin: 12px 0; }
.pay-upi { display: flex; gap: 18px; align-items: center; background: #f8f8fc; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 8px 0; flex-wrap: wrap; }
.pay-qr { width: 170px; height: 170px; background: #fff; border-radius: 8px; padding: 6px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; box-sizing: border-box; flex: 0 0 auto; }
.pay-qr img { width: 100%; height: 100%; object-fit: contain; }
.pay-qr svg { width: 100%; height: 100%; display: block; }
.pay-qr-empty { width: 170px; height: 170px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; background: #f9fafb; border: 1px dashed var(--line); border-radius: 8px; box-sizing: border-box; padding: 8px; }
.pay-upi-info { flex: 1 1 200px; min-width: 0; }
.pay-upi-id-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.pay-upi-id-row .mono { overflow-wrap: anywhere; word-break: break-word; }
.icon-copy-btn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.icon-copy-btn:hover { background: var(--indigo-bg, #eef0fd); color: var(--indigo); border-color: var(--indigo); }
.icon-copy-btn:active { transform: scale(0.94); }
.icon-copy-btn.copied { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.icon-copy-btn svg { display: block; }
.pay-save-note { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.pay-queue-note { background: #eef0fd; border: 1px solid #c5c2f2; color: #312a92; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; }

/* ---------- branded sidebar logo + powered-by ---------- */
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0; }
.brand.brand-stacked { flex-direction: column; text-align: center; gap: 8px; padding: 6px 10px 20px; }
.brand.brand-stacked .brand-logo { width: 60px; height: 60px; border-radius: 14px; padding: 4px; box-shadow: 0 3px 10px rgba(0,0,0,0.18); }
.brand.brand-stacked > div { width: 100%; }
.brand.brand-stacked b { display: block; }
.brand.brand-stacked small { margin-top: 2px; }
.side-powered { margin-top: 10px; font-size: 10.5px; color: #9691d6; letter-spacing: 0.04em; }

/* ---------- coaching header banner on the manager dashboard ---------- */
.coaching-header { display: flex; align-items: center; gap: 16px; background: linear-gradient(120deg, var(--indigo) 0%, var(--indigo-deep) 100%); color: #fff; border-radius: 16px; padding: 20px 24px; margin-bottom: 22px; box-shadow: 0 8px 24px rgba(55,48,163,0.18); }
.coaching-header-logo { width: 60px; height: 60px; border-radius: 12px; object-fit: contain; background: #fff; padding: 6px; flex-shrink: 0; }
.coaching-header-mark { display: grid; place-items: center; font-size: 26px; background: rgba(255,255,255,0.15); font-family: var(--display); font-weight: 800; }
.coaching-header-name { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.coaching-header-sub { font-size: 13px; opacity: 0.85; margin-top: 3px; }

/* ---------- password show/hide eye ---------- */
.pw-wrap { position: relative; display: block; }
.pw-wrap .input { width: 100%; padding-right: 42px; }
.pw-eye { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px; border-radius: 6px; opacity: 0.5; transition: opacity 0.15s; }
.pw-eye:hover { opacity: 0.85; background: rgba(0,0,0,0.04); }
.pw-eye.on { opacity: 1; }

/* ---------- rich text editor (email templates) ---------- */
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border: 1.5px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; padding: 7px 8px; background: #f8f8fc; }
.rte-toolbar button { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer; font-family: inherit; line-height: 1; color: var(--ink); }
.rte-toolbar button:hover { background: var(--mist); border-color: var(--indigo); }
.rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.rte-editor { border: 1.5px solid var(--line); border-radius: 0 0 10px 10px; padding: 12px 13px; min-height: 140px; max-height: 320px; overflow-y: auto; background: #fff; font-size: 14px; line-height: 1.6; outline: none; }
.rte-editor:focus { border-color: var(--indigo); }
.rte-editor p { margin: 0 0 10px; }
.rte-editor h3 { font-size: 16px; margin: 0 0 8px; }
.rte-editor ul { margin: 0 0 10px; padding-left: 20px; }
.rte-editor a { color: var(--indigo); }

/* Variable chips */
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.var-chip { background: var(--mist); border: 1px solid var(--line); color: var(--indigo-deep); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-family: var(--mono); cursor: pointer; }
.var-chip:hover { background: var(--lilac); border-color: var(--indigo); }

/* ---------- multi-source (topic) rows in the exam builder ---------- */
.src-row { display: grid; grid-template-columns: 1fr 190px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.src-row .btn { padding: 8px 11px; }
@media (max-width: 640px) { .src-row { grid-template-columns: 1fr; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-100%); transition: transform 0.2s; z-index: 60; height: 100dvh; box-shadow: 8px 0 30px rgba(0,0,0,0.18); }
  .sidebar.open { transform: none; }
  .main { padding: 16px 14px 60px; }
  .menu-btn { display: inline-flex !important; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* Phone-optimised layout */
@media (max-width: 640px) {
  .main { padding: 14px 12px 56px; }
  .card { max-width: 100%; overflow-wrap: anywhere; }
  .card code { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
  .field, .grid2, .grid3 { min-width: 0; }
  .input, .input.mono, textarea.input, select.input { max-width: 100%; width: 100%; box-sizing: border-box; }
  .pw-wrap { max-width: 100%; }
  .pw-wrap .input { min-width: 0; }
  .mono, .dim.mono, .card .mono { overflow-wrap: anywhere; word-break: break-word; }
  ol, ul { padding-left: 18px; }
  ol li, ul li { overflow-wrap: anywhere; }
  #qrPreview svg, #qrPreview img, .pay-qr, .pay-qr svg, .pay-qr img { max-width: 100%; height: auto; }
  .pay-upi { width: 100%; box-sizing: border-box; flex-direction: column; align-items: center; text-align: center; padding: 18px 14px; }
  .pay-upi > div { min-width: 0; max-width: 100%; }
  .pay-qr { width: 150px; height: 150px; }
  .pay-qr-empty { width: 150px; height: 150px; }
  .pay-upi-info { width: 100%; text-align: left; }
  .pay-upi-id-row { justify-content: flex-start; }
  details { max-width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 14px; border-radius: 14px; }
  .stat .v { font-size: 22px; }
  .stat .l { font-size: 11px; }
  .page-head { align-items: stretch; gap: 12px; margin-bottom: 18px; }
  .page-head h1 { font-size: 21px; }
  .page-head > .btn, .page-head button.btn { width: 100%; justify-content: center; }
  .page-head > div:first-child { width: 100%; }
  .card { padding: 18px 16px; border-radius: 14px; }
  .card h3 { font-size: 16px; }
  .tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; flex: 0 0 auto; }
  .toolbar { gap: 8px; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 auto; justify-content: center; }
  .tbl td .row { flex-wrap: wrap; gap: 6px; }
  .tbl .btn-sm { padding: 7px 12px; font-size: 12.5px; }

  /* ---- List → stacked card view on mobile ---- */
  .tbl-wrap { overflow-x: visible; border: none; box-shadow: none; background: transparent; }
  table.tbl { min-width: 0; width: 100%; display: block; }
  .tbl thead { display: none; }
  .tbl tbody { display: block; }
  .tbl tbody tr { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px 14px; margin-bottom: 12px; }
  .tbl tbody tr:hover { background: var(--paper); }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid #f0f0f7; text-align: right; min-width: 0; overflow-wrap: anywhere; }
  .tbl tbody tr td:last-child { border-bottom: none; }
  .tbl td::before { content: attr(data-label); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; text-align: left; flex: 0 0 38%; }
  .tbl td > * { min-width: 0; }
  .tbl td .row { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .tbl td:last-child { flex-wrap: wrap; }
  .tbl td[data-fullrow] { display: block; text-align: center; padding: 22px 0; }
  .tbl td[data-fullrow]::before { content: none; }
  .metric-row { gap: 10px; }
  .metric, .chan { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); padding: 14px 12px; }
  .metric b { font-size: 24px; }
  #anaForm { width: 100%; flex-wrap: wrap; }
  #anaForm .input, #anaForm select { flex: 1 1 auto; }
  .modal { width: 100%; max-width: none; border-radius: 16px; padding: 22px 18px; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; justify-content: center; }
  .coaching-header { padding: 16px; gap: 12px; }
  .coaching-header-logo { width: 46px; height: 46px; }
  .coaching-header-name { font-size: 19px; }
  .plans-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .metric, .chan { min-width: 100%; flex-basis: 100%; }
}

.menu-btn { display: none; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; cursor: pointer; margin-bottom: 14px; font-weight: 600; }

@media print { .sidebar, .menu-btn, .page-head button { display: none !important; } .frame { grid-template-columns: 1fr; } }
