/* EMIAC style (the EMIAC V8 look): Fraunces for the brand, headings and big amounts; Public Sans for everything else.
   The fonts are kept inside the app (fonts/, SIL Open Font License) so they also work on an office network without internet. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/fraunces-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/fraunces-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/fraunces-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/public-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/public-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/public-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/public-sans-latin-700-normal.woff2') format('woff2'); }

:root {
  --teal: #123B36;
  --teal-soft: #1D544C;
  --paper: #F7F6F1;
  --panel: #FFFFFF;
  --border: #DEDACE;
  --ink: #1B2420;
  --ink-soft: #5B655F;
  --green: #2F7A56;  --green-bg: #E7F1EA;
  --rust: #A6552C;   --rust-bg: #F5E9E1;
  --blue: #2563EB;   --blue-bg: #EFF6FF;
  --amber: #B7791F;  --amber-bg: #FBF0DC;
  --hover: #FAF9F5;
  /* names the screens already use, mapped onto the EMIAC tokens */
  --line: var(--border);
  --head: var(--teal);
  --head-ink: #FFFFFF;
  --accent: var(--teal);
  --accent-soft: #E3ECE9;
  --sel: #DCE9E5;
  --dr: var(--green);
  --cr: var(--rust);
  --danger: var(--rust);
  --ok: var(--green);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; padding: 8px 16px;
  background: var(--head); color: var(--head-ink);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; letter-spacing: .3px; white-space: nowrap; }
.brand b { color: #9fe3e8; }
.topinfo { flex: 1; display: flex; gap: 12px; align-items: center; min-width: 0; }
.tb-company { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-period { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: inherit; border-radius: 6px; padding: 2px 10px; cursor: pointer; white-space: nowrap; }
.topright { display: flex; gap: 12px; align-items: center; }
.tb-user { opacity: .8; font-size: 13px; }
.linkbtn { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 1fr 190px; min-height: calc(100vh - 44px); }
.main { padding: 18px 22px 60px; outline: none; min-width: 0; }
.keys { border-left: 1px solid var(--line); background: #f1f5f5; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.keys button { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 13px; display: flex; gap: 8px; }
.keys button:hover { border-color: var(--accent); }
.keys kbd { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 44px; }

h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--ink-soft); margin: 0 0 16px; font-size: 14px; }
.crumbs { color: var(--ink-soft); font-size: 13px; margin-bottom: 6px; }
.crumbs span + span::before { content: " › "; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 460px; }
.mid { max-width: 760px; }

/* ---------- gateway menu ---------- */
.gateway { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; max-width: 980px; }
.menu h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-soft); }
.menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; background: none; border: 0; border-radius: 6px; padding: 7px 8px; cursor: pointer; text-align: left; }
.menu button:hover, .menu button:focus { background: var(--sel); outline: none; }
.menu button u { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.menu kbd { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--ink-soft); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #b9c7ca; border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.hint { font-size: 12px; color: var(--ink-soft); }
.err { color: var(--danger); font-size: 14px; margin-top: 10px; white-space: pre-wrap; }
details summary { cursor: pointer; color: var(--accent); margin-top: 12px; font-size: 14px; }

/* ---------- tables / reports ---------- */
table.rep { width: 100%; border-collapse: collapse; background: var(--panel); }
table.rep th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); border-bottom: 2px solid var(--ink); padding: 6px 8px; font-weight: 600; }
table.rep td { padding: 6px 8px; border-bottom: 1px solid #edf1f2; vertical-align: top; }
table.rep .num, table.rep th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rep tr.nav { cursor: pointer; }
table.rep tr.nav:hover td { background: #f6f9f9; }
table.rep tr.nav:focus { outline: none; }
table.rep tr.nav:focus td { background: var(--sel); }
table.rep tr.total td { border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); font-weight: 700; }
table.rep tr.calc td { font-style: italic; }
table.rep tr.pad td { border-bottom-color: transparent; }
table.rep tr.muted td { color: var(--ink-soft); }
table.rep tr.cancelled td { color: #98a2a5; text-decoration: line-through; }
.lvl1 { padding-left: 22px !important; } .lvl2 { padding-left: 40px !important; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 1px; }
.tag.pos { background: #fff1d6; color: #8a5300; }
.dr { color: var(--dr); } .cr { color: var(--cr); }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.twocol > div + div { border-left: 1px solid var(--line); }
.twocol table.rep th { background: #f4f7f7; }
.section-title { font-size: 13px; font-weight: 700; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar label { margin: 0 0 4px; }
.toolbar > div { min-width: 150px; }
.empty { color: var(--ink-soft); padding: 18px 8px; text-align: center; }

/* ---------- voucher entry ---------- */
.vch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.vch-type { font-size: 20px; font-weight: 700; color: var(--accent); }
.vtypes { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.vtypes button { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 3px 11px; font-size: 13px; cursor: pointer; }
.vtypes button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.vtypes kbd { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 4px; }
table.lines { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.lines th { font-size: 12px; text-transform: uppercase; color: var(--ink-soft); text-align: left; padding: 4px; border-bottom: 2px solid var(--ink); }
table.lines td { padding: 3px 4px; border-bottom: 1px solid #edf1f2; }
table.lines td.dcc { width: 74px; } table.lines td.amt { width: 150px; } table.lines td.del { width: 34px; }
table.lines input.amount { text-align: right; font-family: var(--mono); }
table.lines tfoot td { font-weight: 700; border-top: 2px solid var(--ink); font-family: var(--mono); text-align: right; padding: 6px 4px; }
.xbtn { border: 0; background: none; color: var(--ink-soft); cursor: pointer; font-size: 18px; line-height: 1; }
.diff { color: var(--danger); font-weight: 600; }
.balanced { color: var(--ok); font-weight: 600; }
.ledbal { font-size: 12px; color: var(--ink-soft); font-family: var(--mono); }

/* ---------- misc ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }
.toast.bad { background: var(--danger); }
.dlg { border: 1px solid var(--line); border-radius: 10px; padding: 18px; max-width: 420px; width: 92vw; }
.dlg::backdrop { background: rgba(10, 30, 35, .35); }
.tree td.name { white-space: nowrap; }
.code { font-family: var(--mono); font-size: 12px; background: #f1f5f5; padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.split { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .shell { display: block; min-height: 0; }
  .main { padding-bottom: 70px !important; }
  .keys { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; flex-direction: row; overflow-x: auto; border-left: 0; border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .topbar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .brand span { display: none; }
  .topinfo { order: 3; flex-basis: 100%; justify-content: space-between; }
  .tb-period { font-size: 13px; }
  .twocol tr.pad { display: none; }
  .keys button { flex: 0 0 auto; }
  .keys kbd { display: none; }
  .main { padding: 14px 12px 40px; }
  .twocol { grid-template-columns: 1fr; }
  .twocol > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .row3 { grid-template-columns: 1fr 1fr; }
  .tb-user { display: none; }
  table.lines td.amt { width: 110px; }
  table.lines.stack thead { display: none; }
  table.lines.stack tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); position: relative; }
  table.lines.stack td { display: block; border: 0; padding: 0; width: auto !important; min-width: 0 !important; }
  table.lines.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--ink-soft); margin-bottom: 2px; }
  table.lines.stack td.wide { grid-column: 1 / -1; padding-right: 30px; }
  table.lines.stack td.del { position: absolute; right: 0; top: 10px; }
  table.lines.stack td.lamt { text-align: right; align-self: end; }
}
@media print {
  .topbar, .keys, .toolbar, .actions { display: none !important; }
  .shell { display: block; } .main { padding: 0; }
  table.rep tr.nav:focus td { background: none; }
}

/* ---------- ERP foundation: users, approvals, audit ---------- */
.perms { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chk { display: inline-flex; gap: 5px; align-items: center; margin: 0; font-weight: normal; white-space: nowrap; }
.chk input { width: auto; margin: 0; }
.tag.st-pending { background: #fff1d6; color: #8a5300; }
.tag.st-approved { background: #dff3e4; color: #1d6b34; }
.tag.st-rejected { background: #fde2e1; color: #a1271f; }
.tag.st-cancelled, .tag.act-delete { background: #eceff1; color: #546e7a; }
.tag.act-insert { background: #dff3e4; color: #1d6b34; }
.tag.act-update { background: #e3eefc; color: #1f4f96; }
.rep.audit td { vertical-align: top; }
.chg { display: inline-block; margin-right: 10px; white-space: nowrap; }
.chg b { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .tag.st-pending { background: #4a3a14; color: #ffd27a; }
  .tag.st-approved, .tag.act-insert { background: #17402a; color: #8fe0a8; }
  .tag.st-rejected { background: #4a1f1d; color: #ffaaa3; }
  .tag.st-cancelled, .tag.act-delete { background: #2f3a40; color: #b0bec5; }
  .tag.act-update { background: #1d3354; color: #9cc3ff; }
}
#ucard { max-width: 980px; margin-top: 14px; }
#ucard .urole { min-width: 130px; }
#utab td.perms { min-width: 300px; }

/* ---------- Purchase ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.tabs button { border: 1px solid var(--line, #d8dde3); background: transparent; color: inherit; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs button kbd { font-size: 11px; opacity: .75; margin-right: 2px; }
.totals { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0 4px; }
.totals .warn { color: #a15c00; }
.pgrid td input, .pgrid td select { min-width: 70px; }
.pgrid td:first-child input { min-width: 220px; }
.doc-parties { margin: 6px 0 12px; gap: 18px; }
@media (prefers-color-scheme: dark) { .totals .warn { color: #ffc56b; } }
.sign { display: none; }
@media print { .sign { display: flex; justify-content: space-between; margin: 40px 0 20px; font-size: 13px; } }

/* ---------- HR & Payroll ---------- */
table.att td.ac { padding: 2px 1px; text-align: center; }
table.att th { padding: 6px 2px; }
table.att th.we { color: #b45309; }
input.atc { width: 34px; padding: 3px 2px; text-align: center; font-family: var(--mono); text-transform: uppercase; }
.slip { margin-bottom: 18px; }
@media print { .slip { break-after: page; border: none; box-shadow: none; } .slip:last-child { break-after: auto; } }

/* ---------- Dashboard & notifications ---------- */
.tb-bell { position: relative; display: inline-flex; align-items: center; gap: 4px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: inherit; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.tb-bell b { font-size: 12px; min-width: 16px; text-align: center; }
.tb-bell.has b { background: #f59e0b; color: #1b1300; border-radius: 9px; padding: 0 5px; }
.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 6px; }
.tile { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; }
.tile:hover, .tile:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.tile .tl { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.tile .tv { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; margin-top: 4px; }
.tile .ts { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tile.warn { border-left: 4px solid #d97706; }
.tile.bad { border-left: 4px solid #c0392b; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 90px; padding: 6px 0 0; }
.spark div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--ink-soft); }
.spark i { display: block; width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.spark div.today i { background: #0b4f58; }
table.rep tr.unread td { font-weight: 600; }
table.rep tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tb-bell b:empty { display: none; }

/* ---------- Course (education edition) ---------- */
.cbar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; max-width: 640px; }
.cbar i { display: block; height: 100%; background: var(--accent); }
.course { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.cnav { position: sticky; top: 8px; max-height: calc(100vh - 140px); overflow: auto; }
.cch { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin: 12px 0 4px; }
.cl { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; font: inherit; color: inherit; cursor: pointer; }
.cl:hover, .cl:focus { background: var(--accent-soft); outline: none; }
.cl.on { background: var(--accent); color: #fff; }
.cdone { color: #1d7a3a; font-weight: 700; }
.cl.on .cdone, .cl.on .ctodo { color: #fff; }
.ctodo { color: var(--ink-soft); }
.clesson { max-width: 820px; line-height: 1.6; }
.clesson h2 { margin: 2px 0 10px; }
.clesson[lang="ml"] { font-size: 16px; line-height: 1.75; }
.clesson kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--panel); }
.ctask { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.ctask.ok { border-color: #8fd0a1; background: rgba(46, 160, 67, .06); }
.chip { display: inline-block; min-width: 34px; text-align: center; font-size: 11px; border-radius: 9px; padding: 1px 5px; background: var(--line); }
.chip.ok { background: #dff3e4; color: #1d6b34; } .chip.half { background: #fff1d6; color: #8a5300; }
.cert { display: flex; justify-content: center; padding: 20px; }
.cert-in { width: 100%; max-width: 820px; text-align: center; border: 6px double var(--accent); padding: 40px 30px; background: var(--panel); }
.cert-in h1 { font-size: 30px; margin: 6px 0 18px; } .cert-in h2 { font-size: 28px; margin: 8px 0; } .cert-in h3 { margin: 8px 0 14px; }
.cert-sign { display: flex; justify-content: space-between; margin-top: 50px; }
@media (max-width: 760px) { .course { grid-template-columns: 1fr; } .cnav { position: static; max-height: none; } }
/* educational edition: every print says so */
@media print {
  body.edu::after { content: 'EDUCATIONAL VERSION — NOT FOR BUSINESS USE'; position: fixed; top: 45%; left: 0; right: 0; text-align: center;
    transform: rotate(-24deg); font-size: 44px; font-weight: 800; color: rgba(0, 0, 0, .10); pointer-events: none; z-index: 9999; }
  body.edu.nowm::after { content: none; }
  .cnav, .cbar { display: none !important; }
}
.tb-edu { background: #f59e0b; color: #1b1300; border: 0; border-radius: 6px; padding: 2px 10px; font-weight: 700; letter-spacing: .5px; cursor: pointer; }
.lic-code { font-family: var(--mono); font-size: 26px; letter-spacing: 2px; font-weight: 700; padding: 8px 0; user-select: all; }
textarea.lic-key { font-family: var(--mono); font-size: 12px; width: 100%; min-height: 110px; word-break: break-all; }

/* ---------- the big alert box (alertbox.js) ---------- */
dialog.abox { border: 0; border-radius: 14px; padding: 0; width: min(560px, 92vw); background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
dialog.abox::backdrop { background: rgba(10, 20, 25, .55); }
.abox-in { display: flex; gap: 18px; padding: 26px 26px 10px; align-items: flex-start; }
.abox-icon { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #fff; background: #c0392b; }
dialog.abox[data-kind="warn"] .abox-icon, dialog.abox[data-kind="confirm"] .abox-icon { background: #d97706; }
dialog.abox[data-kind="info"] .abox-icon { background: var(--accent); }
dialog.abox[data-kind="error"] { border-top: 6px solid #c0392b; }
dialog.abox[data-kind="warn"], dialog.abox[data-kind="confirm"] { border-top: 6px solid #d97706; }
dialog.abox[data-kind="info"] { border-top: 6px solid var(--accent); }
.abox-body h2 { margin: 2px 0 8px; font-size: 20px; }
.abox-body p { margin: 0; font-size: 16px; line-height: 1.55; word-break: break-word; }
.abox-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 26px 22px; }
.abox-actions .btn { min-width: 120px; font-size: 15px; padding: 10px 18px; }

/* cloud subscription notice on the Gateway (020) */
.bill-note { border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; font-weight: 600; max-width: 980px; }
.bill-note.warn { background: #fff4d6; border: 1px solid #f0c24b; color: #4a3500; }
.bill-note.error { background: #fde4e1; border: 1px solid #e0796b; color: #5c120a; }


/* =====================================================================
   EMIAC style — layout and components (V8 look). Later rules win over the ones above.
   ===================================================================== */
/* top bar: teal 10 % on white, 3 px teal line, logo + EMIAC SERVICES */
.topbar { background: color-mix(in srgb, var(--teal) 10%, #fff); color: var(--ink); border-bottom: 3px solid var(--teal); padding: 10px 20px; gap: 18px; }
.brand { gap: 10px; color: var(--teal); }
.brand img.logo { height: 34px; width: auto; display: block; }
.brand .brand-name { font: 700 21px/1 var(--serif); color: var(--teal); letter-spacing: .2px; }
.brand .brand-sub { font: 600 11px/1 var(--sans); color: var(--ink-soft); letter-spacing: .08em; text-transform: uppercase; margin-left: 2px; }
.tb-company { color: var(--teal); font-weight: 600; }
.tb-period, .tb-bell { background: #fff; border: 1px solid var(--border); color: var(--teal); border-radius: 8px; padding: 4px 10px; font-weight: 500; }
.tb-period:hover, .tb-bell:hover { border-color: var(--teal); }
.tb-bell.has b { background: var(--rust); color: #fff; }
.tb-user { color: var(--ink-soft); opacity: 1; }
.linkbtn { color: var(--teal); font-weight: 600; text-decoration: none; border: 1px solid var(--teal); border-radius: 8px; padding: 4px 12px; background: #fff; }
.linkbtn:hover { background: var(--green-bg); }
.tb-edu { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 3px 12px; font-size: 12px; }

/* page: 1360 px, main area and shortcut panel as white cards */
.shell { max-width: 1360px; margin: 0 auto; padding: 22px 20px; gap: 18px; grid-template-columns: minmax(0, 1fr) 210px; align-items: start; min-height: 0; }
.main { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(18, 59, 54, .06); min-height: 420px; }
.main.fade { animation: emiacFade .22s ease-out; }
@keyframes emiacFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.keys { position: sticky; top: 76px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 10px; box-shadow: 0 1px 3px rgba(18, 59, 54, .06); }
.keys::before { content: 'Shortcuts'; font: 700 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); padding: 2px 4px 6px; }
.keys button { border: 0; border-radius: 8px; padding: 7px 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); background: none; }
.keys button:hover, .keys button:focus { background: var(--teal); color: #fff; outline: none; }
.keys button:hover kbd, .keys button:focus kbd { color: #CFE3DD; }
.keys kbd { color: var(--teal); }

/* headings */
h1 { font: 600 21px/1.25 var(--serif); color: var(--teal); }
h2 { font: 600 15.5px/1.3 var(--serif); color: var(--teal); }
h3 { font-family: var(--serif); color: var(--teal); }
.sub { font-size: 13px; }
.crumbs { font-size: 12px; }
.section-title { font: 700 10.5px/1.2 var(--sans); letter-spacing: .05em; color: var(--ink-soft); margin: 20px 0 8px; }
.card { border-color: var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(18, 59, 54, .06); }

/* Gateway: menu groups as cards, active item teal */
.gateway { gap: 14px; max-width: 1040px; }
.menu { padding: 14px 12px; }
.menu h3 { font: 700 10.5px/1.2 var(--sans); letter-spacing: .05em; color: var(--ink-soft); margin: 0 4px 8px; }
.menu button { font-size: 13.5px; font-weight: 500; border-radius: 8px; padding: 7px 10px; color: var(--ink); }
.menu button:hover, .menu button:focus { background: var(--teal); color: #fff; }
.menu button:hover kbd, .menu button:focus kbd, .menu button:hover u, .menu button:focus u { color: #fff; text-decoration-color: #fff; }
.menu button u { text-decoration-color: var(--teal); }

/* forms */
label { font-size: 12px; font-weight: 500; }
input, select, textarea { padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--teal) 35%, transparent); outline-offset: 0; border-color: var(--teal); }
.btn { background: var(--teal); color: #fff; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; }
.btn:hover:not(:disabled) { background: var(--teal-soft); }
.btn.ghost { background: #fff; color: var(--teal); border: 1px solid var(--teal); }
.btn.ghost:hover:not(:disabled) { background: var(--green-bg); }
.btn.danger { background: #fff; color: var(--rust); border: 1px solid var(--rust); }
.btn.danger:hover:not(:disabled) { background: var(--rust-bg); }
details summary { color: var(--teal); }

/* messages */
.err:not(:empty) { background: var(--rust-bg); color: var(--rust); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 500; }
.msg.ok { background: var(--green-bg); color: var(--green); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 500; }
.toast { background: var(--green-bg); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); font-size: 13px; font-weight: 600; border-radius: 8px; box-shadow: 0 6px 20px rgba(18, 59, 54, .14); }
.toast.bad { background: var(--rust-bg); color: var(--rust); border-color: color-mix(in srgb, var(--rust) 35%, transparent); }
.bill-note { font-size: 12.5px; }
.bill-note.warn { background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 45%, transparent); color: var(--amber); }
.bill-note.error { background: var(--rust-bg); border-color: color-mix(in srgb, var(--rust) 45%, transparent); color: var(--rust); }
.diff { color: var(--rust); } .balanced { color: var(--green); }

/* pills */
.tag { border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--teal); }
.tag.st-pending, .tag.pos { background: var(--amber-bg); color: var(--amber); }
.tag.st-approved, .tag.act-insert { background: var(--green-bg); color: var(--green); }
.tag.st-rejected { background: #FDE8E8; color: #B42318; }
.tag.st-cancelled, .tag.act-delete { background: #EEECE6; color: var(--ink-soft); }
.tag.act-update { background: var(--blue-bg); color: var(--blue); }

/* tables */
table.rep { font-size: 13px; }
table.rep th { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--ink-soft); border-bottom: 2px solid var(--border); padding: 8px; }
table.rep td { padding: 8px; border-bottom: 1px solid var(--border); }
table.rep .num, table.rep th.num { font-family: var(--sans); font-variant-numeric: tabular-nums; width: 1%; }
table.rep tr:hover td { background: var(--hover); }
table.rep tr.nav td:first-child { text-decoration: underline dotted color-mix(in srgb, var(--teal) 45%, transparent); text-underline-offset: 3px; }
table.rep tr.nav:hover td { background: color-mix(in srgb, var(--teal) 6%, #fff); }
table.rep tr.nav:focus td { background: var(--sel); }
table.rep tr.nav:focus td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
table.rep tr.total td { border-top: 2px solid var(--ink); border-bottom: 3px double var(--ink); }
.twocol { border-color: var(--border); border-radius: 12px; }
.twocol table.rep th { background: var(--paper); }
table.lines th { font-size: 11.5px; font-weight: 700; border-bottom: 2px solid var(--border); padding: 6px 4px; }
table.lines td { border-bottom: 1px solid var(--border); }
table.lines input.amount, table.lines tfoot td, .ledbal { font-family: var(--sans); font-variant-numeric: tabular-nums; }
.vch-type { font: 600 21px/1.2 var(--serif); color: var(--teal); }
.vtypes button { border-color: var(--border); border-radius: 999px; }
.tabs button { border-color: var(--border); }
.tabs button.on { background: var(--teal); border-color: var(--teal); }

/* dashboard tiles */
.dash { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { border-color: var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(18, 59, 54, .06); }
.tile:hover, .tile:focus { border-color: var(--teal); box-shadow: 0 0 0 2px var(--accent-soft); }
.tile .tl { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; }
.tile .tv { font: 600 24px/1.2 var(--serif); color: var(--teal); }
.tile .tv.neg, .tile .tv .cr { color: var(--rust); }
.tile.warn { border-left: 4px solid var(--amber); }
.tile.bad { border-left: 4px solid var(--rust); }
.spark i { background: color-mix(in srgb, var(--teal) 55%, #fff); }
.spark div.today i { background: var(--teal); }

/* big alert box in the EMIAC colours */
.abox-icon { background: var(--rust); }
dialog.abox[data-kind="error"] { border-top-color: var(--rust); }
dialog.abox[data-kind="warn"] .abox-icon, dialog.abox[data-kind="confirm"] .abox-icon { background: var(--amber); }
dialog.abox[data-kind="warn"], dialog.abox[data-kind="confirm"] { border-top-color: var(--amber); }
dialog.abox[data-kind="info"] .abox-icon { background: var(--teal); }
.abox-body h2 { font: 600 20px/1.3 var(--serif); color: var(--teal); }
.dlg { border-color: var(--border); border-radius: 12px; }
.dlg::backdrop, dialog.abox::backdrop { background: rgba(18, 59, 54, .45); }

/* report letterhead (screen and print) — core.js adds it to every report */
.lh { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.lh-name { font: 700 24px/1.2 var(--serif); color: var(--teal); }
.lh-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.lh-range { font-size: 12px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
.lh-foot { display: none; font: 600 12px/1 var(--serif); color: var(--teal); text-align: center; margin-top: 24px; letter-spacing: .04em; }
h1 .h1r { font: 500 14px var(--sans); color: var(--ink-soft); }

@media (max-width: 860px) {
  .shell { padding: 12px 10px; }
  .main { padding: 14px 12px 70px; border-radius: 10px; }
  .keys { position: fixed; top: auto; border-radius: 0; border-width: 1px 0 0; box-shadow: 0 -2px 8px rgba(18, 59, 54, .08); }
  .keys::before { display: none; }
  .brand .brand-name { font-size: 17px; }
  .brand .brand-sub { display: none; }
  .brand span { display: inline; }
  .topbar { padding: 8px 12px; }
}
@media print {
  body { background: #fff; }
  .shell { max-width: none; padding: 0; }
  .main { border: 0; box-shadow: none; padding: 0; }
  .crumbs, .tabs, .actions, #toast, .keys, .topbar { display: none !important; }
  .lh-foot { display: block; }
  table.rep tr.nav td:first-child { text-decoration: none; }
  table.rep tr:hover td, table.rep tr.nav:focus td { background: none; }
  table.rep tr.nav:focus td:first-child { box-shadow: none; }
}
