@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --porcelain: #f4f6f5;
  --surface: #ffffff;
  --ink: #16201c;
  --ink-2: #4b5852;
  --ink-3: #7d8984;
  --grout: #dbe1de;
  --slip: #e9edeb;
  --rest: #e2e7e4;

  --glaze: #1d6a56;
  --glaze-deep: #134a3c;
  --glaze-soft: #cfe5db;
  --ochre: #b5731a;
  --ochre-soft: #f3e1c2;
  --slate: #5a6670;
  --slate-soft: #dde2e6;
  --plum: #7a4c7e;
  --plum-soft: #ead9eb;
  --cobalt: #33519a;
  --cobalt-soft: #d9e0f1;
  --away: #8c9893;
  --danger: #b0392d;
  --danger-soft: #f6dcd8;

  --radius-s: 4px;
  --radius-m: 8px;
  --radius-l: 14px;
  --shadow: 0 1px 2px rgba(22, 32, 28, .06), 0 4px 16px rgba(22, 32, 28, .04);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--porcelain);
}
a { color: var(--glaze); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--glaze-deep); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 650; }
h1 { font-size: 30px; letter-spacing: -0.015em; }
h2 { font-size: 18px; letter-spacing: -0.005em; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
small, .muted { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--glaze); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--surface);
  align-self: start;
  border-right: 1px solid var(--grout);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); padding: 0 6px; }
.brand-logo { width: 30px; height: 30px; display: block; flex: none; }
.login-form .brand-logo { width: 40px; height: 40px; }
.bands input { max-width: 140px; }
.bands td { padding-top: 6px; padding-bottom: 6px; }
.brand b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand span { color: var(--ink-3); font-weight: 500; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-m);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--porcelain); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--glaze-soft); color: var(--glaze-deep); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; font-size: 13px; color: var(--ink-3); padding: 0 6px; }
.side-foot .who { color: var(--ink); font-weight: 600; display: block; }
.side-foot form { display: inline; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--glaze); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.main { padding: 32px 40px 64px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--grout);
  border-radius: var(--radius-l);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.panel + .panel, .stack > * + * { margin-top: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel-head a { font-size: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.cols > .panel + .panel { margin-top: 0; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-m); border: 1px solid var(--grout);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--glaze); border-color: var(--glaze); color: #fff; }
.btn-primary:hover { background: var(--glaze-deep); border-color: var(--glaze-deep); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 18px; max-width: 640px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { display: block; color: var(--ink-3); font-size: 13px; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--grout); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--glaze); box-shadow: 0 0 0 3px var(--glaze-soft); }
input[type=file] { font: inherit; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 8px 0 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--glaze); margin: 0; }
.days-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.days-pick label { margin: 0; }
.days-pick input { position: absolute; opacity: 0; pointer-events: none; }
.days-pick span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 38px; border: 1px solid var(--grout); border-radius: var(--radius-m);
  font-weight: 600; cursor: pointer; color: var(--ink-2); background: var(--surface);
}
.days-pick input:checked + span { background: var(--glaze); border-color: var(--glaze); color: #fff; }
.days-pick input:focus-visible + span { outline: 2px solid var(--glaze); outline-offset: 2px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

/* type picker */
.type-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.type-pick label { margin: 0; }
.type-pick input { position: absolute; opacity: 0; pointer-events: none; }
.type-pick span {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border: 1px solid var(--grout); border-radius: var(--radius-m); font-weight: 600; cursor: pointer;
  color: var(--ink-2); background: var(--surface);
}
.type-pick input:checked + span { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.type-pick input:focus-visible + span { outline: 2px solid var(--glaze); outline-offset: 2px; }

.tally {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius-m);
  background: var(--porcelain); border: 1px solid var(--grout);
  min-height: 62px;
}
.tally strong { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.tally .warn { color: var(--danger); }

/* ---------------------------------------------------------------- flash */
.flash { padding: 12px 16px; border-radius: var(--radius-m); margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.flash.ok { background: var(--glaze-soft); border-color: #b3d6c7; color: var(--glaze-deep); }
.flash.error { background: var(--danger-soft); border-color: #ebbcb5; color: #7d241b; }
.notice { padding: 14px 16px; border-radius: var(--radius-m); background: var(--ochre-soft); color: #6c430b; }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-3); padding: 0 12px 10px; border-bottom: 1px solid var(--grout); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--slip); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table a.rowlink { color: var(--ink); text-decoration: none; font-weight: 600; }
.table a.rowlink:hover { color: var(--glaze); text-decoration: underline; }
.table-wrap { overflow-x: auto; }

.person-cell { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: var(--radius-m);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--slip); color: var(--ink-2); font-weight: 700; font-size: 13px;
}
.avatar.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 12px; }
.sub { display: block; font-size: 13px; color: var(--ink-3); font-weight: 400; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--slip); color: var(--ink-2);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.pill.holiday { background: var(--glaze-soft); color: var(--glaze-deep); }
.pill.sickness { background: var(--ochre-soft); color: #7a4a0c; }
.pill.unpaid { background: var(--slate-soft); color: #3a444c; }
.pill.compassionate { background: var(--plum-soft); color: #5b345f; }
.pill.other { background: var(--cobalt-soft); color: #253d77; }
.pill.away { background: var(--slip); color: var(--ink-2); }
.pill.plain::before { display: none; }

/* ---------------------------------------------------------------- tiles */
/* Every day is a tile. Absences are glazed tiles; half days are split on the diagonal. */
.t-holiday { --c: var(--glaze); }
.t-sickness { --c: var(--ochre); }
.t-unpaid { --c: var(--slate); }
.t-compassionate { --c: var(--plum); }
.t-other { --c: var(--cobalt); }
.t-away { --c: var(--away); }

.grid-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 6px; }
.tilegrid { display: grid; gap: 3px; align-items: center; min-width: max-content; }
.tilegrid .name {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  padding-right: 14px; font-weight: 600; font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; height: 100%; display: flex; align-items: center;
}
.tilegrid .name a { color: var(--ink); text-decoration: none; }
.tilegrid .name a:hover { color: var(--glaze); }
.tilegrid .dh { text-align: center; font-size: 11.5px; color: var(--ink-3); line-height: 1.15; padding-bottom: 4px; }
.tilegrid .dh b { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.tilegrid .dh.is-today b { color: #fff; background: var(--ink); border-radius: 4px; margin: 0 2px; }
.tilegrid .dh.is-weekend { color: #a9b3ae; }
.tilegrid .dh.is-weekend b { color: #a9b3ae; }

.tile {
  position: relative; display: block;
  width: 100%; aspect-ratio: 1; min-width: 24px;
  border-radius: var(--radius-s);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--grout);
  text-decoration: none;
}
a.tile:hover { box-shadow: inset 0 0 0 2px var(--ink-3); }
.tile.off { background: var(--rest); box-shadow: none; }
.tile.bh {
  background: repeating-linear-gradient(135deg, var(--rest) 0 3px, var(--surface) 3px 6px);
  box-shadow: inset 0 0 0 1px var(--grout);
}
.tile.gone { background: transparent; box-shadow: inset 0 0 0 1px var(--slip); }
.tile.today { box-shadow: inset 0 0 0 2px var(--ink); }
.tile.full { background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.12); }
.tile.am { background: linear-gradient(135deg, var(--c) 0 50%, var(--surface) 50% 100%); }
.tile.pm { background: linear-gradient(135deg, var(--surface) 0 50%, var(--c) 50% 100%); }
.tile.split { background: linear-gradient(135deg, var(--c) 0 50%, var(--c2) 50% 100%); }
.tile.today.full, .tile.today.am, .tile.today.pm { box-shadow: inset 0 0 0 2px var(--ink); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .tile { width: 14px; min-width: 14px; height: 14px; }

/* balance meter: one tile per day of entitlement */
.meter { display: flex; flex-wrap: wrap; gap: 2px; }
.meter i { width: 11px; height: 11px; border-radius: 2px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--grout); }
.meter i.taken { background: var(--glaze); box-shadow: none; }
.meter i.booked { background: var(--glaze-soft); box-shadow: inset 0 0 0 1px #9ccbb7; }
.meter i.half-taken { background: linear-gradient(135deg, var(--glaze) 0 50%, var(--surface) 50%); }
.meter i.half-booked { background: linear-gradient(135deg, var(--glaze-soft) 0 50%, var(--surface) 50%); box-shadow: inset 0 0 0 1px #9ccbb7; }
.meter i.over { background: var(--danger); box-shadow: none; }
.meter.lg i { width: 18px; height: 18px; border-radius: 3px; }
.meter.lg { gap: 3px; }

.bal-figure { display: flex; align-items: baseline; gap: 8px; }
.bal-figure strong { font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.bal-figure.neg strong { color: var(--danger); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0; border-top: 1px solid var(--grout); margin-top: 20px; }
.facts div { padding: 14px 0 0; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- overview */
.today-head h1 { font-size: 40px; letter-spacing: -0.025em; }
.away-list { display: grid; gap: 10px; }
.away-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-m); background: var(--porcelain); }
.away-item .grow { flex: 1; min-width: 0; }
.away-item .back { font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.empty { color: var(--ink-3); padding: 6px 0; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--slip); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .when { font-size: 13px; color: var(--ink-2); }
.list-item .days { font-weight: 650; white-space: nowrap; }

.bal-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 70px; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--slip); }
.bal-row:last-child { border-bottom: 0; }
.bal-row .left { text-align: right; font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
.bal-row .left small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0; }
.bal-row a { color: var(--ink); text-decoration: none; font-weight: 600; }
.bal-row a:hover { color: var(--glaze); }

/* ---------------------------------------------------------------- tabs, filters */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grout); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--glaze); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 18px; }
.filters select { width: auto; min-width: 150px; }
.seg { display: inline-flex; border: 1px solid var(--grout); border-radius: var(--radius-m); overflow: hidden; background: var(--surface); }
.seg a { padding: 0 14px; height: 36px; display: inline-flex; align-items: center; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.seg a + a { border-left: 1px solid var(--grout); }
.seg a[aria-current="page"] { background: var(--ink); color: #fff; }

.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav h1 { min-width: 230px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.profile-head { display: flex; gap: 18px; align-items: center; }
.password-box { font-size: 22px; font-weight: 700; letter-spacing: .01em; padding: 14px 16px; background: var(--porcelain); border: 1px dashed var(--ink-3); border-radius: var(--radius-m); user-select: all; display: inline-block; margin: 6px 0 10px; }

details.danger-zone { margin-top: 28px; border-top: 1px solid var(--grout); padding-top: 18px; }
details.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-art { background: var(--glaze-deep); position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 48px; color: #e7f1ec; }
.login-art .wall { position: absolute; inset: -10px; display: grid; grid-template-columns: repeat(auto-fill, 46px); gap: 4px; opacity: .9; }
.login-art .wall i { width: 46px; height: 46px; border-radius: 4px; background: #175544; }
.login-art .wall i.a { background: #1c6350; }
.login-art .wall i.b { background: #23705b; }
.login-art .wall i.c { background: #b5731a; }
.login-art .wall i.d { background: #cfe5db; }
.login-art p { position: relative; font-size: 15px; max-width: 360px; margin: 0; background: var(--glaze-deep); padding: 14px 16px; border-radius: var(--radius-m); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-form .inner { width: 100%; max-width: 360px; }
.login-form h1 { margin: 26px 0 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .cols, .cols-even { grid-template-columns: 1fr; }
  .cols > .panel + .panel, .cols-even > .panel + .panel { margin-top: 0; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px 16px; gap: 10px 16px; border-right: 0; border-bottom: 1px solid var(--grout); }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; }
  .nav a { padding: 7px 10px; white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; }
  .side-foot .who { display: none; }
  .side .btn-record { display: none; }
  .main { padding: 22px 16px 48px; }
  .panel { padding: 18px 16px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .bal-row { grid-template-columns: 1fr 64px; }
  .bal-row .meter { grid-column: 1 / -1; grid-row: 2; }
  .today-head h1 { font-size: 30px; }
  .hide-sm { display: none; }
  .away-item { flex-wrap: wrap; }
  .away-item .back { text-align: left; width: 100%; padding-left: 46px; }
  .month-nav h1 { min-width: 0; font-size: 24px; }
  .profile-head h1 { font-size: 24px; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .side, .page-head .actions, .filters, .tabs { display: none; }
  .shell { display: block; }
  .panel { box-shadow: none; }
}
