:root {
  --navy: #1c2e52;
  --steel: #2f5597;
  --enclosure: #e4e7e2;   /* panel-enclosure grey */
  --face: #fbfbf7;        /* meter face */
  --ink: #1b1f24;
  --muted: #5b616b;
  --line: #c9cec6;
  --green: #22a35a;
  --amber: #e3a008;
  --red: #d23b2f;
  --grey: #8a9099;
  --bezel: #2a2e35;
  --c-cl: #2a78d6;        /* chart series: CL */
  --c-sl: #eb6834;        /* chart series: SL */
  --font: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--enclosure);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--steel); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.boot { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- top bar */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
}
.topbar-row { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.nameplate { font-family: var(--font-cond); font-weight: 700; font-size: 1.2rem; letter-spacing: .02em; }
.nameplate small { display: block; font-family: var(--font); font-weight: 400; font-size: .78rem; opacity: .75; letter-spacing: 0; }
.topbar .who { margin-left: auto; text-align: right; font-size: .85rem; opacity: .9; }
.topbar .who button { background: none; border: 0; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; padding: 0; }
nav.tabs { max-width: 980px; margin: 10px auto 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  color: #cfd8ea; text-decoration: none; white-space: nowrap;
  padding: 9px 12px 10px; font-weight: 500; font-size: .93rem;
  border-bottom: 3px solid transparent;
}
nav.tabs a[aria-current="page"] { color: #fff; border-bottom-color: var(--amber); }
nav.tabs .sep { width: 1px; background: rgba(255,255,255,.2); margin: 8px 6px; flex: none; }
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: 4px; border-radius: 9px; background: var(--amber); color: var(--ink); font-size: .75rem; font-weight: 600; text-align: center; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
h1 { font-family: var(--font-cond); font-weight: 600; font-size: 1.7rem; line-height: 1.15; margin: 0 0 4px; }
h2 { font-family: var(--font-cond); font-weight: 600; font-size: 1.25rem; margin: 28px 0 10px; }
.lede { color: var(--muted); margin: 0 0 18px; max-width: 62ch; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spacer { flex: 1; }

/* ---------- panel surfaces */
.plate {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 16px;
}
.plate + .plate { margin-top: 12px; }

/* ---------- leave meters (the one bold element) */
.meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.meter { background: var(--bezel); padding: 9px; border-radius: 4px; box-shadow: inset 0 0 0 1px #4a505a; }
.meter-face { background: var(--face); border-radius: 2px; padding: 8px 10px 12px; text-align: center; }
.meter svg { width: 100%; height: auto; display: block; }
.meter .needle { transform-origin: 100px 112px; transition: transform 1.1s cubic-bezier(.3,1.4,.5,1); }
.meter-num { font-family: var(--font-cond); font-weight: 700; font-size: 2.4rem; line-height: 1; margin-top: -6px; }
.meter-num span { font-family: var(--font); font-weight: 500; font-size: .95rem; color: var(--muted); }
.meter-sub { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.meter-sub b { color: var(--ink); font-weight: 600; }
@media (max-width: 420px) {
  .meters { gap: 8px; }
  .meter { padding: 6px; }
  .meter-num { font-size: 1.9rem; }
  .meter-sub { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) { .meter .needle { transition: none; } }

/* ---------- status lamps */
.lamp { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; }
.lamp::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--grey); box-shadow: inset 0 -2px 2px rgba(0,0,0,.25), 0 0 0 2px rgba(0,0,0,.08); }
.lamp.pending::before { background: var(--amber); }
.lamp.approved::before { background: var(--green); }
.lamp.rejected::before { background: var(--red); }
.lamp.cancelled { color: var(--muted); }
.lamp.revoked::before { background: var(--red); }

/* ---------- lists */
.list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.list li { padding: 12px 14px; border-top: 1px solid #e3e6e0; display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; align-items: start; }
.list li:first-child { border-top: 0; }
.list .type { font-family: var(--font-cond); font-weight: 700; font-size: 1.05rem; color: var(--navy); border: 2px solid var(--navy); border-radius: 3px; text-align: center; padding: 1px 0; }
.list .type.SL { color: #7a4b00; border-color: #b07a12; }
.list .main b { font-weight: 600; }
.list .meta { color: var(--muted); font-size: .85rem; }
.list .side { text-align: right; display: grid; gap: 6px; justify-items: end; }
.list .actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.empty { padding: 22px 16px; text-align: center; color: var(--muted); }

/* ---------- forms */
label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid #b9bfb6; border-radius: 3px; padding: 9px 10px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--steel); outline: none; box-shadow: 0 0 0 3px rgba(47,85,151,.18); }
textarea { min-height: 84px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice label { margin: 0; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .opt { display: block; border: 2px solid #b9bfb6; border-radius: 3px; padding: 10px 12px; background: #fff; }
.choice .opt b { font-family: var(--font-cond); font-size: 1.15rem; display: block; }
.choice .opt span { font-size: .84rem; color: var(--muted); font-weight: 400; }
.choice input:checked + .opt { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: #f2f5fb; }
.choice input:focus-visible + .opt { outline: 3px solid var(--amber); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: 20px; height: 20px; }

.preview { border-left: 4px solid var(--steel); background: #f2f5fb; padding: 10px 12px; margin: 4px 0 16px; font-size: .95rem; }
.preview.warn { border-left-color: var(--red); background: #fcefed; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px;
  border: 2px solid var(--navy); border-radius: 3px; background: var(--navy); color: #fff;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #24396a; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #f2f5fb; }
.btn.approve { background: var(--green); border-color: var(--green); }
.btn.reject { background: #fff; color: var(--red); border-color: var(--red); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--steel); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- messages */
.flash { padding: 11px 14px; border-radius: 3px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #e8f5ec; border-color: #9fd2b2; color: #155c33; }
.flash.error { background: #fcefed; border-color: #ecb0a9; color: #8c241b; }
.error { color: #8c241b; }

/* ---------- tables */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #e3e6e0; white-space: nowrap; }
th { background: var(--navy); color: #fff; font-weight: 600; font-size: .85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; background: #eef0ec; }
tr.inactive td { color: var(--grey); }

/* ---------- sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.auth .card header { background: var(--navy); color: #fff; padding: 18px 20px; }
.auth .card header .nameplate { font-size: 1.35rem; }
.auth .card form { padding: 20px; }
.auth .btn { width: 100%; }

.segmented { display: inline-flex; border: 2px solid var(--navy); border-radius: 3px; overflow: hidden; }
.segmented a { padding: 6px 12px; text-decoration: none; color: var(--navy); font-weight: 500; font-size: .9rem; }
.segmented a[aria-current="true"] { background: var(--navy); color: #fff; }
.yearsel { width: auto; min-height: 38px; padding: 4px 8px; }

/* ---------- fixes */
[hidden] { display: none !important; }
figure.meter { margin: 0; }
@media (max-width: 560px) {
  .list li { grid-template-columns: 48px 1fr; }
  .list .side { grid-column: 2; justify-items: start; text-align: left; }
}

/* ---------- salary slip */
.slips li { display: block; padding: 0; }
.slip-link { display: flex; justify-content: space-between; padding: 14px; text-decoration: none; color: var(--ink); }
.slip-link:hover { background: #f2f5fb; }
.slip-link .num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.slip { background: #fff; border: 1px solid var(--line); border-radius: 3px; margin-top: 14px; overflow: hidden; }
.slip-head { background: var(--navy); color: #fff; padding: 16px 18px 12px; text-align: center; }
.slip-co { font-family: var(--font-cond); font-weight: 700; font-size: 1.5rem; }
.slip-addr { font-size: .78rem; opacity: .85; margin-top: 2px; }
.slip-title { background: #dce6f1; color: var(--navy); font-family: var(--font-cond); font-weight: 600; font-size: 1.15rem; text-align: center; padding: 8px; }
.slip-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--line); }
.slip-info div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 18px; border-top: 1px solid #e3e6e0; }
.slip-info div:nth-child(odd) { border-right: 1px solid #e3e6e0; }
.slip-info dt { color: var(--muted); font-size: .88rem; }
.slip-info dd { margin: 0; font-weight: 600; text-align: right; }
@media (max-width: 560px) { .slip-info { grid-template-columns: 1fr; } .slip-info div:nth-child(odd) { border-right: 0; } }
.slip-table { width: 100%; }
.slip-table th, .slip-table td { white-space: normal; }
.slip-table td.calc, .slip-table th.calc { color: var(--muted); font-size: .85rem; text-align: center; }
.slip-table th.calc { color: #fff; }
.slip-table tr.sub td { font-weight: 600; background: #f3f7fc; }
.slip-table tfoot td { background: var(--navy); color: #fff; font-size: 1.1rem; font-weight: 700; }
.slip-note { font-size: .8rem; color: var(--muted); padding: 0 18px; margin: 10px 0; font-style: italic; }
input[type=file] { font: inherit; margin: 6px 0; max-width: 100%; }
input[type=month] { width: 100%; font: inherit; border: 2px solid #b9bfb6; border-radius: 3px; padding: 9px 10px; min-height: 44px; }

/* ---------- owner's dashboard */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--steel); }
.tile .tl { font-size: .85rem; color: var(--muted); }
.tile b { font-family: var(--font-cond); font-weight: 700; font-size: 2rem; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.tile b.money { font-size: 1.5rem; padding: 4px 0 3px; }
.tile .ts { font-size: .82rem; color: var(--muted); }
.tile.alert { border-left: 5px solid var(--amber); }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.cols2 .list li { grid-template-columns: 44px 1fr auto; }
.cols2 .list .type { font-size: .9rem; }
.side .hint { margin: 0; }
h3.ch { font-family: var(--font-cond); font-weight: 600; font-size: 1.05rem; margin: 0 0 6px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols2 { grid-template-columns: 1fr; } }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(108px, 1fr); gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.strip .day { background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 8px; min-height: 92px; font-size: .85rem; }
.strip .day.today { border: 2px solid var(--navy); }
.strip .day.closed { background: #f0f1ee; color: var(--muted); }
.strip .dh { display: flex; justify-content: space-between; gap: 4px; }
.strip .dh span { color: var(--muted); }
.strip .dn { margin: 4px 0; color: var(--muted); }
.strip .dn b { font-family: var(--font-cond); font-size: 1.4rem; color: var(--navy); margin-right: 2px; }
.strip .dp { display: block; font-size: .78rem; color: #8a5a00; }
.strip .dc { margin-top: 6px; font-style: italic; }
.strip ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }
.strip li { padding: 2px 6px; border-radius: 3px; line-height: 1.25; overflow-wrap: anywhere; }
.strip li span { color: var(--muted); font-size: .75rem; }
.strip li.ok { background: #e6f5ec; border-left: 3px solid var(--green); }
.strip li.wait { background: #fdf4dc; border-left: 3px dashed var(--amber); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: #e6e8e3; stroke-width: 1; }
.chart .gl.base { stroke: #9aa09a; }
.chart .ax { font: 11px var(--font); fill: var(--muted); }
.chart .hit { fill: transparent; }
.chart .mcol { cursor: default; outline: none; }
.chart .mcol.on .hit, .chart .mcol:focus-visible .hit { fill: rgba(28, 46, 82, .06); }
.legend { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.legend i, .chart .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart .tip { position: absolute; top: 24px; min-width: 150px; background: #fff; border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 8px 10px; font-size: .85rem; pointer-events: none; }
.chart .tip div { display: flex; align-items: center; gap: 2px; }
.chart .tip span { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart .tip .tt { border-top: 1px solid #e3e6e0; margin-top: 4px; padding-top: 4px; }

.bypeople td, .bypeople th { vertical-align: middle; }
.usecell { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini { display: inline-block; width: 72px; height: 8px; background: #eceee9; border-radius: 4px; overflow: hidden; flex: none; }
.mini i { display: block; height: 100%; border-radius: 4px; }
.mini i.cl { background: var(--c-cl); }
.mini i.sl { background: var(--c-sl); }

@media print {
  /* Zero page margin stops the browser printing its own date/title/URL header and footer. */
  @page { size: A4; margin: 0; }
  body { background: #fff; padding: 12mm; }
  .topbar, .noprint, .flash { display: none !important; }
  main { padding: 0; max-width: none; }
  .slip { border: 1px solid #999; margin: 0; }
  .slip-head, .slip-title, .slip-table th, .slip-table tfoot td, .slip-table tr.sub td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

td select { min-width: 180px; min-height: 38px; padding: 4px 8px; }
