:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1a1f2b; --muted: #545d6e; --line: #d9dde4;
  --accent: #1d4ed8; --accent-text: #ffffff; --ok-bg: #dcfce7; --ok: #14532d;
  --warn-bg: #fef3c7; --warn: #78350f; --err: #b91c1c; --focus: #f59e0b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11141a; --surface: #1a1f29; --text: #e8ebf0; --muted: #a8b0bf; --line: #2e3542;
          --accent: #7aa2ff; --accent-text: #0b1020; --ok-bg: #12351f; --ok: #a7f3c0;
          --warn-bg: #3a2a08; --warn: #fcd98a; --err: #fca5a5; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 1rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); } .brand.big { font-size: 1.4rem; text-align: center; }
.usermenu { position: relative; } .usermenu summary { cursor: pointer; padding: .4rem .6rem; }
.usermenu .menu { position: absolute; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem; min-width: 12rem; display: grid; gap: .4rem; z-index: 5; }
.shell { display: grid; grid-template-columns: 13rem 1fr; min-height: calc(100vh - 3rem); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1rem .5rem; display: flex; flex-direction: column; gap: .2rem; }
.sidebar a { padding: .5rem .75rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
main { padding: 1.25rem; min-width: 0; } main.center { max-width: 28rem; margin: 3rem auto; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; } h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.card h2:first-child { margin-top: 0; } .narrow { max-width: 28rem; margin-inline: auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.pagehead { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; } .pagehead h1 { margin: 0; }
.logo { max-height: 3rem; max-width: 8rem; }
.stats { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.stats li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; color: var(--muted); }
.stats .n { display: block; font-size: 1.7rem; font-weight: 700; color: var(--text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
input, select, button, .button { font: inherit; min-height: 2.5rem; }
input, select { width: 100%; padding: .45rem .6rem; border: 1px solid var(--muted); border-radius: 6px; background: var(--surface); color: var(--text); }
button, .button { display: inline-block; margin-top: 1rem; padding: .45rem 1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; }
button.secondary { background: transparent; color: var(--accent); }
button.linklike { background: none; border: none; color: var(--accent); padding: 0; margin: 0; min-height: auto; text-decoration: underline; }
.inline, .filters { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
.inline label, .filters label { margin: 0; } .inline input, .inline select, .filters input, .filters select { width: auto; min-width: 10rem; }
.inline button, .filters button { margin-top: 0; } .filters { margin-bottom: 1rem; }
.small { margin-top: .4rem; font-size: .9rem; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; } .badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.flash { background: var(--ok-bg); color: var(--ok); padding: .6rem .9rem; border-radius: 8px; overflow-wrap: anywhere; }
.error { color: var(--err); font-weight: 600; }
.hint, .empty { color: var(--muted); font-weight: 400; }
.secret { overflow-wrap: anywhere; font-size: .9rem; }
.pager { display: flex; gap: 1rem; margin-top: 1rem; align-items: center; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: .5rem; }
  .sidebar a { white-space: nowrap; }
  main { padding: 1rem; }
  .inline input, .inline select, .filters input, .filters select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Phase 2 */
textarea { width: 100%; font: inherit; padding: .45rem .6rem; border: 1px solid var(--muted); border-radius: 6px; background: var(--surface); color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0 0; } legend { font-weight: 600; padding: 0 .3rem; }
label.check { display: inline-flex; align-items: center; gap: .35rem; font-weight: 400; margin-right: .75rem; }
label.check input { width: auto; min-height: auto; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; } .actions > * { margin-top: 1rem; } .actions form { margin: 0; }
button.big { font-size: 1.1rem; padding: .6rem 1.5rem; }
.pending { margin-top: 1rem; } .pending a { margin-right: .75rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
ul.plain { list-style: none; padding: 0; } ul.plain li { padding: .25rem 0; }
.calendar { margin: .5rem 0; } .cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head span { font-size: .8rem; color: var(--muted); text-align: center; font-weight: 600; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: .3rem; min-height: 4.2rem; font-size: .75rem; display: flex; flex-direction: column; overflow: hidden; }
.cal-n { font-weight: 700; font-size: .9rem; } .cal-s { color: var(--muted); overflow-wrap: anywhere; } .cal-t { color: var(--muted); }
.s-present, .s-wfh, .s-working { border-left-color: #15803d; } .s-late, .s-half_day, .s-short, .s-half_leave, .s-missed_checkout { border-left-color: #b45309; }
.s-absent { border-left-color: var(--err); } .s-leave { border-left-color: #6d28d9; } .s-holiday, .s-weekly_off { border-left-color: var(--line); }
.badge.s-present, .badge.s-wfh, .badge.s-working, .badge.r-approved, .badge.r-reviewed, .badge.r-submitted { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.s-late, .badge.s-half_day, .badge.s-short, .badge.s-missed_checkout, .badge.s-half_leave, .badge.r-pending, .badge.r-changes_requested { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.s-absent, .badge.r-rejected { color: var(--err); border-color: var(--err); }
.leavecal dt { font-weight: 700; margin-top: .75rem; } .leavecal dd { margin: .25rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; }
details.alerts { margin: .5rem 0; } details.alerts summary { cursor: pointer; color: var(--warn); font-weight: 600; }
.cal-code { font-weight: 600; font-size: .7rem; color: var(--muted); }
@media (max-width: 760px) { .cal-day { min-height: 3.2rem; padding: .2rem; } .cal-s { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .cal-t { display: none; } }
@media (min-width: 761px) { .cal-code { display: none; } }
/* Phase 3 */
.bell { margin-left: auto; margin-right: 1rem; text-decoration: none; }
.bell .count { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--err); color: #fff; font-size: .8rem; text-align: center; font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; } .tabs a { padding: .3rem .6rem; } .tabs a[aria-current="page"] { font-weight: 700; text-decoration: none; border-bottom: 3px solid var(--accent); } .tabs .button { margin-top: 0; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.column { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: .5rem; min-width: 0; } .column h2 { font-size: 1rem; margin: .25rem 0 .5rem; }
.card.task { padding: .6rem; margin-bottom: .5rem; } .card.task h3 { font-size: .95rem; }
.badge.p-high, .badge.p-critical { background: var(--warn-bg); color: var(--warn); border-color: transparent; } .badge.p-critical { color: var(--err); }
.badge.t-completed { background: var(--ok-bg); color: var(--ok); border-color: transparent; } .badge.t-in_progress { color: var(--accent); border-color: var(--accent); }
a.badge { text-decoration: none; }
progress { width: 6rem; vertical-align: middle; accent-color: var(--accent); }
.comment { border-top: 1px solid var(--line); padding: .5rem 0; } .comment p { margin: .2rem 0; }
ul.notes { list-style: none; padding: 0; } ul.notes li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
ul.notes li.unread { background: var(--surface); border-left: 4px solid var(--accent); }
button.note { text-align: left; color: var(--text); text-decoration: none; } button.note:hover { text-decoration: underline; }
.tasks-in-report .task-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.tasks-in-report select, input.pct { width: auto; min-width: 0; } input.pct { width: 5rem; }
.ann-urgent { border-left: 4px solid var(--err); } .ann-important { border-left: 4px solid #b45309; }
@media (max-width: 760px) { .board { grid-auto-flow: row; grid-auto-columns: auto; } .bell { margin-right: .5rem; } }
