:root {
  --brand: #1F4E5F; --accent: #E0A526;
  --ink: #15252B; --ink-2: #4A5A60; --ink-3: #7B888D;
  --paper: #F3F5F4; --surface: #FFFFFF; --line: #DCE2E0; --line-2: #EBEFEE;
  --ok: #2E7D4F; --ok-bg: #E6F2EA; --warn: #9A6400; --warn-bg: #FBF1DC; --err: #B3261E; --err-bg: #FBE9E7; --info: #2A5F8A; --info-bg: #E6EEF6;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--paper); font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 0 0 .5rem; font-weight: 650; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); } .small { font-size: .85rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--brand); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
.brand img { max-height: 34px; max-width: 120px; background: #fff; border-radius: 4px; padding: 2px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 700; }
.brand b { display: block; font-size: 1rem; line-height: 1.2; }
.brand span { font-size: .75rem; opacity: .75; }
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: .78rem; opacity: .6; }
.nav a { display: flex; justify-content: space-between; align-items: center; color: #fff; text-decoration: none; padding: 7px 10px; border-radius: var(--r); opacity: .88; font-size: .93rem; border-left: 3px solid transparent; }
.nav a:hover { background: rgba(255,255,255,.08); opacity: 1; }
.nav a.on { background: rgba(255,255,255,.14); opacity: 1; border-left-color: var(--accent); font-weight: 600; }
.pill-count { background: var(--accent); color: var(--ink); font-size: .72rem; font-weight: 700; border-radius: 10px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; font-size: .82rem; border-top: 1px solid rgba(255,255,255,.15); }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: var(--r); padding: 5px 10px; cursor: pointer; margin-top: 8px; }
.main { padding: 28px 36px 60px; max-width: 1320px; width: 100%; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; }
.btn.menu-btn { display: none; }

/* surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2, .panel.flush > .panel-head { padding: 16px 20px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid > *, .split > *, .panel { min-width: 0; } /* wide tables scroll inside their panel instead of widening the page */
.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)); }
.stat { border-top: 3px solid var(--brand); background: var(--surface); padding: 14px 16px; border-radius: 0 0 var(--r) var(--r); border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat .v { font-size: 1.55rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.stat .l { color: var(--ink-2); font-size: .85rem; }
.ledger-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); gap: 12px; }
.ledger-row:last-child { border-bottom: 0; }

/* tables */
.tbl-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFBFB; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #F7FAF9; }
tfoot td { font-weight: 700; border-top: 2px solid var(--ink); background: #FAFBFB; }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: var(--r); cursor: pointer; font-weight: 550; font-size: .9rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--err); border-color: #E7B7B2; }
.btn.ok { color: var(--ok); border-color: #B4D6C1; }
.btn.sm { padding: 4px 9px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .78rem; color: var(--ink-3); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], input[type=color], select, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 7px 10px; width: 100%; min-height: 36px; }
input[type=color] { padding: 2px; width: 60px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-grid .span2 { grid-column: span 2; } .form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 150px; }

/* tags */
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.ok, .tag.active, .tag.approved, .tag.paid, .tag.closed { background: var(--ok-bg); color: var(--ok); }
.tag.warn, .tag.pending, .tag.submitted, .tag.probation { background: var(--warn-bg); color: var(--warn); }
.tag.err, .tag.rejected, .tag.error, .tag.terminated { background: var(--err-bg); color: var(--err); }
.tag.info, .tag.computed { background: var(--info-bg); color: var(--info); }
.notice { border-left: 3px solid var(--info); background: var(--info-bg); padding: 10px 14px; border-radius: 0 var(--r) var(--r) 0; margin-bottom: 14px; font-size: .9rem; }
.notice.warn { border-color: var(--warn); background: var(--warn-bg); } .notice.err { border-color: var(--err); background: var(--err-bg); }

/* run workflow track */
.track { display: flex; gap: 0; margin: 6px 0 18px; flex-wrap: wrap; }
.track div { flex: 1; min-width: 110px; padding: 8px 12px; border-top: 3px solid var(--line); color: var(--ink-3); font-size: .85rem; }
.track div.done { border-color: var(--brand); color: var(--ink); }
.track div.now { border-color: var(--accent); color: var(--ink); font-weight: 650; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 650; }

/* modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(21,37,43,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 8px; width: min(760px, 100%); max-height: 92vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: min(1040px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.x { background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--ink-3); line-height: 1; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(30px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r); opacity: 0; transition: .2s; z-index: 60; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--err); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--brand); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-family: var(--serif); font-weight: 500; font-size: 2.6rem; line-height: 1.1; max-width: 12ch; }
.login-art .stub { position: absolute; right: -40px; bottom: 80px; width: 330px; background: #fff; color: var(--ink); padding: 18px 22px; border-radius: 6px; transform: rotate(-4deg); box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.login-art .stub::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; border-top: 3px dotted var(--line); }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: min(360px, 100%); display: grid; gap: 14px; }

/* payslip — the signature element */
.slip { background: #fff; max-width: 860px; margin: 0 auto; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 1px 0 var(--line); }
.slip-head { display: flex; justify-content: space-between; gap: 20px; padding: 24px 28px 18px; border-bottom: 2px solid var(--brand); }
.slip-head .org { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.slip-head img { max-height: 48px; max-width: 160px; }
.slip-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 20px; padding: 16px 28px; background: #FAFBFB; border-bottom: 1px solid var(--line-2); font-size: .86rem; }
.slip-meta dt { color: var(--ink-3); font-size: .76rem; } .slip-meta dd { margin: 0; font-weight: 600; }
.slip-cols { display: grid; grid-template-columns: 1fr 1fr; }
.slip-cols > div { padding: 16px 28px; }
.slip-cols > div + div { border-left: 1px solid var(--line-2); }
.slip-cols h3 { font-size: .85rem; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.slip-line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: .9rem; }
.slip-line.total { border-top: 1px solid var(--ink); margin-top: 6px; padding-top: 7px; font-weight: 700; }
.slip-stub { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 20px 28px; border-top: 2px dashed var(--line); position: relative; }
.slip-stub::before, .slip-stub::after { content: ''; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); border: 1px solid var(--line); }
.slip-stub::before { left: -11px; } .slip-stub::after { right: -11px; }
.slip-net { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; line-height: 1; color: var(--brand); }
.slip-ytd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px 28px; background: #FAFBFB; border-top: 1px solid var(--line-2); font-size: .85rem; }
.slip-foot { padding: 12px 28px 18px; font-size: .78rem; color: var(--ink-3); }
.slip-extra { padding: 0 28px 14px; font-size: .82rem; }

.bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--brand); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
textarea.code { min-height: 420px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; margin-bottom: 12px; }
  .main { padding: 18px 16px 50px; }
  .stat .v { font-size: 1.15rem; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2, .split { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .slip-meta, .slip-ytd { grid-template-columns: repeat(2, 1fr); } .slip-cols { grid-template-columns: 1fr; } .slip-cols > div + div { border-left: 0; border-top: 1px solid var(--line-2); }
  .form-grid .span2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  body { background: #fff; } .side, .page-head .row, .no-print, .menu-btn, #toast { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; }
  .slip { border: 0; box-shadow: none; max-width: none; } .slip-stub::before, .slip-stub::after { display: none; }
  .panel { border: 0; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
