:root {
  /* --brand and --brand-dark come from the deployment's brand settings at start. */
  --brand: #1d4fd8;
  --brand-dark: #14308a;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, var(--surface));
  --side: #0f172a;
  --side-ink: #cbd5e1;
  --ink: #0f1728;
  --ink-2: #344054;
  --muted: #5b6676;
  --caption: #7b8696;
  --line: #e3e8ef;
  --line-strong: #cdd5df;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --subtle: #f8fafc;
  --track: #eef1f6;
  --line-soft: #eef1f5;
  --info: #1e40af;
  --info-bg: #eff4ff;
  --violet: #5925dc;
  --violet-bg: #f4f3ff;
  --good-line: #abefc6;
  --bad-line: #fecdca;
  --code-bg: #101828;
  --shadow: rgba(16, 24, 40, 0.05);
  color-scheme: light;
  --good: #067647;
  --good-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  /* Chart colours: work, break, idle. Checked as a set for colour-blind separation. */
  --c-work: #2a78d6;
  --c-break: #eb6834;
  --c-idle: #c0399c;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Noto Sans', sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); -webkit-font-smoothing: antialiased; }
h1 { font-size: 24px; line-height: 32px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; line-height: 24px; margin: 0; }
h2 small { display: inline; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--track); color: var(--ink-2); font-weight: 600; }
h3 { font-size: 13px; line-height: 18px; margin: 0 0 8px; color: var(--ink-2); }
h3 small { display: inline; margin-left: 6px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); font-size: 13px; }
.red { color: var(--bad); font-weight: 700; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-weight: 800; font-size: 13px; }
.mark.light { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; background: var(--surface); color: var(--brand); }
.avatar { flex: none; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06); }
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--subtle); color: var(--ink); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select { font: inherit; color: var(--ink); height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.alert { padding: 12px 14px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-line); }

/* Sign in */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.art { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 14px; color: #fff; background: radial-gradient(800px 480px at 110% -10%, color-mix(in srgb, var(--brand) 55%, white), transparent 60%), linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.art h2 { font-size: 36px; line-height: 44px; letter-spacing: -0.02em; margin-top: 12px; }
.art p { font-size: 16px; line-height: 24px; max-width: 440px; color: rgba(255, 255, 255, 0.86); }
.art ul { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.art li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; max-width: 420px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.2); }
.sheet { align-self: center; justify-self: center; width: min(400px, 100%); padding: 32px 24px; display: flex; flex-direction: column; gap: 16px; }
.sheet .btn, .sheet input { height: 44px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; position: sticky; top: 0; height: 100vh; padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--side); color: var(--side-ink); }
.brandrow { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-size: 16px; color: #fff; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .navbtn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px; border: 0; border-radius: 9px; background: none; color: var(--side-ink); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.side nav a:hover, .navbtn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 6px 14px -6px var(--brand); }
.sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.who { display: flex; align-items: center; gap: 10px; margin: 6px 0; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.who b { display: block; color: #fff; }
.who small { color: #94a3b8; }
.main { flex: 1; min-width: 0; padding: 26px 32px 56px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.card > .btn { align-self: flex-start; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cardhead.plain { margin-bottom: -4px; }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.two { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); align-items: start; }
.grid > .btn { align-self: end; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.datebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.datebar .btn { width: 40px; padding: 0; font-size: 18px; }

/* Number tiles */
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.kpi { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { display: block; font-size: 22px; line-height: 30px; font-variant-numeric: tabular-nums; }
.kpi small { min-height: 16px; }
.kicon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--track); color: var(--ink-2) !important; }
.kicon.brand { background: var(--brand-soft); color: var(--brand) !important; }
.kicon.good { background: var(--good-bg); color: var(--good) !important; }
.kicon.warn { background: var(--warn-bg); color: var(--warn) !important; }
.kicon.bad { background: var(--bad-bg); color: var(--bad) !important; }
.kicon.idle { background: color-mix(in srgb, var(--c-idle) 12%, white); color: var(--c-idle) !important; }
.ring text { font-size: 11px; font-weight: 700; fill: var(--ink-2); }
.kpi.big .ring text { font-size: 15px; }

/* Chips, search, toggle */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--subtle); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 700; }
.search { position: relative; display: flex; align-items: center; color: var(--caption); }
.search svg { position: absolute; left: 12px; pointer-events: none; }
.search input { width: 200px; height: 36px; padding-left: 34px; }
.toggle { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--track); }
.toggle button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.toggle button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--track); color: var(--ink-2); white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* Day timeline */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.s-work { background: var(--c-work); }
.s-break { background: var(--c-break); }
.s-idle { background: var(--c-idle); }
.s-idlework { background: repeating-linear-gradient(135deg, var(--c-idle) 0 2px, var(--surface) 2px 5px); border: 1px solid var(--c-idle); }
.tl { display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: 210px minmax(0, 1fr) 92px 44px; align-items: center; column-gap: 16px; padding: 10px 8px; border-radius: 10px; color: var(--ink); border-top: 1px solid var(--line-soft); }
.trow.head { border-top: 0; padding-bottom: 2px; }
a.trow:hover { background: var(--subtle); }
.tperson { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tperson b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tperson small { margin-top: 2px; }
.tnum { text-align: right; font-variant-numeric: tabular-nums; }
.axis { position: relative; height: 18px; font-size: 11px; color: var(--caption); }
.axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }
.track { position: relative; height: 22px; border-radius: 6px; background: var(--track); overflow: hidden; }
.track.tall { height: 44px; border-radius: 8px; }
.track u { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(15, 23, 40, 0.07); }
.seg { position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 3px; box-shadow: 0 0 0 1px var(--surface); }
.seg.s-idle, .seg.s-idlework { top: 25%; bottom: 25%; z-index: 1; }
.seg:hover { filter: brightness(1.12); }
.track .now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); z-index: 2; }
.tl.single { gap: 6px; }
.tip { position: fixed; z-index: 60; max-width: 320px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; line-height: 16px; pointer-events: none; box-shadow: 0 8px 20px -6px rgba(16, 24, 40, 0.4); }
.tip[hidden] { display: none; }

/* Tables */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; height: 44px; padding: 0 14px; background: var(--subtle); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--subtle); }
td select { height: 34px; }
.cellperson { display: flex; align-items: center; gap: 10px; }
td.rowacts { text-align: right; white-space: nowrap; }
.more { position: relative; display: inline-block; }
.more summary { list-style: none; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more > div { position: fixed; z-index: 20; min-width: 250px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 28px -8px rgba(16, 24, 40, 0.25); }
.more > div button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; text-align: left; color: var(--ink); cursor: pointer; }
.more > div button:hover { background: var(--line-soft); }
.hbar { height: 6px; width: 140px; margin-bottom: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 3px; background: var(--c-work); }

/* Bar chart */
.bchart { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 6px; height: 240px; padding-bottom: 22px; }
.byaxis { position: relative; font-size: 11px; color: var(--caption); }
.byaxis span { position: absolute; right: 2px; transform: translateY(50%); }
.bplot { position: relative; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.bplot u { position: absolute; left: 0; right: 0; height: 1px; background: var(--line-soft); }
.bcol { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; z-index: 1; }
.bcol i { display: block; width: min(34px, 62%); min-height: 0; border-radius: 4px 4px 0 0; background: var(--c-work); }
.bcol:hover i { filter: brightness(1.12); }
.bcol:hover { background: rgba(15, 23, 40, 0.03); }
.bcol span { position: absolute; top: 100%; margin-top: 5px; font-size: 11px; color: var(--caption); white-space: nowrap; }

/* Activity list and screenshots */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; column-gap: 10px; align-items: start; }
.timeline .dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--c-work); }
.timeline .break .dot { background: var(--c-break); }
.timeline .idle .dot { background: var(--c-idle); }
.timeline .idlework .dot { background: var(--surface); border: 2px solid var(--c-idle); }
.timeline span:last-child { grid-column: 2; color: var(--muted); font-size: 13px; }
.hour + .hour { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.shots { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.shot { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; color: var(--muted); text-align: left; cursor: zoom-in; }
.ph { display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: var(--track); border: 1px solid var(--line); transition: box-shadow 0.12s, transform 0.12s; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot:hover .ph { border-color: var(--brand); box-shadow: 0 8px 18px -8px rgba(16, 24, 40, 0.35); transform: translateY(-2px); }
.cap { display: flex; align-items: center; gap: 6px; }
.cap b { color: var(--ink); }
.cap i, .cap em { font-style: normal; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--track); color: var(--ink-2); }
.cap em { background: color-mix(in srgb, var(--c-idle) 12%, white); color: var(--c-idle); }
.viewer { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 40, 0.82); }
.viewer[hidden] { display: none; }
.viewer figure { margin: 0; max-width: min(1200px, 100%); background: var(--surface); border-radius: 14px; overflow: hidden; }
.viewer img { display: block; max-width: 100%; max-height: 78vh; }
.viewer figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; font-weight: 600; }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 18px; max-width: 980px; }
.sechead { display: flex; align-items: center; gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: relative; width: 44px; height: 24px; flex: none; border-radius: 999px; background: var(--line-strong); transition: background 0.15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3); transition: transform 0.15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.savebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.empty { padding: 30px 8px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--muted); }
.empty span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--track); color: var(--caption); }
.loading { padding: 60px; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--good); box-shadow: 0 16px 32px -8px rgba(16, 24, 40, 0.2); font-weight: 600; }
.toast.error { border-left-color: var(--bad); }

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .art { padding: 28px 24px; }
  .art h2 { font-size: 26px; line-height: 34px; }
  .art ul { display: none; }
  .shell { flex-direction: column; }
  .side { position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brandrow { padding: 0 8px 0 0; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side nav a span { display: none; }
  .side nav a, .navbtn { width: auto; }
  .sidefoot { margin: 0; flex-direction: row; }
  .who, .navbtn span { display: none; }
  .main { padding: 18px 16px 40px; }
  .two { grid-template-columns: 1fr; }
  .trow { grid-template-columns: minmax(0, 1fr) 80px 44px; row-gap: 8px; }
  .trow .track, .trow .axis { grid-column: 1 / -1; grid-row: 2; }
  .trow.head { display: none; }
  .search input { width: 150px; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .ph, .switch span, .switch span::after { transition: none; } }

/* Activity by hour: bars sit from the left, a fixed slot per hour */
.bplot.left { justify-content: flex-start; }
.bcol.act i { max-width: 34px; }
.tnum small { display: block; white-space: nowrap; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; margin: 4px 0 18px; }
.figs div { padding: 10px 12px; border-radius: 12px; background: var(--subtle); border: 1px solid var(--line); }
.figs span { display: block; font-size: 12px; color: var(--muted); }
.figs b { font-size: 20px; line-height: 28px; font-variant-numeric: tabular-nums; }
.upbar { position: relative; height: 26px; margin-top: 14px; border-radius: 8px; background: var(--track); overflow: hidden; }
.upbar i { position: absolute; inset: 0 auto 0 0; background: var(--brand); opacity: 0.25; transition: width 0.2s; }
.upbar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 26px; font-variant-numeric: tabular-nums; }
a.navbtn { text-decoration: none; box-sizing: border-box; }
.textlink { display: block; margin-top: 14px; text-align: center; font-size: 14px; font-weight: 600; color: var(--brand); text-decoration: none; }
.textlink:hover { text-decoration: underline; }
.alert.good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }

/* Apps and websites */
:root { --r-productive: #2a78d6; --r-unproductive: #eb6834; --r-neutral: #98a2b3; }
.r-productive { background: var(--r-productive); }
.r-unproductive { background: var(--r-unproductive); }
.r-neutral { background: var(--r-neutral); }
.rbar { display: flex; gap: 2px; height: 14px; margin: 6px 0 10px; border-radius: 7px; overflow: hidden; }
.rbar i { display: block; height: 100%; min-width: 3px; }
.applist { display: flex; flex-direction: column; margin-top: 14px; }
.aline { display: grid; grid-template-columns: minmax(140px, 240px) minmax(60px, 1fr) 76px 190px; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.aname { min-width: 0; }
.aname b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.aname small { color: var(--caption); font-size: 12px; }
.abar { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.abar i { display: block; height: 100%; border-radius: 5px; }
.atime { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.aline select { width: 100%; height: 34px; }
.rtag { justify-self: start; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rtag.r-productive { background: var(--info-bg); color: var(--info); }
.rtag.r-unproductive { background: var(--warn-bg); color: var(--warn); }
.rtag.r-neutral { background: var(--line-soft); color: var(--muted); }
@media (max-width: 980px) {
  .aline { grid-template-columns: minmax(0, 1fr) 70px; }
  .aline .abar { grid-column: 1 / -1; grid-row: 2; }
  .aline select, .aline .rtag { grid-column: 1 / -1; }
}

/* Time requests */
.req { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.req:first-of-type { border-top: 0; }
.reqmain { min-width: 0; }
.reqmain b { display: block; }
.reqmain span { font-size: 14px; font-variant-numeric: tabular-nums; }
.reqmain p { margin: 4px 0 0; color: var(--ink-2, var(--ink-2)); }
.reqmain small { display: block; margin-top: 4px; color: var(--muted); }
.reqside { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.field.wide { grid-column: span 2; }
.side nav a .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #f04438; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
/* Time added by hand is drawn as work with a dashed outline */
.seg.s-manual { outline: 2px dashed #14308a; outline-offset: -2px; }
@media (max-width: 980px) { .req { flex-direction: column; } .reqside { justify-content: flex-start; } .field.wide { grid-column: auto; } }
.legend i.s-manual { outline: 1.5px dashed #14308a; outline-offset: -1.5px; }

/* Projects */
.proj { border-top: 1px solid var(--line-soft); }
.proj:first-of-type { border-top: 0; }
.proj summary { display: grid; grid-template-columns: minmax(140px, 280px) minmax(60px, 1fr) 76px 90px; align-items: center; gap: 14px; padding: 12px 4px; cursor: pointer; list-style: none; border-radius: 8px; }
.proj summary::-webkit-details-marker { display: none; }
.proj summary:hover { background: var(--subtle); }
.pname { min-width: 0; }
.pname b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { color: var(--caption); font-size: 12px; }
.pbody { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 6px 4px 18px; }
.pbody h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.plist { list-style: none; margin: 0 0 12px; padding: 0; }
.plist li { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.plist li:first-child { border-top: 0; }
.plist li b { text-align: right; font-variant-numeric: tabular-nums; }
.plist li.done span { color: var(--muted); text-decoration: line-through; }
form.inline { display: flex; gap: 8px; margin-bottom: 12px; }
form.inline input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
.switch.gridwide { grid-column: 1 / -1; }
@media (max-width: 980px) {
  .proj summary { grid-template-columns: minmax(0, 1fr) 70px; }
  .proj summary .abar { grid-column: 1 / -1; grid-row: 2; }
  .pbody { grid-template-columns: 1fr; }
}

/* Shifts */
.daybox { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.daybox label { position: relative; cursor: pointer; }
.daybox input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.daybox span { display: block; min-width: 48px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 9px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); }
.daybox input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.daybox input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.tperson small .badge + .badge, td .badge + .badge { margin-left: 4px; }
.dlg { width: min(520px, calc(100vw - 32px)); padding: 22px; border: 0; border-radius: 16px; box-shadow: 0 24px 60px -12px rgba(16, 24, 40, 0.4); color: var(--ink); }
.dlg::backdrop { background: rgba(15, 23, 40, 0.5); }
.dlg h2 { margin: 0 0 6px; }
.dlg form { display: flex; flex-direction: column; gap: 14px; }
.dlgacts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.kicon.warn { background: var(--warn-bg); color: var(--warn); }
/* The day chips in the dialog apply only when "Different working days" is on */
.dlg .switch:has(input:not(:checked)) + .daybox { opacity: 0.45; pointer-events: none; }

/* Leave and holidays */
.plist li .hdate { min-width: 110px; font-weight: 500; white-space: nowrap; }
.plist li:has(.hdate) { grid-template-columns: minmax(0, 1fr) auto auto; }
.plist li.past span, .plist li.past .hdate { color: var(--muted); }
form.inline input[type=date] { flex: 0 0 150px; }

.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger[data-armed='1'] { background: var(--bad); border-color: var(--bad); color: #fff; }

/* Alerts */
a.alertrow { color: inherit; text-decoration: none; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
a.alertrow:hover { background: var(--subtle); }
a.alertrow.fresh { background: var(--warn-bg); }
.kicon.bad { background: var(--bad-bg); color: var(--bad); }

/* Timesheets */
table.weeksheet .dcell { text-align: center; min-width: 58px; padding-left: 6px; padding-right: 6px; font-variant-numeric: tabular-nums; }
table.weeksheet th.dcell small { display: block; font-weight: 400; color: var(--caption); }
table.weeksheet td.dcell.off { background: var(--subtle); }
table.weeksheet td.dcell b.short { color: var(--bad); }
table.weeksheet td small { display: block; color: var(--muted); font-size: 12px; }
.dtag { display: block; font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); }
.dtag.bad { color: var(--bad); }
table.weeksheet td.rowacts .btn { margin-left: 4px; }

/* Printing (and "Save as PDF" from the print dialog): the page without the menu, buttons or filters */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: var(--surface); }
  .side, .actions, .toasts, #toasts, .tip, .chips, .filters, .datebar .btn, .rowacts, form, .tools { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid var(--line-strong); break-inside: avoid; }
  .scroll { overflow: visible; border: 0; }
  table { font-size: 11px; }
  th, td { padding: 4px 6px !important; }
  .kpis { grid-template-columns: repeat(5, 1fr); }
  .kpi { box-shadow: none; padding: 8px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Attendance register: a letter in every cell, colour as a second cue */
table.register { border-collapse: separate; border-spacing: 0; }
table.register th, table.register td { padding: 6px 2px; text-align: center; font-size: 12px; }
table.register .aperson, table.register th:first-child { text-align: left; padding-left: 12px; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.register th.am { min-width: 22px; font-weight: 600; }
table.register th.am small { display: block; font-weight: 400; color: var(--caption); }
table.register th.am.today { color: var(--brand); }
table.register td.am { font-weight: 700; font-size: 11px; border-left: 1px solid var(--line-soft); }
.am.m-P { background: var(--good-bg); color: var(--good); }
.am.m-L { background: var(--warn-bg); color: var(--warn); }
.am.m-A { background: var(--bad-bg); color: var(--bad); }
.am.m-LV { background: var(--info-bg); color: var(--info); }
.am.m-H { background: var(--violet-bg); color: var(--violet); }
.am.m-O { background: var(--subtle); color: #98a2b3; }
table.register .atot { min-width: 40px; padding-left: 4px; padding-right: 4px; font-variant-numeric: tabular-nums; border-left: 1px solid var(--line); }
table.register td.atot.bad { color: var(--bad); font-weight: 700; }
.legend i.am { width: auto; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 4px; font-style: normal; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
@media print { table.register th, table.register td { padding: 2px 1px !important; font-size: 9px; } }

/* Pay */
table.pay .num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.pay input.rate { width: 120px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; text-align: right; font-variant-numeric: tabular-nums; }
table.pay tr.total td { border-top: 2px solid var(--line-strong); background: var(--subtle); }
@media print { table.pay input.rate { border: 0; width: 70px; } }

/* Invoices */
.plist li input.rate { width: 110px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; text-align: right; }
.plist li:has(input.rate) { grid-template-columns: minmax(0, 1fr) auto 0; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; resize: vertical; box-sizing: border-box; }
.invoice { max-width: 860px; padding: 36px; }
.invhead { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.invhead h2 { margin: 0 0 6px; }
.invmeta { text-align: right; }
.invmeta h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: 0.08em; color: var(--brand); }
.invmeta p { margin: 2px 0; }
.invmeta .paid { display: inline-block; margin-top: 8px; padding: 2px 12px; border: 2px solid var(--good); border-radius: 6px; color: var(--good); font-weight: 800; letter-spacing: 0.1em; }
.invmeta .paid.void { border-color: var(--bad); color: var(--bad); }
.invto { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; padding: 14px 16px; border-radius: 10px; background: var(--subtle); }
.invto span { font-size: 13px; color: var(--muted); }
.invto b { font-size: 17px; }
.invoice table { width: 100%; }
.invoice tr.sum td { border-top: 0; padding-top: 4px; padding-bottom: 4px; color: var(--ink-2, var(--ink-2)); }
.pre { white-space: pre-line; color: var(--ink-2, var(--ink-2)); margin: 0; }
.invoice > .pre { margin-top: 20px; }
@media print { .invoice { max-width: none; border: 0 !important; padding: 0; } .head { display: none; } @page { size: A4 portrait; } }

/* My account and two-step sign-in */
a.who { text-decoration: none; color: inherit; }
a.who:hover { background: rgba(255, 255, 255, 0.1); }
.card.narrow { max-width: 680px; }
.steps { margin: 0 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-top: 10px; }
.codes code { padding: 7px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-strong); font-family: ui-monospace, Consolas, monospace; font-size: 14px; text-align: center; letter-spacing: 0.04em; color: var(--ink); }
.codes code.key { grid-column: 1 / -1; font-size: 16px; font-weight: 700; user-select: all; }
form.inline input[type=password], form.inline input[name=code] { max-width: 220px; }

td.nowrap { white-space: nowrap; }

/* Teams */
select.teampick { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font: inherit; }
.teamlist li { grid-template-columns: minmax(0, 1fr) 90px auto; }
.teamlist li input { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: 600; background: transparent; }
.teamlist li input:hover, .teamlist li input:focus { border-color: var(--line-strong); background: var(--surface); }
@media print { select.teampick { display: none; } }

.alert.narrow { max-width: 680px; box-sizing: border-box; }

/* Project assignment */
.daybox.people span { min-width: 0; font-weight: 500; }
.pbody form[data-form=members] { margin-bottom: 14px; }
.pbody form[data-form=members] .muted { margin: 8px 0; }

/* Billing */
.topnote { margin-bottom: 14px; }
.topnote a { color: inherit; font-weight: 700; }
.planhead, .planrow { display: grid; grid-template-columns: minmax(140px, 1.4fr) 150px 90px auto auto auto; gap: 10px; align-items: center; }
.planhead { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.planrow { padding: 6px 0; }
.planrow.add { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.planrow input:not([type=checkbox]) { height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; min-width: 0; }
.planrow .check { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
table.pay td small { display: block; color: var(--muted); font-size: 12px; }
table.pay td input[type=date], table.pay td select { height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
@media (max-width: 980px) { .planhead { display: none; } .planrow { grid-template-columns: 1fr 1fr; } }

/* API keys */
.scopes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 14px 0; }
.scopes .check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.scopes .check small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.scope { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: nowrap; }
td code, p code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: var(--line-soft); padding: 1px 5px; border-radius: 5px; }
pre.code { margin: 0 0 10px; padding: 12px 14px; border-radius: 10px; background: var(--code-bg); color: var(--line); font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-x: auto; }
tr.off td { color: var(--muted); }

.dlgacts.left { justify-content: flex-start; }

/* Branding */
img.mark.pic { object-fit: contain; background: var(--surface); padding: 2px; box-sizing: border-box; }
.colour { display: flex; align-items: center; gap: 12px; }
.colour input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.colour .check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; }
.logobox { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.logobox img { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 6px; box-sizing: border-box; }
.mark.big { width: 72px; height: 72px; font-size: 28px; border-radius: 16px; }
form.inline input[type=file] { flex: 1; min-width: 0; height: auto; padding: 6px; }

/* ---- dark mode: chosen with the switch in the menu, or the device's own setting until one is chosen ---- */
:root[data-theme='dark'] {
  --side: #080d18;
  --side-ink: #b6c2d6;
  --ink: #e8ecf4;
  --ink-2: #c5cedc;
  --muted: #9ba7ba;
  --caption: #8592a8;
  --line: #27344e;
  --line-strong: #3b4b6a;
  --line-soft: #1f2b44;
  --bg: #0b1220;
  --surface: #131c2e;
  --subtle: #18233a;
  --track: #223050;
  --good: #47cd89;
  --good-bg: #0f2b20;
  --good-line: #1f5a40;
  --warn: #fdb022;
  --warn-bg: #2f240d;
  --bad: #f97066;
  --bad-bg: #321715;
  --bad-line: #6a2a26;
  --info: #8fb4ff;
  --info-bg: #17264a;
  --violet: #bda9ff;
  --violet-bg: #231b46;
  --code-bg: #060a13;
  --shadow: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
  --side: #080d18;
  --side-ink: #b6c2d6;
  --ink: #e8ecf4;
  --ink-2: #c5cedc;
  --muted: #9ba7ba;
  --caption: #8592a8;
  --line: #27344e;
  --line-strong: #3b4b6a;
  --line-soft: #1f2b44;
  --bg: #0b1220;
  --surface: #131c2e;
  --subtle: #18233a;
  --track: #223050;
  --good: #47cd89;
  --good-bg: #0f2b20;
  --good-line: #1f5a40;
  --warn: #fdb022;
  --warn-bg: #2f240d;
  --bad: #f97066;
  --bad-bg: #321715;
  --bad-line: #6a2a26;
  --info: #8fb4ff;
  --info-bg: #17264a;
  --violet: #bda9ff;
  --violet-bg: #231b46;
  --code-bg: #060a13;
  --shadow: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  }
}
/* Typing boxes and menus follow the theme (the browser's own white would glare on a dark page). */
input, select, textarea { background: var(--surface); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--caption); }
/* Paper is white: printing always uses the light colours. */
@media print {
  :root, :root[data-theme='dark'] { --ink: #0f1728; --ink-2: #344054; --muted: #5b6676; --caption: #7b8696; --line: #e3e8ef; --line-strong: #cdd5df; --line-soft: #eef1f5; --bg: #ffffff; --surface: #ffffff; --subtle: #f8fafc; --track: #eef1f6;
    --good: #067647; --good-bg: #ecfdf3; --warn: #b54708; --warn-bg: #fffaeb; --bad: #b42318; --bad-bg: #fef3f2; --info: #1e40af; --info-bg: #eff4ff; color-scheme: light; }
}

/* ---- the menu: the name stays at the top, the account at the bottom, and the links between them scroll ---- */
.side { overflow: hidden; }
.side nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-right: -6px; padding-right: 6px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.side nav::-webkit-scrollbar { width: 6px; }
.side nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 3px; }
.side nav a { flex: none; }
.sidefoot { margin-top: 0; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); flex: none; }
@media (max-width: 980px) {
  .side { overflow: visible; }
  .side nav { flex: 1; overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; margin-right: 0; padding-right: 0; scrollbar-width: none; }
  .side nav::-webkit-scrollbar { display: none; }
  .sidefoot { border-top: 0; padding-top: 0; }
}

.login { position: relative; }
.themebtn { position: absolute; top: 16px; right: 16px; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
/* In the dark, soft shadows cannot be seen: cards are told apart by their edge instead. */
:root[data-theme='dark'] .card, :root[data-theme='dark'] .kpi { box-shadow: none; }
:root[data-theme='dark'] .tip { background: #e8ecf4; color: #0b1220; }
:root[data-theme='dark'] .bplot u, :root[data-theme='dark'] .track u { background: var(--line); }
.dlg { background: var(--surface); }
.kicon.idle { background: color-mix(in srgb, var(--c-idle) 14%, var(--surface)); }
/* The code example is always light text on a dark block, in both themes. */
pre.code { color: #e4e7ec; }

/* ---- reminders and blocking (Apps & websites) ---- */
.focusform { display: grid; gap: 16px; max-width: 640px; }
.focusform input[type='number'] { max-width: 140px; }
.focusform textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface); color: var(--ink); }
.focusform .field small { display: block; margin-top: 6px; }
.focusform .check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.focusform .check input { margin-top: 3px; }
.focusform .check small { display: block; color: var(--muted); font-weight: 400; }
.focusform .btn { justify-self: start; }
