/* ---- Tokens ---- */
:root {
  color-scheme: light dark;
  --bg: #fff;
  --fg: #1b1b1b;
  --dim: #666;
  --line: #ccc;
  --alt: #f0f0f0;
  --accent: #1a6fb0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --fg: #e4e4e4;
    --dim: #999;
    --line: #3a3a3a;
    --alt: #232323;
    --accent: #6cb2ee;
  }
}

/* ---- Base ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
main { max-width: 90rem; margin: 0 auto; padding: 1rem; }
section, details { margin-bottom: 1.5rem; }
.label { color: var(--dim); font-size: 0.9rem; }

/* ---- Controls ---- */
button, input {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0.15rem 0.4rem;
}
button { cursor: pointer; }
button:disabled { color: var(--dim); cursor: default; }
button.link { border: 0; color: var(--dim); text-decoration: underline; }
:is(button, input, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
summary { cursor: pointer; color: var(--accent); }
form label { display: block; margin: 0.4rem 0; }
.actions { margin-top: 0.5rem; }

/* ---- Today ---- */
#today { text-align: center; }
#leave { font-size: 3rem; line-height: 1.1; color: var(--accent); }
#countdown { color: var(--dim); font-size: 1.25rem; }

/* ---- Week ---- */
/* 1fr/auto/1fr keeps prev/label/next centred under the leave time, with "This week" on the right. */
nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 0.5rem; }
.weeknav { grid-column: 2; display: flex; gap: 0.75rem; align-items: center; }
#weeklabel { color: var(--dim); }
#thisweek { justify-self: end; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th, td { border-bottom: 1px solid var(--line); padding: 0.2rem 0.4rem; text-align: left; }
th { color: var(--dim); font-weight: normal; }
.num { text-align: right; }
tr.missing { background: var(--alt); }
td input[type=time] { width: 8rem; }
td input[type=number] { width: 6rem; }
td.note { width: 100%; } /* note column soaks up the spare width */
td.note input { width: 100%; min-width: 9rem; }
.flag { color: var(--accent); font-weight: bold; }

/* ---- Adjustments & dialog ---- */
#adjlist { padding-left: 1.2rem; white-space: pre-wrap; }
dialog { background: var(--bg); color: var(--fg); border: 1px solid var(--accent); }
::backdrop { background: rgb(0 0 0 / 0.5); }
