/* Timebook — one stylesheet, no framework. Light and dark follow the system setting. */
:root {
  --ground: #F2F5F4; --surface: #FFFFFF; --ink: #15201E; --muted: #5B6965; --rule: #D5DDDA;
  --accent: #0E6B72; --accent-ink: #FFFFFF; --accent-soft: #DDEDEC;
  --critical: #A8201A; --critical-soft: #F8E3E1; --warning: #8F5A0B; --warning-soft: #F6EAD6;
  --good: #2E7A4D; --tag: #E8ECEA;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0E1413; --surface: #162020; --ink: #E2E9E7; --muted: #97A5A1; --rule: #2A3634;
    --accent: #5DB9BE; --accent-ink: #0E1413; --accent-soft: #163536;
    --critical: #F2877F; --critical-soft: #3A1715; --warning: #E3A64D; --warning-soft: #352812;
    --good: #72C394; --tag: #212B29;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the hidden attribute always wins over component display rules */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { line-height: 1.2; text-wrap: balance; }
code, .key { font-family: var(--mono); }

/* --- top bar -------------------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--rule); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding-inline: 20px; display: flex; align-items: center; gap: 28px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--accent-soft); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* --- page ---------------------------------------------------------------- */
.page { max-width: 1100px; margin: 0 auto; padding-inline: 20px; padding-block: 28px 64px; }
.page-narrow { max-width: 460px; }
.page-title { font-size: 24px; margin: 0 0 24px; }
section { margin-block: 0 36px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--tag); color: var(--ink); border-radius: 999px; padding: 0 8px; font-size: 12px; letter-spacing: 0; }
.muted { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); margin-top: 20px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- figures ------------------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.figure { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; }
.figure-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.figure-label { font-size: 13px; color: var(--muted); }

/* --- attention list ------------------------------------------------------ */
.attention { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.att { display: grid; grid-template-columns: 5.5rem 1fr; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.att-title { margin: 0; font-weight: 600; }
.att-detail { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.pill { justify-self: start; display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; white-space: nowrap; margin-top: 2px; }
.pill-critical { background: var(--critical-soft); color: var(--critical); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.tag { display: inline-block; font-size: 11px; background: var(--tag); color: var(--muted); border-radius: 4px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }

/* --- tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th.num { text-align: right; }

/* --- forms --------------------------------------------------------------- */
.stack { display: grid; gap: 6px; }
.stack label { font-size: 14px; font-weight: 600; margin-top: 8px; }
input[type=email], input[type=password], input[type=text], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 9px 11px; width: 100%;
}
input:focus { border-color: var(--accent); }
input.code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; max-width: 12ch; }
.btn { display: inline-block; text-decoration: none; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius); padding: 10px 16px; cursor: pointer; margin-top: 14px; justify-self: start; }
.btn:hover { filter: brightness(1.08); }
.alert { background: var(--critical-soft); color: var(--critical); padding: 10px 12px; border-radius: var(--radius); }
.notice { background: var(--accent-soft); padding: 10px 12px; border-radius: var(--radius); }

/* --- sign-in ------------------------------------------------------------- */
.auth { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 28px; margin-top: 8vh; }
.auth-wide { margin-top: 4vh; }
.page-narrow:has(.auth-wide) { max-width: 560px; }
.auth h1 { font-size: 22px; margin: 4px 0 4px; }
.auth-brand { font-weight: 700; color: var(--accent); margin: 0; }
/* the four companies' logos: always on white, so the dark navy/indigo marks stay readable in dark mode */
.auth-logos { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; background: #fff; border-radius: var(--radius); padding: 10px 14px; margin: -8px -8px 20px; }
.auth-logos img { display: block; height: 28px; width: auto; }
.auth-logos .auth-logo-wide { height: 22px; }
.auth-logos .auth-logo-tall { height: 36px; }   /* IS-EC's mark is upright: taller, so its words match the others */
.steps { padding-left: 20px; }
.steps li { margin-bottom: 12px; }
.qr { display: block; margin: 12px 0; border-radius: var(--radius); background: #fff; padding: 6px; max-width: 100%; height: auto; }
.key { font-size: 14px; word-break: break-all; background: var(--tag); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 560px) {
  .who-name { display: none; }
  .auth { padding: 20px; margin-top: 16px; }
  .auth-logos { justify-content: center; padding: 8px 10px; }
  .auth-logos img { height: 24px; }
  .auth-logos .auth-logo-wide { height: 19px; }
  .auth-logos .auth-logo-tall { height: 31px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- admin ---------------------------------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .page-title { margin: 0; }
.crumbs { font-size: 14px; margin: 0 0 6px; color: var(--muted); }
.lead { max-width: 70ch; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); }
a.card:hover { border-color: var(--accent); }
.card-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-soon { opacity: 0.7; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin: 0 0 32px; }
.facts div { padding: 10px 14px; box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule); }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.row-current td { background: var(--accent-soft); }
.row-muted td { color: var(--muted); }
.note-cell { max-width: 32ch; }
.btn-small { padding: 6px 12px; font-size: 14px; margin-top: 0; }
.btn-secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--rule); }
.btn-danger { background: var(--critical-soft); color: var(--critical); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin: 10px 0; }
.inline-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.inline-form input, .inline-form select { width: auto; padding: 6px 8px; }
.filter { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
details.row-edit summary, details.change-from summary { cursor: pointer; color: var(--accent); font-size: 14px; }
details.row-edit[open] { background: var(--ground); border-radius: var(--radius); padding: 8px; }
details.change-from { margin-top: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.spaced { margin-top: 16px; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; max-width: 900px; }
.field { display: grid; gap: 6px; align-content: start; margin: 0; border: 0; padding: 0; }
.field label, .field legend { font-weight: 600; font-size: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400 !important; margin-right: 14px; }
.check input { width: auto; }
.field-error { color: var(--critical); font-size: 13px; margin: 0; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; }
.form-actions .btn { margin-top: 0; }
.flash { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 20px; }
.flash-ok { background: var(--accent-soft); }
.flash-error { background: var(--critical-soft); color: var(--critical); }
.flash a { font-weight: 600; }

/* --- projects --------------------------------------------------------------- */
.head-actions { display: flex; gap: 16px; align-items: center; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.panel p:first-child { margin-top: 0; }
.pill-good { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill-neutral { background: var(--tag); color: var(--muted); }
.line { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px 16px; margin-bottom: 12px; }
.line-inactive { border-style: dashed; }
.line-inactive .line-head h3 { color: var(--muted); }
.line-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.line-head h3 { margin: 0; font-size: 16px; }
.line-edit { margin-left: auto; font-size: 14px; }
.line-figures { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 12px 0 8px; }
.line-figures div { display: grid; }
.line-figures .k { font-size: 12px; color: var(--muted); }
.line-figures .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.burn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.burn meter { width: min(360px, 100%); height: 10px; }
.sub-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.inline-form.tight { margin: 0; gap: 6px; align-items: center; }
.inline-form .grow { flex: 1 1 220px; }
.inline-form .grow input { width: 100%; }
.site-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; }
.site-list li { display: flex; gap: 12px; align-items: baseline; }
.field-wide { grid-column: 1 / -1; }
.sub-label { font-weight: 400 !important; color: var(--muted); font-size: 13px !important; }
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 9px 11px; width: 100%; }
details.panel > summary { cursor: pointer; color: var(--accent); }

/* --- timesheet -------------------------------------------------------------- */
.week-nav { display: flex; align-items: center; gap: 12px; margin: 6px 0 0; }
.week-nav a { text-decoration: none; font-size: 18px; }
.week-nav .this-week { font-size: 14px; text-decoration: underline; }
.figures-compact { min-width: 280px; }
.figures-compact .figure-value { font-size: 20px; }
.timer-panel { margin-bottom: 28px; }
.timer-running { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.timer-running > div { flex: 1; }
.timer-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--critical); }
@media (prefers-reduced-motion: no-preference) { .timer-dot { animation: pulse 2s infinite; } }
@keyframes pulse { 50% { opacity: 0.35; } }
.entry-form .wide { flex-basis: 100%; }
.entry-form .or { color: var(--muted); font-size: 13px; padding-bottom: 8px; }
.table.grid td, .table.grid th { padding: 6px 8px; }
.grid .weekend { background: color-mix(in srgb, var(--tag) 55%, transparent); }
.grid th.today { color: var(--accent); }
.grid input.cell { width: 4.2em; text-align: right; padding: 4px 6px; font-variant-numeric: tabular-nums; }
.grid input.cell::placeholder { color: var(--rule); }
.grid .cell-fixed { display: inline-block; min-width: 4.2em; padding: 4px 6px; color: var(--muted); border-bottom: 1px dotted var(--muted); cursor: help; }
.grid tfoot th { border-top: 1px solid var(--rule); }
.grid-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.missing { color: var(--warning); font-style: italic; }

.inline-form label.check { display: inline-flex; align-items: center; gap: 6px; padding-bottom: 8px; color: var(--ink); }
.entry-form input[type=time] { width: 7.5em; }

/* --- reports ---------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.invoice { margin-bottom: 14px; }
.invoice-title { font-size: 16px; margin: 0; }
.invoice-total { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.invoice .table-wrap { margin-top: 10px; }
.invoice-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; }
.invoice-row .num { margin-left: auto; }
.overage { background: var(--warning-soft); padding: 8px 10px; border-radius: var(--radius); }
.total-line { font-size: 16px; }
td.neg, .neg { color: var(--critical); }

.table td:first-child { min-width: 16ch; }

.close-panel { margin-bottom: 14px; }
.ok-line { color: var(--good); font-weight: 600; }

/* --- timesheet: Clockify replica (docs/TIMESHEET-CLOCKIFY.md) ---------------- */
:root { --ts-head: #E4EAEE; --ts-line: #D6DFE3; --ts-cell: #C6D2D9; --ts-weekend: #F6F8F9; --ts-ink: #333C40; --ts-muted: #99A5AB; --ts-row-h: 48px; }
@media (prefers-color-scheme: dark) {
  :root { --ts-head: #1E2A2A; --ts-line: #2A3634; --ts-cell: #3A4846; --ts-weekend: #131B1A; --ts-ink: #E2E9E7; --ts-muted: #7E8C88; }
}
body:has(#sheet) .page { max-width: 1440px; }
#sheet { color: var(--ts-ink); font-size: 13px; }
.ts-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ts-title { font-size: 22px; font-weight: 400; margin: 0; color: var(--ts-ink); }
.ts-tools { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.ts-btn { font: inherit; font-size: 13px; color: var(--ts-ink); background: var(--surface); border: 1px solid var(--ts-cell); border-radius: 2px; padding: 0 12px; height: 34px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ts-btn:hover { border-color: var(--ts-muted); }
.ts-btn:disabled { opacity: 0.55; cursor: default; }
.ts-icon { width: 36px; justify-content: center; padding: 0; color: var(--ts-muted); }
.ts-icon[aria-pressed="true"] { background: var(--ts-head); color: var(--ts-ink); }
.caret { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid currentColor; opacity: 0.7; }
.ts-week { display: flex; position: relative; }
.ts-week-label { min-width: 170px; border-radius: 2px 0 0 2px; color: var(--ts-ink); }
.ts-week-label svg { color: var(--ts-muted); }
.ts-week-date { position: absolute; left: 0; top: 34px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ts-arrow { width: 32px; justify-content: center; padding: 0; margin-left: -1px; border-radius: 0; color: var(--ts-muted); font-size: 18px; }
.ts-arrow:last-child { border-radius: 0 2px 2px 0; }
.ts-viewing { background: var(--accent-soft); padding: 8px 12px; border-radius: 2px; margin: 0 0 12px; }

/* grid */
.ts-grid-wrap { overflow-x: auto; border: 1px solid var(--ts-line); background: var(--surface); }
.ts-grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 980px; }
.ts-grid th, .ts-grid td { border-bottom: 1px solid var(--ts-line); padding: 0 8px; height: var(--ts-row-h); vertical-align: middle; }
.ts-grid thead th { background: var(--ts-head); height: 32px; font-size: 12px; font-weight: 400; color: var(--ts-muted); text-align: center; white-space: nowrap; }
.ts-grid thead th.ts-col-project { text-align: left; padding-left: 14px; }
.ts-col-project { width: auto; }
.ts-col-day { width: 76px; text-align: center; }
.ts-col-total { width: 88px; text-align: left; font-variant-numeric: tabular-nums; }
.ts-col-x { width: 44px; text-align: center; border-left: 1px dashed var(--ts-line); }
.ts-grid .ts-weekend { background: var(--ts-weekend); }
.ts-grid thead .ts-weekend { background: var(--ts-head); }
.ts-grid td.ts-col-project { padding-left: 14px; }
.ts-project { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-project-name { color: var(--ts-ink); overflow: hidden; text-overflow: ellipsis; }
.ts-client { color: var(--ts-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex: none; transform: translateY(-2px); }
.ts-cell-wrap { position: relative; display: inline-block; }
input.ts-cell { width: 64px; height: 32px; border: 1px solid var(--ts-cell); border-radius: 2px; background: var(--surface); color: var(--ts-ink);
  font: inherit; font-size: 11px; text-align: center; padding: 0 2px; font-variant-numeric: tabular-nums; }
input.ts-cell:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input.ts-cell[readonly] { background: transparent; color: var(--ts-muted); cursor: default; }
input.ts-cell.ts-filled[readonly] { color: var(--ts-ink); background: var(--ts-weekend); }
.ts-cell.ts-saving { opacity: 0.5; }
.ts-cell-more { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 14px; border: 0; border-left: 1px solid var(--ts-cell);
  background: var(--surface); color: var(--ts-muted); font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; padding: 0; }
.ts-cell-wrap:hover .ts-cell-more, .ts-cell-more:focus { opacity: 1; }
.ts-col-total, .ts-foot-total { font-size: 13px; }
.ts-zero { color: var(--ts-muted); }
.ts-x { border: 0; background: none; color: var(--ts-muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.ts-x:hover { color: var(--critical); }
.ts-select-project { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 0; }
.ts-plus-circle { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 50%; font-size: 13px; line-height: 1; }
.ts-grid tfoot th, .ts-grid tfoot td { background: var(--ts-head); height: 32px; font-size: 12px; color: var(--ts-muted); font-weight: 400; }
.ts-grid tfoot th { text-align: left; padding-left: 14px; }
.ts-grid tfoot .ts-foot-day { text-align: center; color: var(--ts-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ts-grid tfoot .ts-foot-day.ts-zero { color: var(--ts-muted); font-weight: 400; }
.ts-grid tfoot .ts-foot-total { color: var(--ts-ink); font-weight: 600; }
body.ts-compact { --ts-row-h: 34px; }
body.ts-compact input.ts-cell { height: 24px; }

/* actions under the grid */
.ts-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.ts-plus { display: inline-flex; width: 16px; height: 16px; border: 1px solid var(--ts-muted); border-radius: 50%; align-items: center; justify-content: center; font-size: 12px; line-height: 1; color: var(--ts-muted); }
.ts-split { position: relative; display: inline-flex; }
.ts-split > .ts-btn:first-child { border-radius: 2px 0 0 2px; }
.ts-split-caret { border-radius: 0 2px 2px 0; margin-left: -1px; padding: 0 8px; }
.ts-split > .ts-btn:only-of-type { border-radius: 2px; }

/* menus, picker, popovers */
.ts-dd { position: relative; display: inline-flex; }
.ts-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; background: var(--surface); border: 1px solid var(--ts-line); box-shadow: 0 6px 24px rgba(0,0,0,0.14); min-width: 240px; border-radius: 2px; }
.ts-menu-right { left: auto; right: 0; }
.ts-menu-up { top: auto; bottom: calc(100% + 4px); }
.ts-menu-search { padding: 10px; border-bottom: 1px solid var(--ts-line); }
.ts-menu-label { display: flex; justify-content: space-between; padding: 8px 14px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ts-muted); border-bottom: 1px solid var(--ts-line); }
.ts-menu-label span { text-transform: none; letter-spacing: 0; color: var(--ts-ink); font-size: 13px; }
.ts-menu-list { list-style: none; margin: 0; padding: 4px 0; max-height: 320px; overflow-y: auto; }
.ts-menu-list button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ts-ink); padding: 9px 14px; cursor: pointer; }
.ts-menu-list button:hover { background: var(--ts-weekend); }
.ts-menu-list button.on::after { content: "✓"; color: var(--good); }
.ts-menu-list button.danger { color: var(--critical); }
.ts-muted { color: var(--ts-muted); }
.ts-tpl { display: flex; }
.ts-tpl-del { width: auto !important; flex: none; color: var(--ts-muted) !important; }
.ts-picker { position: absolute; z-index: 40; width: 400px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--ts-line);
  box-shadow: 0 8px 28px rgba(0,0,0,0.16); border-radius: 2px; display: flex; flex-direction: column; max-height: 420px; font-size: 13px; color: var(--ts-ink); }
.ts-picker-search { padding: 10px; }
.ts-picker-search input, .ts-menu-search input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--ts-cell); border-radius: 2px; font-size: 13px; }
.ts-picker-body { overflow-y: auto; flex: 1; padding-bottom: 6px; }
.ts-picker-foot { border-top: 1px solid var(--ts-line); padding: 12px 14px; }
.ts-picker-foot a { color: var(--accent); text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.ts-group { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; }
.ts-group-name { font-size: 11px; letter-spacing: 0.06em; color: var(--ts-muted); }
.ts-group-toggle { border: 0; background: none; color: var(--ts-muted); font: inherit; font-size: 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chev-up, .chev-down { display: inline-block; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-bottom: 2px; }
.chev-up { transform: rotate(-135deg); margin-bottom: -2px; }
.ts-p-row, .ts-t-row { display: flex; align-items: center; gap: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.ts-p-row:hover, .ts-t-row:hover, .ts-p-row:focus, .ts-t-row:focus { background: var(--ts-weekend); outline: none; }
.ts-p-name { overflow: hidden; text-overflow: ellipsis; }
.ts-t-row { padding-left: 28px; background: color-mix(in srgb, var(--ts-weekend) 60%, transparent); }
.ts-p-spacer { flex: 1; }
.ts-p-tasks, .ts-p-create { border: 0; background: none; font: inherit; font-size: 12px; cursor: pointer; color: var(--ts-muted); display: inline-flex; gap: 6px; align-items: center; }
.ts-p-create { color: var(--accent); }
.ts-star { border: 0; background: none; font-size: 16px; line-height: 1; cursor: pointer; color: var(--ts-muted); padding: 0 0 0 8px; }
.ts-star.on { color: #F5A623; }
.ts-empty { padding: 14px; color: var(--ts-muted); }
.ts-popover { position: absolute; z-index: 40; min-width: 280px; max-width: 420px; background: var(--surface); border: 1px solid var(--ts-line); box-shadow: 0 6px 24px rgba(0,0,0,0.14); padding: 6px 0; font-size: 13px; }
.ts-pop-title { margin: 0; padding: 8px 14px; color: var(--ts-muted); font-size: 12px; }
.ts-pop-item { display: flex; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 14px; font: inherit; font-size: 13px; color: var(--ts-ink); cursor: pointer; }
.ts-pop-item:hover { background: var(--ts-weekend); }
.ts-pop-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ts-pop-desc { color: var(--ts-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-tag { font-size: 11px; background: var(--tag); color: var(--ts-muted); padding: 0 6px; border-radius: 3px; }

/* Edit time dialog */
.ts-dialog { border: 0; padding: 0; width: 380px; max-width: calc(100vw - 32px); border-radius: 2px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); color: var(--ts-ink); background: var(--surface); font-size: 13px; }
.ts-dialog::backdrop { background: rgba(0,0,0,0.6); }
.ts-dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--ts-line); }
.ts-dialog-head h2 { font-size: 20px; font-weight: 400; margin: 0; }
.ts-dialog-body { padding: 16px; display: grid; gap: 12px; }
.ts-date { margin: 0; color: var(--ts-muted); font-size: 12px; }
.ts-proj { margin: 0 0 4px; display: grid; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--ts-line); }
.ts-proj #ed-project { display: inline-flex; align-items: baseline; gap: 6px; }
.ts-times { display: flex; align-items: center; gap: 8px; padding: 4px 0 12px; border-bottom: 1px solid var(--ts-line); }
input.ts-duration { width: 104px; padding: 0 6px; height: 34px; text-align: center; font-size: 16px; font-weight: 600; border: 1px solid var(--ts-cell); border-radius: 2px; margin-right: 22px; }
.ts-times input[type=time] { width: auto; height: 34px; padding: 0 6px; font-size: 13px; border: 1px solid var(--ts-cell); border-radius: 2px; }
.ts-row { display: grid; grid-template-columns: 110px 1fr; align-items: start; gap: 8px; font-weight: 400; }
.ts-row textarea { border: 1px solid var(--ts-cell); border-radius: 2px; font-size: 13px; min-height: 44px; }
.ts-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.ts-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ts-slider { width: 28px; height: 14px; border-radius: 7px; background: var(--ts-cell); position: relative; transition: background 0.15s; }
.ts-slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.ts-switch input:checked + .ts-slider { background: var(--accent); }
.ts-switch input:checked + .ts-slider::after { transform: translateX(14px); }
.ts-switch input:focus-visible + .ts-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.ts-dialog-foot { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-top: 1px solid var(--ts-line); }
.ts-dialog-foot > :first-child { margin-right: auto; }
.ts-dots { border: 0; background: none; color: var(--ts-muted); font-size: 18px; cursor: pointer; padding: 4px 6px; }
.ts-link { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; }
.ts-save { border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; padding: 10px 22px; border-radius: 2px; cursor: pointer; }
.ts-dialog-small { width: 360px; }
.ts-dialog-small input { margin-top: 8px; }
.ts-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ts-ink); color: var(--surface); padding: 10px 18px; border-radius: 3px; z-index: 60; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.ts-toast-error { background: var(--critical); color: #fff; }
@media (prefers-reduced-motion: reduce) { .ts-slider, .ts-slider::after { transition: none; } }

/* ---- Admin → Clockify sync ---------------------------------------------------------- */
.sync-item { margin-bottom: 12px; }
.sync-item .line-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.sync-item .inline-form .grow select { width: 100%; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 24px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.history form.inline { margin-left: 8px; }

/* ---- Admin → Employee cost calculator --------------------------------------------- */
.calc-result { margin: 16px 0; }
.calc-rate { font-size: 22px; font-weight: 600; color: var(--accent); }
.calc-table { max-width: 640px; margin: 12px 0 18px; }
.calc-table tr.total td { font-weight: 600; border-top: 1px solid var(--rule); }
.form-grid.panel { margin-bottom: 8px; }

/* ---- Report filter bar (partials/filterbar.ejs) ------------------------------------------ */
.filterbar { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 18px; }
.fb-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.fb-period select, .fb-period input { width: auto; padding: 5px 8px; }
.fb-dates { display: inline-flex; align-items: center; gap: 6px; }
.fb-step { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.fb-step:hover { background: var(--ground); }
.fb-label { margin-left: 4px; }
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.fb-clear { font-size: 14px; margin-left: 4px; }
details.fdrop { position: relative; }
details.fdrop > summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; color: var(--ink); background: var(--surface); user-select: none; }
details.fdrop > summary::-webkit-details-marker { display: none; }
details.fdrop > summary::after { content: ' ▾'; color: var(--muted); }
details.fdrop.active > summary { border-color: var(--accent); color: var(--accent); }
details.fdrop.fdrop-warn > summary { border-color: var(--warning, #b7791f); color: var(--warning, #b7791f); }
details.fdrop .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }
.fpanel { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 260px; max-width: 380px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 8px; }
.fpanel input[type=search] { width: 100%; padding: 6px 8px; margin-bottom: 6px; }
.flist { max-height: 300px; overflow-y: auto; display: grid; gap: 2px; }
.fopt { display: flex; align-items: flex-start; gap: 8px; padding: 4px 6px; border-radius: 4px; font-size: 14px; cursor: pointer; color: var(--ink); }
.fopt:hover { background: var(--ground); }
.fopt input { margin-top: 3px; width: auto; }
.fextra, .fgroups { border-bottom: 1px solid var(--rule); margin-bottom: 6px; padding-bottom: 6px; }
.fgroups { display: flex; flex-wrap: wrap; gap: 0 10px; }
.fempty { padding: 4px 6px; margin: 0; }
.fchips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; }
.fchips li { background: var(--tag); border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 13px; }
.fchips a { text-decoration: none; padding: 0 6px; color: var(--muted); }
.fchips a:hover { color: var(--critical); }

/* ---- Time report (partials/time-report.ejs) ------------------------------------------------ */
.subtabs { margin: 0 0 12px; }
.group-by { margin: 14px 0 10px; }
.group-by select { width: auto; }
.time-table tr.g1 td { font-weight: 600; border-top: 1px solid var(--rule); }
.time-table tr.g2 td:first-child { padding-left: 26px; }
.time-table tr.g2 td { color: var(--ink); font-weight: 400; }
.time-table tfoot td { font-weight: 700; border-top: 2px solid var(--rule); }
.time-table .neg, .entry-table .neg { color: var(--critical); }
.share-col { width: 120px; }
.share-col meter { width: 110px; height: 10px; }
.entry-table td.desc { max-width: 380px; }
.entry-table tr.nonbill td { color: var(--muted); }
.entry-table .tags { display: block; margin-top: 2px; }
.entry-table .tags .tag { margin: 2px 4px 0 0; }
.entry-table th a { color: inherit; text-decoration: none; }
.entry-table th a.sorted { text-decoration: underline; }
.tag-warn { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }

/* ---- Carry over (Invoice lines, Payment run) ---------------------------------------------- */
.carry-client { margin: 0 0 16px; }
.carry-client select { width: auto; }
.carry-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 10px; }
.carry-detail { margin-top: 4px; }
.carry-detail summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.carry-detail[open] { background: var(--ground); border-radius: var(--radius); padding: 6px 8px; margin-top: 6px; }
.table-tight td { padding: 4px 8px; font-size: 13px; }
.notice.notice-warn { background: var(--warning-soft); color: var(--warning); border-left: 3px solid var(--warning); }
button.link.link-danger { color: var(--critical); }
.project-filter { margin: 0 0 16px; }

/* ---- Home: Clockify pull bar (admins) ------------------------------------------------------ */
.pull-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 20px; font-size: 14px; }
.table-tight tr.task-row td { color: var(--muted); padding-top: 2px; padding-bottom: 2px; }
.table-tight tr.task-row td:first-child { padding-left: 22px; }
.statement-link { font-size: 12px; margin-left: 8px; }

/* ---- Payment run: submitted to accounting ------------------------------------------------- */
.company-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.mark-cell { white-space: nowrap; }
.mark-cell .mark-by { font-size: 12px; margin-left: 4px; }
.mark-cell .pill { margin-right: 2px; }
.mark-undo { display: inline-block; margin-left: 6px; font-size: 12px; }
.mark-undo summary { cursor: pointer; color: var(--muted); }
.mark-btn { margin-top: 0; }
.carried-in { margin: 0 0 18px; }
.carried-pill { font-size: 11px; margin-top: 3px; display: inline-block; }

/* intercompany (06/10/2026) */
.subsection-title { font-size: 14px; font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }

/* reports phase 2 (06/10/2026): chart, by-day grid, saved views */
:root { --cs0: #0E6B72; --cs1: #C8792B; --cs2: #5B7FC4; --cs3: #8A5BA8; --cs4: #3E9A62; --cs5: #C04F62; --cs-other: #A3AFAB; }
@media (prefers-color-scheme: dark) {
  :root { --cs0: #5DB9BE; --cs1: #E3A04D; --cs2: #8DA9E6; --cs3: #B990D6; --cs4: #72C394; --cs5: #EB8597; --cs-other: #5E6B68; }
}
.chart-box { margin: 0 0 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 12px 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .cs0, .swatch.cs0 { fill: var(--cs0); background: var(--cs0); }
.chart .cs1, .swatch.cs1 { fill: var(--cs1); background: var(--cs1); }
.chart .cs2, .swatch.cs2 { fill: var(--cs2); background: var(--cs2); }
.chart .cs3, .swatch.cs3 { fill: var(--cs3); background: var(--cs3); }
.chart .cs4, .swatch.cs4 { fill: var(--cs4); background: var(--cs4); }
.chart .cs5, .swatch.cs5 { fill: var(--cs5); background: var(--cs5); }
.chart .cs-other, .swatch.cs-other { fill: var(--cs-other); background: var(--cs-other); }
.chart rect:hover { opacity: 0.8; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; margin-top: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.day-grid th, .day-grid td { padding-left: 6px; padding-right: 6px; }
.day-grid .weekend { background: var(--ground); }
.day-grid tr.empty-row td:first-child { color: var(--warning); }
.views-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -6px 0 14px; font-size: 14px; }
.views-bar .view-link { display: inline-flex; align-items: center; gap: 4px; }
.views-bar details summary { cursor: pointer; color: var(--accent); }
.views-bar details[open] { flex-basis: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; }
.line-row td { font-size: 14px; }
.line-row td:first-child { padding-left: 28px; }
.fine-inline { font-size: 12.5px; color: var(--muted); }
.table tr.ms-edit-row td { padding-top: 0; border-top: 0; }

/* Microsoft 365 sign-in and view-as (06/10/2026) */
.btn-microsoft { display: block; text-align: center; text-decoration: none; margin: 8px 0 4px; }
.or-line { margin: 6px 0 22px; }
.viewas-bar { background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid var(--rule); }
.viewas-inner { max-width: 1100px; margin: 0 auto; padding: 6px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; }
.viewas-inner select { padding: 4px 6px; }
.viewas-inner form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.pay-switch { display: block; font-size: 13px; margin-top: 4px; color: var(--muted); }
.figure .fine-inline { display: block; margin-top: 4px; }

/* temporary passwords (06/10/2026) */
.temp-password { font-size: 20px; letter-spacing: 0.04em; user-select: all; }
.message-box { width: 100%; max-width: 720px; font: 14px/1.5 var(--font); padding: 10px 12px; }
