:root {
  --brand: #378ADD;
  --brand-bg: #E6F1FB;
  --brand-text: #0C447C;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --text: #2c2c2a;
  --text-2: #5f5e5a;
  --muted: #888780;
  --border: #d3d1c7;
  --border-soft: #e6e4dc;
  --success-bg: #EAF3DE; --success-text: #27500A;
  --warning-bg: #FAEEDA; --warning-text: #633806;
  --danger-bg: #FCEBEB; --danger-text: #791F1F; --danger: #A32D2D;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-bg: #0C447C; --brand-text: #B5D4F4;
    --bg: #1b1b1a; --surface: #242423; --surface-2: #2c2c2a;
    --text: #efede6; --text-2: #b4b2a9; --muted: #888780;
    --border: #444441; --border-soft: #343432;
    --success-bg: #27500A; --success-text: #C0DD97;
    --warning-bg: #633806; --warning-text: #FAC775;
    --danger-bg: #791F1F; --danger-text: #F7C1C1; --danger: #F09595;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 20px; font-weight: 500; margin: 0 0 1rem; }
h2 { font-size: 16px; font-weight: 500; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  height: 34px; padding: 0 10px; width: 100%; min-width: 0;
}
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
button {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  height: 34px; padding: 0 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
button:hover { background: var(--surface-2); }
button:active { transform: scale(0.98); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { filter: brightness(1.05); }
button.danger { color: var(--danger); }
button.small, .small { height: 28px; padding: 0 8px; font-size: 13px; }
button.icon { width: 34px; padding: 0; justify-content: center; }
button:disabled { opacity: .5; cursor: default; }
label.lbl, .lbl { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.right, .num { text-align: right; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.metric { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; }
.metric .v { font-size: 22px; font-weight: 500; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.badge.accent { background: var(--brand-bg); color: var(--brand-text); }
.badge.success { background: var(--success-bg); color: var(--success-text); }
.badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; margin: 0 6px 6px 0; background: var(--surface); cursor: pointer; height: auto;
}
.chip:hover { border-color: var(--brand); }
.chip .muted { font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-weight: 500; color: var(--text-2); text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
td { padding: 6px 6px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr.total td { font-weight: 500; border-bottom: none; }
tr:hover td.hover { background: var(--surface-2); }
.cell { width: 100%; height: 28px; text-align: right; padding: 0 6px; font-size: 13px; }
.cell.today { border-color: var(--brand); }
.cell.locked { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.cell.dirty { border-color: #EF9F27; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; flex: 1; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.error { color: var(--danger); font-size: 13px; }
.form-grid { display: grid; gap: 10px; }
.g5 { grid-template-columns: 120px repeat(4, minmax(0, 1fr)); }
.g4 { grid-template-columns: 120px minmax(0, 1fr) 110px 160px; }
@media (max-width: 760px) { .g5, .g4 { grid-template-columns: 1fr 1fr; } }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border-soft); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 500; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 20px; height: 20px; }
nav { display: flex; gap: 16px; margin-left: 12px; }
nav a { color: var(--text-2); padding: 4px 0; border-bottom: 2px solid transparent; }
nav a.active { color: var(--text); border-bottom-color: var(--brand); }
.timerbox { display: flex; align-items: center; gap: 8px; }
.timerbox .running { font-variant-numeric: tabular-nums; }
main { max-width: 1080px; margin: 0 auto; padding: 20px; }
.login { max-width: 360px; margin: 10vh auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: var(--radius); font-size: 13px; z-index: 20; }
.toast.err { background: var(--danger); color: #fff; }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heat .d { border-radius: 4px; padding: 6px; min-height: 56px; background: var(--surface-2); font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.heat .d:hover { border-color: var(--brand); }
.heat .d.other { opacity: .35; }
.heat .d.l1 { background: #E6F1FB; } .heat .d.l2 { background: #B5D4F4; } .heat .d.l3 { background: #85B7EB; } .heat .d.l4 { background: #378ADD; color: #fff; }
@media (prefers-color-scheme: dark) { .heat .d.l1 { background: #0C447C55; } .heat .d.l2 { background: #0C447C99; } .heat .d.l3 { background: #185FA5; color:#fff } }
.heat .d .n { font-weight: 500; font-size: 13px; }
.tree .client { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.tree .project { margin-left: 24px; padding: 6px 0; }
.tree .component { margin-left: 48px; padding: 3px 0; font-size: 13px; color: var(--text-2); }
.inactive { opacity: .5; }
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; background: var(--surface); color: var(--text); width: min(560px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.sr-only { position: absolute; left: -9999px; }
.hint { font-size: 12px; color: var(--muted); }
datalist { display: none; }
