/* Classic school-portal look: blue top bar, light grey page, white panels. */
:root {
  --bar: #23558c;
  --bar-dark: #1a446f;
  --bar-text: #ffffff;
  --page: #e8ecf0;
  --panel: #ffffff;
  --panel-alt: #f5f7f9;
  --line: #d3dae1;
  --line-soft: #e6eaee;
  --text: #2b3138;
  --muted: #6b7682;
  --link: #2a6cb3;
  --primary: #2f7bd1;
  --primary-dark: #2465ad;
  --ok: #2e8540;
  --ok-bg: #e8f4ea;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --select: #e3eefa;
  --accent: #23558c;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--text); font: 14px/1.5 var(--font); min-height: 100vh; }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.25; font-weight: 600; text-wrap: balance; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Top bar */
.topbar { background: var(--bar); color: var(--bar-text); display: flex; align-items: center; gap: 16px; padding: 0 max(16px, env(safe-area-inset-left, 0px)); height: 52px; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: #fff; letter-spacing: .2px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; display: block; }
.brand .accent { color: #ffc93c; }
.topbar .who { flex: 1; min-width: 0; font-size: 13.5px; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 1px solid rgba(255, 255, 255, .3); padding-left: 16px; }
.topbar nav { display: flex; gap: 2px; }
.me-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: #fff; font: inherit; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 20px; max-width: 100%; }
.me-btn:hover { background: var(--bar-dark); }
.me-btn .me-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-img { border-radius: 50%; object-fit: cover; display: inline-flex; flex-shrink: 0; background: #fff; vertical-align: middle; }
.avatar-img.initial { align-items: center; justify-content: center; background: #dbe6f3; color: var(--accent); font-weight: 700; }
.topbar .avatar-img { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.profile-pic { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.person { display: flex; gap: 10px; align-items: center; }
.topbar nav a, .topbar .menu-btn { color: #fff; padding: 8px 12px; border-radius: 4px; font-size: 13.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.topbar nav a:hover, .topbar .menu-btn:hover, .topbar nav a.on { background: var(--bar-dark); text-decoration: none; }
@media (max-width: 720px) { .topbar .who { border-left: 0; padding-left: 0; } .me-btn .me-text { display: none; } .brand span.name { display: none; } }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.cols { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.panel > .hd { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--panel-alt); border-radius: 4px 4px 0 0; }
.panel > .hd h2, .panel > .hd h3 { margin: 0; }
.panel > .bd { padding: 14px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* Side navigation */
.sidenav { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.sidenav .me { padding: 14px; border-bottom: 1px solid var(--line); }
.sidenav .me .avatar { width: 44px; height: 44px; margin-bottom: 8px; display: block; }
.sidenav a { display: flex; justify-content: space-between; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--line-soft); font-weight: 600; font-size: 13.5px; }
.sidenav a:hover { background: var(--panel-alt); text-decoration: none; }
.sidenav a.on { background: var(--select); color: var(--accent); box-shadow: inset 3px 0 0 var(--bar); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11.5px; text-align: center; line-height: 18px; }
.badge.grey { background: #9aa5b1; }

/* Forms */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: #3d4650; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #b9c3cd; border-radius: 3px; font: inherit; color: var(--text); background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field { margin-bottom: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 13.5px; margin: 6px 0; color: var(--text); }
.check input { margin-top: 3px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 3px; border: 1px solid #b9c3cd; background: linear-gradient(#fff, #f1f3f5); color: var(--text); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #eef1f4; text-decoration: none; }
.btn.primary { background: linear-gradient(#3a86da, var(--primary)); border-color: var(--primary-dark); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--bad); }
.btn.big { padding: 10px 22px; font-size: 15px; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { text-decoration: underline; }

/* Tables */
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: var(--panel-alt); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.list tr:hover td { background: #fafbfc; }
.tag { display: inline-block; padding: 0 7px; border-radius: 3px; font-size: 11.5px; font-weight: 700; line-height: 19px; background: var(--select); color: var(--accent); text-transform: uppercase; letter-spacing: .2px; white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.grey { background: #eceff2; color: var(--muted); }

/* Messages */
.note { padding: 10px 12px; border-radius: 3px; border: 1px solid; font-size: 13.5px; }
.note.ok { background: var(--ok-bg); border-color: #b9dcc0; color: #1e5f2c; }
.note.bad { background: var(--bad-bg); border-color: #efc0bb; color: #8e2a1f; }
.note.warn { background: var(--warn-bg); border-color: #ecd59e; color: var(--warn); }
.note.info { background: var(--select); border-color: #bcd3ee; color: var(--accent); }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #263240; color: #fff; padding: 10px 18px; border-radius: 4px; font-size: 14px; z-index: 200; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); max-width: calc(100% - 32px); }
#toast.bad { background: var(--bad); }

/* Dialogs */
.overlay { position: fixed; inset: 0; background: rgba(20, 30, 42, .55); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 16px; z-index: 100; overflow-y: auto; }
.dialog { background: #fff; border-radius: 4px; width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialog.wide { max-width: 860px; }
.dialog .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; background: var(--panel-alt); border-radius: 4px 4px 0 0; }
.dialog .hd h2 { margin: 0; font-size: 16px; }
.dialog .bd { padding: 16px; max-height: calc(100vh - 200px); overflow-y: auto; }
.dialog .ft { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }

.code-box { font: 700 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; background: var(--panel-alt); border: 1px dashed #9fb0c2; padding: 8px 14px; border-radius: 4px; display: inline-block; user-select: all; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }

/* Buying credits */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.pack { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); cursor: pointer; }
.pack input { position: absolute; opacity: 0; pointer-events: none; }
.pack b { font-size: 15px; }
.pack span { font-size: 17px; font-weight: 700; color: var(--accent); }
.pack small { color: var(--muted); font-size: 12px; }
.pack:has(input:checked) { border-color: var(--primary); background: var(--select); box-shadow: inset 0 0 0 1px var(--primary); }
.pack:has(input:focus-visible), .method:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.methods { display: flex; flex-wrap: wrap; gap: 8px; }
.method { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); cursor: pointer; font-weight: 600; }
.method:has(input:checked) { border-color: var(--primary); background: var(--select); color: var(--accent); }
.due { margin: 4px 0 10px; font-size: 15px; }
.paydetails { white-space: pre-wrap; margin-bottom: 12px; font-size: 14px; }
.pp-buttons { max-width: 380px; min-height: 48px; margin-bottom: 6px; }
.settings-h { margin: 18px 0 8px; font-size: 15px; color: var(--accent); border-bottom: 1px solid var(--line-soft); padding-bottom: 4px; }
.paymethod { border: 1px solid var(--line-soft); border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-alt); }
.paymethod .field { margin: 8px 0 0; }
.paymethod .note { margin-top: 8px; }
.qrbox { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; margin-bottom: 12px; }
.qrbox img { width: 180px; height: 180px; object-fit: contain; flex: none; border: 1px solid var(--line-soft); border-radius: 4px; background: #fff; }
@media (max-width: 560px) { .qrbox { flex-direction: column; text-align: center; } .qrbox img { width: 220px; height: 220px; } }
.qrrow { display: flex; gap: 12px; align-items: flex-start; }
.qrthumb { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; flex: none; }
.qrthumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.snaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.snap { display: block; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; color: var(--text); background: var(--panel-alt); }
.snap img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #000; }
.snap span { display: block; padding: 6px 8px; font-size: 12px; }
table.notstarted td { vertical-align: middle; }

/* Results table: fits the panel; on narrow screens each attempt becomes a card */
table.results td { vertical-align: middle; }
table.results .score { margin-top: 4px; font-weight: 600; white-space: nowrap; }
table.results .bad-text { color: var(--bad); }
table.results td.actions { white-space: nowrap; text-align: right; }
table.results td.actions .check { display: block; margin: 6px 0 0; }
@media (max-width: 760px) {
  table.results thead { display: none; }
  table.results, table.results tbody, table.results tr, table.results td { display: block; width: 100%; }
  table.results tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.results td { border: 0; padding: 4px 12px; }
  table.results td[data-label]:not([data-label="Student"])::before { content: attr(data-label); display: inline-block; min-width: 64px; font-size: 11px; text-transform: uppercase; color: var(--muted); }
  table.results td.actions { text-align: left; }
  table.results td.actions .check { display: inline-flex; margin: 0 0 0 10px; }
}
table.results th.sortable { cursor: pointer; user-select: none; }
table.results th.sortable:hover { color: var(--text); }
table.results th.sortable::after { content: ' ↕'; opacity: .45; }
table.results th.sortable.on { color: var(--accent); }
table.results th.sortable.on::after { content: ' ●'; font-size: 8px; vertical-align: middle; opacity: .8; }

/* CSV format help */
.csvdetails > summary { cursor: pointer; color: var(--link); }
.bankhelp { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: var(--panel-alt); font-size: 13.5px; }
.bankhelp[open] { background: var(--panel); }
.csvdetails[open] > summary { margin-bottom: 10px; }
.csvhelp p { margin: 0 0 10px; }
.csvhelp table.list td { font-size: 13px; }
.csvhelp table.list td:last-child { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: nowrap; color: var(--muted); }
@media (max-width: 700px) { .csvhelp table.list td:last-child { white-space: normal; } }

/* Exams list: fits the panel; buttons in a 2 x 2 block; cards on phones */
table.exams td { vertical-align: middle; }
table.exams .examname { color: var(--text); }
table.exams .examname:hover b { color: var(--link); text-decoration: underline; }
table.exams td.actions { width: 1%; }
table.exams .actgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
table.exams .actgrid .btn { text-align: center; white-space: nowrap; }
@media (max-width: 760px) {
  table.exams thead { display: none; }
  table.exams, table.exams tbody, table.exams tr, table.exams td { display: block; width: 100%; }
  table.exams tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.exams td { border: 0; padding: 4px 12px; }
  table.exams td.actions { width: 100%; }
  table.exams .actgrid { grid-template-columns: repeat(4, auto); justify-content: start; }
}

/* Exams: scroll when the list is long; archived list below */
.examscroll { max-height: 560px; overflow-y: auto; }
.examscroll thead th { position: sticky; top: 0; z-index: 1; }
table.exams .actgrid .span2 { grid-column: 1 / -1; }
.btn.ghost { background: transparent; border-color: var(--line-soft); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.archivepanel > summary { cursor: pointer; list-style: none; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.archivepanel > summary::-webkit-details-marker { display: none; }
.archivepanel > summary h3::before { content: '▸ '; color: var(--muted); }
.archivepanel[open] > summary h3::before { content: '▾ '; }
@media (max-width: 760px) { table.exams .actgrid .span2 { grid-column: auto; } .examscroll { max-height: none; } }

/* exam editor: offline exam */
.offlinebox { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin-top: 10px; background: var(--panel-alt); }
.offlinebox .btn { margin-top: 6px; }
.netchoice { display: grid; gap: 6px; }
.netopt { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; font-weight: normal; margin: 0; }
.netopt input { margin-top: 3px; }
.netopt .hint { display: block; margin-top: 2px; }
.netopt:has(input:checked) { border-color: #2f7bd1; background: #eef5fd; }

/* Answers window: help one student */
.helpbox { border: 1px solid #b9d3f0; background: #eef5fd; border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; }

/* question editor: symbol buttons */
.symbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: -4px 0 14px; }
.symbar .sym { min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-alt); font-size: 15px; cursor: pointer; color: inherit; }
.symbar .sym:hover { border-color: var(--accent, #2f7bd1); background: #fff; }

/* exam editor: small pick/points tables must fit the narrow settings panel */
fieldset { min-width: 0; }
.fit-table { overflow-x: auto; max-width: 100%; }
.fit-table table.list th { white-space: normal; padding: 6px 8px; }
.fit-table table.list td { padding: 6px 8px; }
.fit-table input[type=number] { width: 70px !important; max-width: 100%; }

/* exams list grouped by course */
table.list.exams tr.grouprow td { background: var(--panel-alt); padding: 0; border-top: 2px solid var(--line); }
.groupbtn { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; font: inherit; font-size: 14px; color: inherit; cursor: pointer; }
.groupbtn:hover { background: #eef2f7; }
.groupbtn .caret { display: inline-block; width: 14px; color: var(--muted); }
.groupopen { color: var(--ok, #1e7d3a); font-weight: 600; }
table.exams tr[hidden] { display: none !important; }
@media (max-width: 760px) { table.exams tr.grouprow { padding: 0; } table.exams tr.grouprow td { padding: 0; } }

/* Exam editor: security level */
.seclevels { margin-bottom: 8px; }
.secsum ul { margin: 4px 0 6px 18px; padding: 0; }
.secsum li { margin: 2px 0; }
.check.inline { display: inline-flex; margin: 0 10px 0 4px; font-size: inherit; }
/* exam editor (Custom): "Camera watches" stacked, it sits in a narrow panel */
.check.camwatch { display: block; margin: 8px 0; }
.camwatch .check.inline { display: flex; gap: 6px; align-items: center; margin: 6px 0 0 4px; font-weight: 400; }
.camwatch .check.inline input { margin: 0; }
.camwatch .hint { margin-top: 4px; }

/* Drop a file here (CSV import, question pictures) */
.dropzone { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; border: 2px dashed var(--line); border-radius: 8px; padding: 18px 16px; background: var(--panel-alt); cursor: pointer; font-weight: 400; font-size: 14px; color: var(--text); margin: 0; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-within { border-color: var(--primary); }
.dropzone.over { border-color: var(--primary); background: var(--select); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); }
.dropzone .dz-icon { font-size: 24px; line-height: 1; color: var(--primary); width: 40px; height: 40px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; }
.dropzone .dz-text { display: flex; flex-direction: column; }
.dropzone .dz-or { color: var(--muted); font-size: 13px; }
.dropzone .dz-or u { color: var(--link); text-decoration: none; }
.dropzone .dz-file { flex-basis: 100%; color: var(--ok); font-weight: 600; word-break: break-all; }
.dropzone .dz-hint { flex-basis: 100%; color: var(--muted); font-size: 12px; }

/* Sign-up: "I'm not a robot" */
.humancheck { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-alt); padding: 10px 12px; margin: 4px 0 12px; }
.humancheck .hc-box { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.humancheck .hc-input { width: 22px; height: 22px; margin: 0; cursor: pointer; }
.humancheck .hc-side { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.humancheck[data-state="busy"] .hc-text::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: hcspin .8s linear infinite; vertical-align: -2px; }
.humancheck[data-state="done"] { border-color: var(--ok); background: var(--ok-bg); }
.humancheck[data-state="done"] .hc-text { color: var(--ok); }
.humancheck[data-state="error"] .hc-text { color: var(--bad); }
@keyframes hcspin { to { transform: rotate(360deg); } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Math (KaTeX) and answer lines (question bank, editor preview, Answers window) */
.math .katex { font-size: 1.06em; }
.qpreview { border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px; margin-top: 8px; background: var(--panel-alt); font-size: 15px; }
.qpreview .qp-text { white-space: pre-wrap; margin: 0 0 8px; }
.qpreview .qp-choices { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 2px; }
.blank-lines { display: grid; gap: 8px; margin: 4px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.blank-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bl-tag { font-weight: 700; color: var(--primary); min-width: 1.8em; }
.blank-line input.blank { width: 160px !important; max-width: 100%; }
.bl-unit { color: var(--muted); font-weight: 600; }
.bl-tail { margin: 0; color: var(--muted); }
.bl-lead { flex-basis: calc(100% - 3em); }

/* Light / dark switch in the top bar */
.theme-slot { display: flex; flex-shrink: 0; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); background: transparent; color: #fff; font: 600 12.5px var(--font); cursor: pointer; white-space: nowrap; }
.theme-btn:hover { background: var(--bar-dark); }
.theme-btn .ti { font-size: 14px; line-height: 1; }
@media (max-width: 720px) { .theme-btn .tl { display: none; } }

/* Dark look */
:root[data-theme="dark"] {
  --bar: #1a2a3f;
  --bar-dark: #12202f;
  --page: #11161d;
  --panel: #1a2029;
  --panel-alt: #212935;
  --line: #303a48;
  --line-soft: #27303c;
  --text: #e3e8ee;
  --muted: #9aa5b3;
  --link: #79b0f0;
  --primary: #3f8ae0;
  --primary-dark: #2f74c4;
  --ok: #63d083;
  --ok-bg: #16301f;
  --warn: #f0c96a;
  --warn-bg: #362c12;
  --bad: #ff7b6e;
  --bad-bg: #3a1c1a;
  --select: #1d3350;
  --accent: #a9cbf3;
  color-scheme: dark;
}
[data-theme="dark"] label { color: #c4ccd6; }
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=email], [data-theme="dark"] input[type=password], [data-theme="dark"] input[type=number],
[data-theme="dark"] input[type=datetime-local], [data-theme="dark"] input[type=search], [data-theme="dark"] select, [data-theme="dark"] textarea { background: #11161d; border-color: #3a4554; }
[data-theme="dark"] .btn { background: linear-gradient(#262f3c, #1f2732); border-color: #3a4554; }
[data-theme="dark"] .btn:hover { background: #2b3644; }
[data-theme="dark"] .btn.primary { background: linear-gradient(#468fe3, var(--primary)); border-color: var(--primary-dark); color: #fff; }
[data-theme="dark"] .btn.ghost { background: transparent; }
[data-theme="dark"] table.list tr:hover td { background: #1f2630; }
[data-theme="dark"] .tag { color: #a9cbf3; }
[data-theme="dark"] .tag.grey { background: #2a323d; }
[data-theme="dark"] .badge.grey { background: #556170; }
[data-theme="dark"] .note.ok { border-color: #2c5a3a; color: #9fe0b1; }
[data-theme="dark"] .note.bad { border-color: #6a302b; color: #ffb3aa; }
[data-theme="dark"] .note.warn { border-color: #6a5420; }
[data-theme="dark"] .note.info { border-color: #2c4a70; color: #a9cbf3; }
[data-theme="dark"] .sidenav a.on { color: #a9cbf3; box-shadow: inset 3px 0 0 var(--link); }
[data-theme="dark"] .pack span, [data-theme="dark"] .method:has(input:checked), [data-theme="dark"] .settings-h, [data-theme="dark"] table.results th.sortable.on { color: #a9cbf3; }
[data-theme="dark"] .dialog { background: var(--panel); }
[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .65); }
[data-theme="dark"] #toast { background: #2c3a4b; }
[data-theme="dark"] .code-box { border-color: #4a5a6c; }
[data-theme="dark"] .netopt:has(input:checked) { border-color: var(--primary); background: var(--select); }
[data-theme="dark"] .helpbox { border-color: #2c4a70; background: #172638; }
[data-theme="dark"] .symbar .sym:hover { background: var(--panel); }
[data-theme="dark"] .groupbtn:hover { background: #222b37; }
[data-theme="dark"] .avatar-img.initial { background: #2c3f57; color: #cfe0f5; }
[data-theme="dark"] .qrbox { background: var(--panel); }
/* QR codes and pictures keep a white background so they stay readable */
[data-theme="dark"] .item { background: var(--panel); }
[data-theme="dark"] .item:hover { background: var(--panel-alt); }
[data-theme="dark"] .offbox { background: #172638; border-color: #2c4a70; border-left-color: var(--primary); }
[data-theme="dark"] .offbox.ready { background: #16301f; border-color: #2c5a3a; border-left-color: var(--ok); }
[data-theme="dark"] .offtag { color: #a9cbf3; background: #1d3350; }
[data-theme="dark"] .tile svg { color: #c4ccd6; }
[data-theme="dark"] .kv tr:nth-child(odd) td { background: var(--panel-alt); }
[data-theme="dark"] .sumbar { background: var(--panel); }
[data-theme="dark"] .folder:hover { background: var(--panel-alt); }
[data-theme="dark"] .movebar { border-color: #2c4a70; }
[data-theme="dark"] .auth, [data-theme="dark"] .tabs button.on { background: var(--panel); }
[data-theme="dark"] .frame { border-color: var(--line); box-shadow: 0 18px 44px rgba(0, 0, 0, .4); }
[data-theme="dark"] .band .box { border-left-color: var(--link); }
[data-theme="dark"] .tabs button.on, [data-theme="dark"] .folder.on { border-bottom-color: var(--link); }
