/* Lumen kit (kit 05 §3-§6): frame + components. Uses tokens.css only (TOK-01); !important only for print.
   Class names are Store 2's, so Store 2's move is a straight swap (05 §7). Change components here first and show them on the
   kitchen-sink page (PKG-04). */
* { box-sizing: border-box; }
html, body { margin: 0; }
body.app, body.plain {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink);
  background: radial-gradient(1200px 600px at 100% -10%, var(--glow-a), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, var(--glow-b), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right, .num { text-align: end; }
.num { font-variant-numeric: tabular-nums; }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }
.hidden, [hidden] { display: none !important; }
.ic { flex: 0 0 auto; vertical-align: middle; }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }

/* ---------- preview ribbon ---------- */
.preview-ribbon {
  position: sticky; top: 0; z-index: 60; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 7px 14px; font-size: 12.5px; color: var(--ribbon-ink); background: linear-gradient(90deg, var(--ribbon-a), var(--ribbon-b)); border-bottom: 1px solid var(--ribbon-line); text-align: center;
}

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w); position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar-bg); backdrop-filter: blur(10px); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px 12px; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: var(--card); border: 1px solid var(--line); padding: 3px; }
.brand-school { font-weight: 800; font-size: 13.5px; line-height: 1.25; }
.brand-app { font-size: 12px; color: var(--muted); font-weight: 600; }
.sidebar-cta { margin: 0 4px 12px; }
.menu { flex: 1; }
.menu-group { margin-bottom: 8px; }
.menu-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 10px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 10px;
  color: var(--ink2); font-weight: 600; font-size: 13.5px; min-height: 38px;
}
.menu-item:hover { background: var(--soft2); text-decoration: none; color: var(--ink); }
.menu-item.active { background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 14%, transparent), color-mix(in srgb, var(--brand2) 9%, transparent)); color: var(--link); }
.menu-item.active .ic { color: var(--link); }
.menu-item .ic { color: var(--muted); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px 12px; position: sticky; top: 0; z-index: 40;
  background: linear-gradient(180deg, var(--topbar-a), var(--topbar-b)); backdrop-filter: blur(8px);
}
body:has(.preview-ribbon) .topbar { top: 34px; }
.topbar-title h1 { font-size: 22px; font-weight: 800; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--on-brand); font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 4px 12px var(--ring);
}
.who-name { font-weight: 700; font-size: 13px; line-height: 1.2; }
.who-role { font-size: 11.5px; color: var(--muted); }
.icon-btn.menu-toggle { display: none; }   /* shown only below 980 px (the rule must beat .icon-btn) */
.content { padding: 8px 28px 28px; flex: 1; }
.foot { padding: 14px 28px 20px; color: var(--muted); font-size: 12px; }
.sidebar-scrim { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 16px; min-height: 40px; border-radius: var(--r-ctl); border: 0; cursor: pointer; color: var(--on-brand); white-space: nowrap;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 6px 16px var(--ring); transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px var(--ring); text-decoration: none; color: var(--on-brand); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: progress; transform: none; }
.btn-ghost { background: var(--card); color: var(--ink2); border: 1.5px solid var(--line); box-shadow: none; }
.btn-ghost:hover { color: var(--link); border-color: var(--line-hover); box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, var(--danger-a), var(--danger-b)); box-shadow: 0 6px 16px rgba(224, 68, 92, .22); }
.btn-ok { background: linear-gradient(135deg, var(--ok-a), var(--ok-b)); box-shadow: 0 6px 16px rgba(15, 157, 107, .22); }
.btn-soft { background: var(--soft2); color: var(--link); box-shadow: none; }
.btn-soft:hover { color: var(--link); background: var(--soft3); box-shadow: none; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink2); cursor: pointer; }
.icon-btn:hover { color: var(--link); border-color: var(--line-hover); }
.link-btn { background: none; border: 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }

/* ---------- cards, grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line2); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 16px 20px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .card + .alert, .grid + .alert, .alert + .card, .alert + .grid { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }   /* a wide table scrolls inside its box instead of widening the column (MOB-04) */
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack > * + * { margin-top: 12px; }
.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; }

/* stat cards */
.stat { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh); color: var(--ink); transition: transform .12s, box-shadow .12s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--sh2); text-decoration: none; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--on-brand); background: linear-gradient(135deg, var(--brand), var(--brand2)); flex: 0 0 auto; }
.stat-ok .stat-icon { background: linear-gradient(135deg, var(--ok-a), var(--ok-b)); }
.stat-warn .stat-icon { background: linear-gradient(135deg, var(--warn-a), var(--warn-b)); }
.stat-danger .stat-icon { background: linear-gradient(135deg, var(--danger-a), var(--danger-b)); }
.stat-cyan .stat-icon { background: linear-gradient(135deg, var(--cyan-a), var(--cyan-b)); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: start; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.t tbody tr:hover td { background: var(--row-hover); }
table.t tr.is-cancelled td { color: var(--danger); background: var(--cancel-bg); }
table.t tr.is-cancelled td a { color: var(--danger); }
table.t tr.total td, table.t tfoot td { font-weight: 800; background: var(--soft); border-top: 1px solid var(--line); }
table.t tr.empty td { text-align: center; color: var(--muted); padding: 28px 14px; }
table.t th.num, table.t td.num { text-align: end; }
table.t .sub { display: block; color: var(--muted); font-size: 12px; }
table.t.compact td, table.t.compact th { padding: 7px 10px; }
.card > .table-wrap:first-child table.t th:first-child { border-start-start-radius: var(--r-card); }
.card > .table-wrap:first-child table.t th:last-child { border-start-end-radius: var(--r-card); }

/* ---------- forms ---------- */
label { font-size: 13px; color: var(--ink2); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=email], input[type=password], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  padding: 9px 12px; min-height: 40px; max-width: 100%; transition: border-color .12s, box-shadow .12s; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
/* File picker (core file service; hello_file_input): the browser's own control, framed and sized for touch. */
input[type=file] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--r-ctl);
  padding: 8px; min-height: 48px; width: 100%; max-width: 100%; cursor: pointer;
}
input[type=file]::file-selector-button {
  font: inherit; font-weight: 700; font-size: 14px; color: var(--on-brand); background: var(--brand); border: 0; border-radius: var(--r-ctl);
  padding: 8px 14px; min-height: 36px; margin-inline-end: 12px; cursor: pointer;
}
.field.is-err input[type=file] { border-color: var(--danger); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
input.is-invalid, select.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(214, 52, 76, .14); }
input[readonly] { background: var(--soft); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.filters input, .filters select { min-width: 150px; width: auto; }
.filters .field { flex: 1 1 240px; }
.input-group { display: flex; align-items: stretch; }
.input-group > input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group > .btn { border-start-start-radius: 0; border-end-start-radius: 0; }
.search-box { position: relative; }
.search-box .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { padding-inline-start: 38px; }

/* ---------- badges, alerts, toasts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill); background: var(--soft2); color: var(--link); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge-neutral { background: var(--neutral-bg); color: var(--ink2); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.alert { position: relative; padding-block: 12px; padding-inline: 16px 52px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; }
.alert-success, .alert-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.alert-danger, .alert-error { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-line); }
.alert-warning, .alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.alert-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.alert-x { position: absolute; inset-inline-end: 4px; top: 4px; width: 44px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--r-ctl); background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .7; }
.alert-x:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.toasts { position: fixed; inset-inline-end: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: var(--on-brand); padding: 12px 16px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); font-weight: 600; font-size: 13.5px; animation: toastIn .18s ease-out; }
.toast.ok { background: var(--ok-ink); } .toast.err { background: var(--danger-ink); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 24, 45, .42); display: grid; place-items: center; z-index: 150; padding: 16px; animation: fadeIn .12s; }
.modal { width: min(520px, 100%); background: var(--card); border-radius: 18px; box-shadow: 0 30px 80px rgba(20, 24, 45, .35); overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { flex: 1; font-size: 16px; }
.modal-body { padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
.modal-body ul { margin: 6px 0 0; padding-inline-start: 20px; }
.modal-foot { padding: 14px 20px; display: flex; gap: 10px; justify-content: flex-end; background: var(--soft); flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- misc ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .ic { color: var(--brand2); margin-bottom: 10px; }
.empty-state h2 { color: var(--ink); margin-bottom: 6px; }
.empty-state .btn { margin-top: 14px; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 14px 20px; }
.pager a { padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; color: var(--ink2); }
.pager a.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pager .muted { margin-inline-start: auto; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: var(--r-pill); background: var(--soft); color: var(--ink2); font-weight: 700; font-size: 13px; border: 1px solid var(--line); }
.tabs a.active { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: var(--on-brand); border-color: transparent; }
.tabs a:hover { text-decoration: none; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-block: 0 14px; padding-inline: 22px 0; font-size: 13px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand2); }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 9px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.check-row .mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.check-row .mark.ok { background: var(--ok-bg); color: var(--ok); }
.check-row .mark.bad { background: var(--danger-bg); color: var(--danger); }
.bar { height: 8px; border-radius: 99px; background: var(--line2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand2)); }
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .barfill { fill: url(#barGrad); }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.noaccess { max-width: 460px; margin: 12vh auto; padding: 32px; text-align: center; }
.noaccess-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 12px; color: var(--on-brand); background: linear-gradient(135deg, var(--brand), var(--brand2)); }
.noaccess h1 { font-size: 22px; margin-bottom: 8px; }
.noaccess .btn { margin-top: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: var(--r-pill); background: var(--soft); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }
.divider { height: 1px; background: var(--line2); margin: 14px 0; }

/* ---------- counter (billing) ---------- */
.counter { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.counter-side { position: sticky; top: 76px; }
body:has(.preview-ribbon) .counter-side { top: 110px; }
.suggest { position: absolute; inset-inline: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh2); z-index: 30; max-height: 360px; overflow-y: auto; }
.suggest-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item.active { background: var(--soft2); }
.suggest-main { flex: 1; min-width: 0; }
.suggest-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-meta { font-size: 12px; color: var(--muted); }
.suggest-right { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.suggest-empty { padding: 14px; color: var(--muted); text-align: center; }
.student-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, transparent), color-mix(in srgb, var(--accent) 7%, transparent)); border: 1px solid var(--brand-line); }
.student-card .avatar { width: 46px; height: 46px; font-size: 18px; }
.student-card .name { font-weight: 800; font-size: 15.5px; }
.student-card .meta { color: var(--ink2); font-size: 12.5px; }
.adv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); font-weight: 800; font-size: 12.5px; }
.adv-chip.zero { background: var(--neutral-bg); color: var(--muted); }
.kit-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.kit-btn { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 13px; border-radius: 12px; border: 1.5px dashed var(--brand-line2); background: var(--card); cursor: pointer; font: inherit; text-align: start; }
.kit-btn:hover { border-style: solid; border-color: var(--brand); background: var(--soft2); }
.kit-btn.suggested { border-style: solid; border-color: var(--brand2); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 7%, transparent), color-mix(in srgb, var(--brand2) 9%, transparent)); }
.kit-btn b { font-size: 13px; } .kit-btn span { font-size: 12px; color: var(--muted); }
.lines td.qty { width: 118px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.stepper button { width: 32px; height: 36px; border: 0; background: var(--soft); cursor: pointer; font-size: 16px; font-weight: 700; color: var(--ink2); }
.stepper button:hover { background: var(--soft2); color: var(--link); }
.stepper input { width: 48px; border: 0; text-align: center; padding: 0; min-height: 36px; border-radius: 0; box-shadow: none !important; }
.line-kit td { background: var(--bg2); font-size: 12.5px; color: var(--link); font-weight: 700; padding-top: 8px; padding-bottom: 8px; }
.stock-low { color: var(--warn); font-weight: 700; }
.stock-out { color: var(--danger); font-weight: 700; }
.x-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; }
.x-btn:hover { color: var(--danger); background: var(--danger-bg); }
.totals { font-variant-numeric: tabular-nums; }
.totals .line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.totals .grand { font-size: 26px; font-weight: 800; letter-spacing: -.02em; padding: 10px 0 4px; border-top: 1px dashed var(--line); margin-top: 6px; }
.pay-row { display: grid; grid-template-columns: 110px 1fr 1fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-row select, .pay-row input { min-height: 38px; padding: 7px 10px; }
.left-to-pay { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; font-weight: 800; margin: 10px 0; }
.left-to-pay.due { background: var(--warn-bg); color: var(--warn-ink); }
.left-to-pay.done { background: var(--ok-bg); color: var(--ok-ink); }
.left-to-pay.over { background: var(--danger-bg); color: var(--danger-ink); }
.saved-panel { text-align: center; padding: 26px 20px; }
.saved-panel .big { font-size: 26px; font-weight: 800; margin: 6px 0; }
.qr-box { display: flex; justify-content: center; padding: 8px; }
.qr-box svg.qr { background: #fff; border-radius: var(--r-ctl); padding: 6px; max-width: 100%; height: auto; }   /* black on white in dark mode too: scanners need it */
.saved-check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; color: var(--on-brand); background: linear-gradient(135deg, var(--ok-a), var(--ok-b)); box-shadow: 0 10px 26px rgba(15, 157, 107, .3); }
kbd { font-family: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .counter { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 980px) {
  .sidebar { position: fixed; inset-inline-start: 0; top: 0; bottom: 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .15); background: var(--card); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(20, 24, 45, .35); z-index: 45; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .counter { grid-template-columns: minmax(0, 1fr); }
  .counter-side { position: static; }
  .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .topbar { padding: 12px 16px 10px; flex-wrap: wrap; }
  .topbar-title h1 { font-size: 19px; }
  .who-text { display: none; }
  .topbar { position: sticky; }
  .topbar-title { flex: 1 1 auto; min-width: 0; }
  .topbar-right { margin-inline-start: 0; width: 100%; flex-wrap: wrap; }
  .topbar-right .who { position: absolute; top: 12px; inset-inline-end: 16px; }   /* the avatar sits beside the menu button */
  .topbar-actions { order: 3; width: 100%; }
  .topbar-actions > * { flex: 1 1 auto; }
  .topbar-actions .row { flex: 1 1 100%; flex-wrap: nowrap; }
  .topbar-actions .row select { flex: 1 1 auto; min-width: 0; width: auto; }
  .content { padding: 6px 16px 22px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .stat-value { font-size: 20px; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .filters .field > label { flex: none; }
  .pay-row { grid-template-columns: 96px 1fr 36px; }
  .pay-row .ref { grid-column: 1 / span 2; }
  .card-head, .card-body { padding-inline: 14px; }
  table.t td, table.t th { padding: 9px 10px; }
  body.app { font-size: 14px; }
}
@media print {
  .no-print, .sidebar, .topbar, .preview-ribbon, .foot, .filters, .pager, .toasts { display: none !important; }
  body.app { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; }
  table.t th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.t tr.is-cancelled td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible; }
  a { color: inherit; }
}

/* ---------- added by the core package (lumen 1.0.0) ---------- */
/* plain pages (sign-in, choose): one centred card, same background */
.plain-wrap { max-width: 460px; margin: 0 auto; padding: 10vh 16px 28px; }
.plain-wrap.wide { max-width: 640px; }
.signin-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.signin-head h1 { font-size: 22px; font-weight: 800; }
.logo { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: var(--on-brand); font-weight: 800; font-size: 22px;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 6px 16px var(--ring); flex: 0 0 auto; }
/* Support ribbon: the operator is inside a school (UXP-12: shown as "Support" only) */
.support-ribbon { position: sticky; top: 0; z-index: 60; padding: 7px 14px; font-size: 12.5px; text-align: center; color: var(--link);
  background: var(--soft2); border-bottom: 1px solid var(--line); }
body:has(.support-ribbon) .topbar { top: 34px; }
/* launcher tiles (FRM-13; 05 §3.1: white card, radius 18, 60 px gradient icon, title clamped to 2 lines, 6 a row, 2 on phones) */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 168px; padding: 18px 12px 14px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh); color: var(--ink); transition: transform .12s, box-shadow .12s; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--sh2); text-decoration: none; color: var(--ink); }
.tile-icon { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; color: var(--on-brand); flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); }
.tiles li:nth-child(5n+2) .tile-icon { background: linear-gradient(135deg, var(--cyan-a), var(--cyan-b)); }
.tiles li:nth-child(5n+3) .tile-icon { background: linear-gradient(135deg, var(--ok-a), var(--ok-b)); }
.tiles li:nth-child(5n+4) .tile-icon { background: linear-gradient(135deg, var(--warn-a), var(--warn-b)); }
.tiles li:nth-child(5n+5) .tile-icon { background: linear-gradient(135deg, var(--danger-a), var(--danger-b)); }
.tile-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.is-off { opacity: .7; }
.tile .badge { white-space: normal; text-align: center; justify-content: center; max-width: 100%; line-height: 1.3; }
/* field errors (CMP-07: .field.is-err only, the message under the field) */
.field.is-err input, .field.is-err select, .field.is-err textarea { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(214, 52, 76, .14); }
.field .err { font-size: 12.5px; font-weight: 600; color: var(--danger-ink); }
/* password with a Show button */
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }
/* a POST (sign-out) drawn as a menu item */
button.menu-item { width: 100%; border: 0; background: none; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-align: start; }
/* a list of big choices (choose school) */
.choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.choice { width: 100%; text-align: start; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); font: inherit; cursor: pointer; color: var(--ink); min-height: 48px; }
.choice:hover { border-color: var(--brand); background: var(--soft2); }
@media (max-width: 1180px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 767px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile { height: 150px; } }
@media print { .support-ribbon { display: none !important; } }

/* ---------- right-to-left (Arabic) and the scripts of Malayalam and Hindi (lumen 1.2, 05 Q8) ---------- */
/* Layout uses start/end everywhere above, so dir="rtl" mirrors it. Only what start/end cannot express is set here. */
@media (max-width: 980px) { [dir="rtl"] .sidebar { transform: translateX(105%); } [dir="rtl"] body.menu-open .sidebar { transform: none; } }
[dir="rtl"] .ic-dir { transform: scaleX(-1); }   /* arrows that point the way of reading: back, next, sign out, undo */
:lang(ml) body, :lang(hi) body { line-height: 1.7; }   /* taller letters need more room between lines */
:lang(ar) body { line-height: 1.75; }

/* ---------- keyboard and screen readers (lumen 1.2; 05 UXP-14, CMP-05) ---------- */
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 300; padding: 10px 14px; border-radius: var(--r-ctl);
  background: var(--card); color: var(--link); font-weight: 700; box-shadow: var(--sh2); }
.skip-link:focus { top: 12px; }
.content:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.alert-x .ic { vertical-align: middle; }
/* language choice on the sign-in page */
.lang-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.lang-links a, .lang-links span { display: inline-grid; place-items: center; min-width: 44px; min-height: 36px; padding: 4px 10px; border-radius: var(--r-ctl); }
.lang-links a:hover { background: var(--soft2); text-decoration: none; }
.lang-links span[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- core part 2 (lumen 1.3) ---------- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.unit { padding-bottom: 12px; border-bottom: 1px solid var(--line2); }
fieldset.unit:last-of-type { border-bottom: 0; }
fieldset.unit legend { padding: 0 0 8px; font-size: 14px; }
.last-signin { margin: -4px 0 14px; }
.card-head .search-box { flex: 0 1 320px; }
@media (max-width: 767px) { .card-head { flex-wrap: wrap; } .card-head .search-box { flex: 1 1 100%; } }
.last-signin .link-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 8px; border-radius: var(--r-ctl); }
.last-signin .link-btn:hover { background: var(--soft2); }
table.t .badge { white-space: normal; }   /* long role names wrap inside a cell instead of widening the table */
@media (max-width: 767px) { .hide-sm { display: none; } }
/* a tree in a table: how far a row is indented (message rules: school, module, function, kind) */
table.t td.in-1 { padding-inline-start: 30px; }
table.t td.in-2 { padding-inline-start: 46px; }
table.t td.in-3 { padding-inline-start: 62px; }

/* ---------- marking a roster, calendar, register, sticky save bar (Lumen 1.5.0, attendance) ---------- */
.roster { list-style: none; margin: 0; padding: 0; }
.roster-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line2); min-height: 60px; }
.roster-name { flex: 1 1 150px; min-width: 0; font-weight: 700; }
.roster-name .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.roster-name .err { display: block; font-size: 12.5px; font-weight: 600; color: var(--danger-ink); }
.roster-row.is-err { background: var(--danger-bg); }
.roster-row input[type=time] { width: 128px; min-height: 44px; }
.roster-row select { width: auto; min-width: 130px; min-height: 44px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; background: var(--card); margin: 0; padding: 0; min-width: 0; }
.seg label { position: relative; margin: 0; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-width: 48px; min-height: 44px; padding: 0 10px; font-weight: 800; font-size: 14px; color: var(--ink2); background: var(--card); }
.seg label + label span { border-inline-start: 1px solid var(--line); }
.seg input:checked + span { background: var(--soft3); color: var(--link); }
.seg .t-ok input:checked + span { background: var(--ok-bg); color: var(--ok-ink); }
.seg .t-warn input:checked + span { background: var(--warn-bg); color: var(--warn-ink); }
.seg .t-danger input:checked + span { background: var(--danger-bg); color: var(--danger-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: -3px; }
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); box-shadow: var(--sh2); }
.save-bar .btn { min-height: 48px; }
table.t.cal { table-layout: fixed; }
table.t.cal th, table.t.cal td { text-align: center; padding: 6px 2px; }
table.t.cal td { height: 66px; vertical-align: top; }
table.t.cal td .d { display: block; text-align: start; padding-inline-start: 4px; font-size: 11px; color: var(--muted); }
table.t.cal td.off { background: var(--soft); }
table.t.cal td.blank { background: transparent; }
table.t.cal td small { display: block; font-size: 10.5px; color: var(--muted); overflow-wrap: anywhere; }
table.t.reg { font-size: 12px; }
table.t.reg th, table.t.reg td { padding: 5px 4px; text-align: center; min-width: 26px; }
table.t.reg th:first-child, table.t.reg td:first-child { text-align: start; min-width: 140px; position: sticky; inset-inline-start: 0; background: var(--card); z-index: 1; }
table.t.reg th:first-child { background: var(--soft); }
table.t.reg td.h, table.t.reg td.n { background: var(--soft); color: var(--muted); }
table.t.reg td.a { background: var(--danger-bg); color: var(--danger-ink); font-weight: 800; }
table.t.reg td.l { background: var(--warn-bg); color: var(--warn-ink); font-weight: 700; }
table.t.reg td.p { color: var(--ok-ink); }
table.t.reg td.sum { font-weight: 800; border-inline-start: 1px solid var(--line); }
.roster-row .when { display: none; }
.roster-row .when.show, .roster-row:has(input[value="LT"]:checked) .when, .roster-row:has(option[value="LT"]:checked) .when { display: block; }
/* a choice inside a table row (a festival place, a status): never squeezed below a readable, tappable width */
table.t td select { min-width: 96px; }
/* the colour picker: as tall as the other inputs, wide enough to tap */
input[type=color] { min-height: 40px; min-width: 56px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); }
/* a stored picture shown in a form (the school's logo, signature, seal): whole, never stretched, on a card background */
.pic { display: block; max-width: min(240px, 100%); max-height: 120px; object-fit: contain; padding: 6px; margin-block-end: 8px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card); }
/* the bell in the top bar (the notification centre): the unread count on its corner */
.bell { position: relative; }
.bell-n { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center;
  background: var(--danger); color: var(--on-brand); font-size: 11px; font-weight: 800; line-height: 1; }
/* gallery (1.5.6): album cards, a photo grid and an upload queue */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.album-card { display: flex; flex-direction: column; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
  color: inherit; text-decoration: none; box-shadow: var(--sh); }
.album-card:hover { border-color: var(--line2); box-shadow: var(--sh2); }
.album-card:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.album-card .cover { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--soft); display: block; }
.album-card .cover-none { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.album-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.album-card .title { font-weight: 800; overflow-wrap: anywhere; }
.album-card .sub { color: var(--muted); font-size: 12.5px; }
.album-card .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, 45%), 1fr)); gap: 8px; }
.photo-tile { position: relative; margin: 0; min-width: 0; border-radius: var(--r-ctl); overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.photo-tile img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-tile .none { aspect-ratio: 1; display: grid; place-items: center; padding: 8px; text-align: center; color: var(--muted); font-size: 12px; }
.photo-tile figcaption { padding: 6px 8px; font-size: 12px; overflow-wrap: anywhere; }
.photo-tile .pick { position: absolute; top: 6px; inset-inline-start: 6px; display: grid; place-items: center; min-width: 32px; min-height: 32px;
  border-radius: var(--r-ctl); background: var(--card); box-shadow: var(--sh); }
.photo-tile .pick input { width: 20px; height: 20px; margin: 0; }
.photo-tile .mark { position: absolute; top: 6px; inset-inline-end: 6px; }
.photo-tile:has(.pick input:checked) { outline: 3px solid var(--ring); outline-offset: -3px; }
.photo-tile.is-held img { opacity: .55; }
.photo-big { display: block; max-width: 100%; max-height: 80vh; margin-inline: auto; border-radius: var(--r-ctl); background: var(--soft); }
.upload-queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upload-queue li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--r-ctl); background: var(--card); }
.upload-queue .name { overflow-wrap: anywhere; font-size: 13.5px; }
.upload-queue .bar { grid-column: 1 / -1; }
.upload-queue li.is-err { background: var(--danger-bg); }
