/* NISM Learning Platform — mobile-first design system (no build step) */
:root {
  --primary: #4f46e5; --primary-2: #7c3aed; --primary-soft: #eef0ff; --on-primary: #fff;
  --teal: #0d9488; --teal-soft: #ccfbf1; --orange: #ea580c; --orange-soft: #ffedd5;
  --pink: #db2777; --pink-soft: #fce7f3; --green: #16a34a; --green-soft: #dcfce7;
  --red: #dc2626; --red-soft: #fee2e2; --amber: #b45309; --amber-soft: #fef3c7; --blue: #2563eb; --blue-soft: #dbeafe;
  --bg: #f4f6fd; --surface: #ffffff; --surface-2: #f8f9fe; --text: #0f172a; --muted: #5b6475; --border: #e3e7f2;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 20px rgba(15,23,42,.06);
  --radius: 18px; --radius-sm: 12px; --tap: 48px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", Ubuntu, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #8b8cff; --primary-2: #b18cff; --primary-soft: #23264a; --on-primary: #0b0d1c;
    --teal: #2dd4bf; --teal-soft: #0f302d; --orange: #fb923c; --orange-soft: #3a2413; --pink: #f472b6; --pink-soft: #3b1730;
    --green: #4ade80; --green-soft: #12301d; --red: #f87171; --red-soft: #3a1717; --amber: #fbbf24; --amber-soft: #352a0f; --blue: #60a5fa; --blue-soft: #132a4a;
    --bg: #0b0e1a; --surface: #141829; --surface-2: #1a1f34; --text: #e8ebf7; --muted: #a2a9c0; --border: #262c45;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #8b8cff; --primary-2: #b18cff; --primary-soft: #23264a; --on-primary: #0b0d1c;
  --teal: #2dd4bf; --teal-soft: #0f302d; --orange: #fb923c; --orange-soft: #3a2413; --pink: #f472b6; --pink-soft: #3b1730;
  --green: #4ade80; --green-soft: #12301d; --red: #f87171; --red-soft: #3a1717; --amber: #fbbf24; --amber-soft: #352a0f; --blue: #60a5fa; --blue-soft: #132a4a;
  --bg: #0b0e1a; --surface: #141829; --surface-2: #1a1f34; --text: #e8ebf7; --muted: #a2a9c0; --border: #262c45;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 18px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, video, iframe { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
pre { white-space: pre-wrap; word-break: break-word; }

/* ---------- layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 16px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-4 { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- top bar ---------- */
.appbar { position: sticky; top: 0; z-index: 30; background: linear-gradient(120deg, var(--primary), var(--primary-2)); color: var(--on-primary); box-shadow: 0 2px 12px rgba(79,70,229,.25); }
.appbar .inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 58px; }
.appbar a, .appbar button { color: inherit; }
.brand { font-weight: 800; font-size: 1.08rem; text-decoration: none; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 14px; border: 0; background: rgba(255,255,255,.14); display: inline-grid; place-items: center; cursor: pointer; position: relative; text-decoration: none; font-size: 1.15rem; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.24); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f97316; color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }

/* ---------- bottom nav ---------- */
.has-bottom-nav { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(15,23,42,.06); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; text-decoration: none; color: var(--muted); font-size: .76rem; font-weight: 600; border-radius: 14px; }
.bottom-nav a svg { width: 25px; height: 25px; }
.bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
@media (min-width: 900px) { .bottom-nav { max-width: 560px; margin: 0 auto 14px; border-radius: 22px; border: 1px solid var(--border); bottom: 0; } }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-tight { padding: 14px; }
.card h2, .card h3 { margin-bottom: .4em; }
.card-link { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.card-link:hover { transform: translateY(-2px); }
.hero { border-radius: 22px; padding: 20px; color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 60%, #db2777 120%); box-shadow: 0 10px 30px rgba(79,70,229,.3); }
.hero h1 { font-size: 1.45rem; margin-bottom: 4px; }
.hero p { opacity: .92; margin: 0; }
.stat { border-radius: var(--radius); padding: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat .v { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat .k { color: var(--muted); font-size: .85rem; font-weight: 600; }
.accent-indigo { border-top: 5px solid var(--primary); } .accent-teal { border-top: 5px solid var(--teal); } .accent-orange { border-top: 5px solid var(--orange); }
.accent-pink { border-top: 5px solid var(--pink); } .accent-green { border-top: 5px solid var(--green); } .accent-blue { border-top: 5px solid var(--blue); } .accent-purple { border-top: 5px solid var(--primary-2); }
.tile-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.t-indigo { background: var(--primary-soft); color: var(--primary); } .t-teal { background: var(--teal-soft); color: var(--teal); } .t-orange { background: var(--orange-soft); color: var(--orange); }
.t-pink { background: var(--pink-soft); color: var(--pink); } .t-green { background: var(--green-soft); color: var(--green); } .t-blue { background: var(--blue-soft); color: var(--blue); } .t-purple { background: var(--primary-soft); color: var(--primary-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border-radius: 14px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none; line-height: 1.2; background: var(--primary); color: var(--on-primary); transition: filter .12s, transform .06s; -webkit-tap-highlight-color: transparent; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.08rem; padding: 12px 22px; border-radius: 16px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn-ghost { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-green { background: var(--green); color: #fff; } .btn-red { background: var(--red); color: #fff; } .btn-orange { background: var(--orange); color: #fff; } .btn-teal { background: var(--teal); color: #fff; }
.btn-white { background: #fff; color: #3730a3; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }

/* ---------- forms ---------- */
label { display: block; font-weight: 650; margin: 0 0 6px; font-size: .95rem; }
.field { margin-bottom: 14px; }
.hint { font-size: .84rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; min-height: 320px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.req::after { content: " *"; color: var(--red); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- alerts / badges ---------- */
.alert { padding: 12px 16px; border-radius: 14px; margin-bottom: 12px; font-weight: 550; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warn { background: var(--amber-soft); color: var(--amber); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 750; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.b-green { background: var(--green-soft); color: var(--green); border-color: transparent; } .b-red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.b-amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; } .b-blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.b-indigo { background: var(--primary-soft); color: var(--primary); border-color: transparent; } .b-pink { background: var(--pink-soft); color: var(--pink); border-color: transparent; }
.b-teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }

/* ---------- progress ---------- */
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--primary)); border-radius: 99px; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--ring-color, var(--primary)) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring > div { width: 94px; height: 94px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 1.5rem; line-height: 1.1; }

/* ---------- lists / tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 2px; text-decoration: none; color: inherit; min-height: 56px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 16px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 650; font-size: .9rem; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

/* ---------- rich text ---------- */
.prose { font-size: 1.05rem; }
.prose h2 { font-size: 1.25rem; margin-top: 1.2em; } .prose h3 { font-size: 1.1rem; margin-top: 1em; }
.prose ul, .prose ol { padding-left: 1.3em; } .prose li { margin: .3em 0; }
.prose img { border-radius: 14px; }
.video-box { position: relative; padding-top: 56.25%; border-radius: 16px; overflow: hidden; background: #000; }
.video-box iframe, .video-box video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- exam ---------- */
.exam-body { background: var(--bg); }
.exam-top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.exam-top .inner { max-width: 820px; margin: 0 auto; padding: 8px 14px; display: flex; gap: 10px; align-items: center; }
.exam-title { font-weight: 750; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.05rem; padding: 8px 12px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.timer.warn { background: var(--amber-soft); color: var(--amber); } .timer.danger { background: var(--red-soft); color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.save-state { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.save-state.err { color: var(--red); font-weight: 700; }
.exam-progress { height: 5px; background: var(--surface-2); }
.exam-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--primary)); transition: width .2s; }
.exam-main { max-width: 820px; margin: 0 auto; padding: 16px 14px calc(150px + env(safe-area-inset-bottom)); }
.q-no { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 700; font-size: .95rem; margin-bottom: 10px; }
.q-stem { font-size: 1.3rem; line-height: 1.5; font-weight: 600; margin-bottom: 18px; white-space: pre-wrap; word-break: break-word; }
@media (min-width: 720px) { .q-stem { font-size: 1.4rem; } }
.opt { display: flex; width: 100%; gap: 14px; align-items: flex-start; text-align: left; padding: 14px 16px; margin: 0 0 12px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.12rem; cursor: pointer; min-height: 60px; transition: border-color .1s, background .1s; -webkit-tap-highlight-color: transparent; }
.opt:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.opt .letter { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); border: 2px solid var(--border); font-size: 1rem; }
.opt .txt { padding-top: 4px; white-space: pre-wrap; word-break: break-word; }
.opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt.selected .letter { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.opt.correct { border-color: var(--green); background: var(--green-soft); } .opt.correct .letter { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); } .opt.wrong .letter { background: var(--red); color: #fff; border-color: var(--red); }
.exam-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(15,23,42,.08); }
.exam-bar .inner { max-width: 820px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.exam-bar .btn { padding: 10px 8px; font-size: .95rem; }
.exam-tools { max-width: 820px; margin: 0 auto 8px; display: flex; gap: 8px; justify-content: space-between; }
.mark-on { background: var(--amber-soft) !important; color: var(--amber) !important; border-color: var(--amber) !important; }
.palette-sheet { position: fixed; inset: 0; z-index: 60; background: rgba(10,12,25,.45); display: flex; align-items: flex-end; justify-content: center; }
.palette-sheet .panel { background: var(--surface); width: 100%; max-width: 820px; max-height: 82vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 8px; }
.palette button { min-height: 50px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font: inherit; font-weight: 800; cursor: pointer; color: var(--text); position: relative; }
.palette .p-ans { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.palette .p-mark { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.palette .p-mark.p-ans::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.palette .p-cur { outline: 3px solid var(--primary); outline-offset: 1px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin: 10px 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; border: 2px solid var(--border); }
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(10,12,25,.5); display: grid; place-items: center; padding: 16px; }
.modal .panel { background: var(--surface); border-radius: 22px; padding: 22px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.offline-banner { background: var(--amber-soft); color: var(--amber); text-align: center; font-weight: 700; font-size: .9rem; padding: 6px; }
.explain { border-radius: 14px; padding: 12px 14px; background: var(--blue-soft); margin-top: 8px; }
.explain.ex { background: var(--teal-soft); }
.explain b { display: block; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.q-review { border-left: 5px solid var(--border); }
.q-review.r-correct { border-left-color: var(--green); } .q-review.r-wrong { border-left-color: var(--red); } .q-review.r-skip { border-left-color: var(--amber); }

/* ---------- admin ---------- */
.admin-nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 58px; z-index: 25; }
.admin-nav .inner { max-width: 1280px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 6px 12px; scrollbar-width: thin; }
.admin-nav a { flex: none; padding: 9px 13px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 650; font-size: .92rem; white-space: nowrap; }
.admin-nav a.active { background: var(--primary-soft); color: var(--primary); }
.admin-wrap { max-width: 1280px; margin: 0 auto; padding: 16px; }
.admin-wrap .appbar .inner { max-width: 1280px; }
.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 6px 12px; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; word-break: break-word; }
.copy-box { display: flex; gap: 8px; } .copy-box input { font-family: ui-monospace, monospace; font-size: .85rem; }
.import-q { border-left: 5px solid var(--green); }
.import-q.c-medium { border-left-color: var(--amber); } .import-q.c-low { border-left-color: var(--red); } .import-q.excluded { opacity: .55; }
.import-q textarea { min-height: 60px; }
.opt-row { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: start; margin-bottom: 6px; }
.opt-row .radio { min-height: 48px; display: grid; place-items: center; border: 1.5px solid var(--border); border-radius: 12px; font-weight: 800; cursor: pointer; }
.opt-row input[type=radio] { position: absolute; opacity: 0; }
.opt-row input[type=radio]:checked + .radio { background: var(--green); color: #fff; border-color: var(--green); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); z-index: 20; }
.tree-module { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-top: 8px; background: var(--surface-2); }

/* ---------- auth / landing ---------- */
.auth-hero { background: linear-gradient(140deg, var(--primary) 0%, var(--primary-2) 55%, #db2777 110%); color: #fff; padding: 34px 16px 80px; text-align: center; }
.auth-hero h1 { font-size: 1.7rem; margin: 10px 0 6px; }
.auth-hero p { opacity: .92; margin: 0 auto; max-width: 520px; }
.auth-card { max-width: 520px; margin: -56px auto 0; position: relative; }
.big-logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 2rem; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.disclaimer { font-size: .8rem; color: var(--muted); text-align: center; padding: 18px 16px; max-width: 760px; margin: 0 auto; }

/* ---------- print (certificate / agreement / receipt) ---------- */
.print-toolbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.sheet { background: #fff; color: #111; width: 100%; max-width: 210mm; margin: 16px auto; padding: 18mm 16mm; box-shadow: var(--shadow); font-size: 11.5pt; line-height: 1.5; }
.sheet h1 { font-size: 18pt; } .sheet h2 { font-size: 13pt; margin-top: 14px; }
.sheet table th { background: #f3f4f6; color: #333; }
.cert { background: #fffdf7; color: #1d1d2b; width: 100%; max-width: 297mm; margin: 16px auto; aspect-ratio: 297/210; position: relative; padding: 4%; box-shadow: var(--shadow); font-family: Georgia, "Times New Roman", serif; }
.cert-border { position: absolute; inset: 2.2%; border: 3px solid #b8892f; outline: 1px solid #b8892f; outline-offset: 5px; pointer-events: none; }
.cert-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between; padding: 2% 5%; }
.cert .org { font-family: var(--font); letter-spacing: .18em; text-transform: uppercase; font-size: clamp(9px, 1.5vw, 14px); color: #4338ca; font-weight: 800; }
.cert h1 { font-size: clamp(18px, 3.6vw, 38px); margin: .2em 0; color: #1e1b4b; font-weight: 700; }
.cert .name { font-size: clamp(20px, 4.2vw, 44px); font-style: italic; color: #7c2d12; border-bottom: 1px solid #c9a55a; padding: 0 1em .1em; margin: .2em 0; }
.cert p { margin: .2em 0; font-size: clamp(10px, 1.6vw, 16px); }
.cert .meta { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; font-family: var(--font); font-size: clamp(8px, 1.15vw, 12px); gap: 10px; text-align: left; }
.cert .sig { border-top: 1px solid #333; padding-top: 4px; min-width: 26%; text-align: center; }
.cert .qr svg, .cert .qr img { width: clamp(56px, 10vw, 110px); height: auto; display: block; }
.cert .note { font-family: var(--font); font-size: clamp(7px, 1vw, 10.5px); color: #555; }
.void-stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%) rotate(-18deg); font-size: clamp(30px, 8vw, 90px); color: rgba(220,38,38,.35); border: 6px solid rgba(220,38,38,.35); padding: 0 20px; font-weight: 900; font-family: var(--font); }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .print-toolbar, .no-print { display: none !important; }
  .sheet { box-shadow: none; margin: 0; max-width: none; }
  .cert { box-shadow: none; margin: 0; max-width: none; width: 297mm; height: 210mm; }
  .landscape-page { size: A4 landscape; }
}
@media (max-width: 480px) { .wrap, .admin-wrap { padding: 12px; } .card { padding: 14px; } h1 { font-size: 1.4rem; } .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
@media (max-width: 720px) { .hide-sm { display: none; } }
.icon-btn svg { width: 22px; height: 22px; }
.grid-3.tight3 { grid-template-columns: repeat(3, 1fr); gap: 8px; } .tight3 .stat { padding: 10px 6px; } .tight3 .v { font-size: 1.35rem; }
@media (max-width: 720px) { .sticky-actions { position: static; } }
