/* Week Planner styles. Light + dark (data-theme="light|dark|system"). */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eef0f4;
  --text: #1c2230; --muted: #667085; --line: #e1e4ea; --line-2: #cfd4dc;
  --navy: #1d2b4f; --navy-2: #2c3d68; --on-navy: #ffffff;
  --accent: #2f5bd3; --accent-soft: #e8eefc;
  --red: #c9302c; --red-soft: #fdecea; --red-line: #f3b9b5;
  --amber: #a15c00; --amber-soft: #fff4e0; --amber-line: #f5cf8f;
  --green: #217a4a; --green-soft: #e5f5ec; --green-line: #a9dcbf;
  --teal: #0f6f78; --teal-soft: #e1f3f4;
  --pto: #b0306f; --pto-soft: #fcebf4; --pto-line: #f0b6d3;
  --gold: #d9a21b;
  --p1: #c9302c; --p2: #d9731b; --p3: #2f5bd3; --p4: #7a8394;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #12151c; --surface: #1a1f29; --surface-2: #1f2531; --surface-3: #272e3c;
    --text: #e6e9ef; --muted: #9aa3b5; --line: #2c3442; --line-2: #3a4456;
    --navy: #0d1424; --navy-2: #1c2943;
    --accent: #7b9cff; --accent-soft: #23304f;
    --red: #ff7a72; --red-soft: #3a1d1e; --red-line: #6b2f2c;
    --amber: #f2b45a; --amber-soft: #3a2c15; --amber-line: #6b5124;
    --green: #5fcf8f; --green-soft: #173325; --green-line: #2c5c41;
    --teal: #5ccbd4; --teal-soft: #15343a;
    --pto: #f58bc0; --pto-soft: #3a1a2b; --pto-line: #6b2f4e;
    --p1: #ff7a72; --p2: #ffa45c; --p3: #7b9cff; --p4: #9aa3b5;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151c; --surface: #1a1f29; --surface-2: #1f2531; --surface-3: #272e3c;
  --text: #e6e9ef; --muted: #9aa3b5; --line: #2c3442; --line-2: #3a4456;
  --navy: #0d1424; --navy-2: #1c2943;
  --accent: #7b9cff; --accent-soft: #23304f;
  --red: #ff7a72; --red-soft: #3a1d1e; --red-line: #6b2f2c;
  --amber: #f2b45a; --amber-soft: #3a2c15; --amber-line: #6b5124;
  --green: #5fcf8f; --green-soft: #173325; --green-line: #2c5c41;
  --teal: #5ccbd4; --teal-soft: #15343a;
  --pto: #f58bc0; --pto-soft: #3a1a2b; --pto-line: #6b2f4e;
  --p1: #ff7a72; --p2: #ffa45c; --p3: #7b9cff; --p4: #9aa3b5;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface); min-width: 0;
}
textarea { resize: vertical; }
input:disabled, select:disabled { opacity: .55; }
table { border-collapse: collapse; width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 6px; }

/* utilities */
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap { gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.pad { padding: 16px; }
.inline { display: inline; margin: 0; }
.dim { opacity: .5; }
.text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-green { color: var(--green); } .text-pto { color: var(--pto); }
.link-red { color: var(--red); font-weight: 600; }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* shell */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--navy); color: var(--on-navy); }
.brand { color: #fff; font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.me-link { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 500; }
.btn-ghost-light { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.btn-ghost-light:hover { background: rgba(255,255,255,.1); }
.tabs { display: flex; gap: 2px; padding: 0 20px; background: var(--navy-2); overflow-x: auto; }
.tabs a { color: rgba(255,255,255,.78); padding: 10px 14px; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: #fff; text-decoration: none; }
.tabs a.on { color: #fff; border-bottom-color: var(--gold); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700; text-align: center; color: #fff; line-height: 18px; }
.badge-red { background: #d64541; } .badge-amber { background: #c98400; }
.page { max-width: 1600px; margin: 0 auto; padding: 18px 20px 60px; display: flex; flex-direction: column; gap: 14px; }
.page > * { min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.section-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.flash { padding: 10px 14px; border-radius: 8px; background: var(--green-soft); border: 1px solid var(--green-line); color: var(--green); font-weight: 500; }
.flash-error { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.flash-warn { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: var(--green); filter: brightness(1.08); }
.btn-amber { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.btn-danger { background: var(--surface); border-color: var(--red-line); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-light { background: #fff; color: #9c1f1b; border-color: #fff; }
.btn-dashed { border-style: dashed; background: transparent; }
.btn-announce { background: rgba(255,255,255,.95); color: #9c1f1b; border-color: transparent; }
[data-theme="dark"] .btn-primary, [data-theme="dark"] .btn-green { color: #0d1424; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .btn-primary, [data-theme="system"] .btn-green { color: #0d1424; } }

/* segmented + filters */
.weekbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.weekbar strong { font-size: 16px; }
.filters { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 14px; }
.seg-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--surface); flex-wrap: wrap; margin: 0; }
.seg a, .seg button { padding: 5px 11px; color: var(--text); font-size: 12.5px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; white-space: nowrap; }
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg a:hover, .seg button:hover { background: var(--surface-3); text-decoration: none; }
.seg .on { background: var(--navy); color: #fff; }
[data-theme="dark"] .seg .on { background: var(--accent); color: #0d1424; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .seg .on { background: var(--accent); color: #0d1424; } }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 12.5px; }
.chk:hover { text-decoration: none; }
.box { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 4px; font-size: 11px; background: var(--surface); }

/* announcements */
.announce { background: #b42520; color: #fff; border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.announce h2 { color: #fff; font-size: 15px; }
.announce .small { color: rgba(255,255,255,.85); }
.announce .link-red { color: #fff; text-decoration: underline; }
.announce ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.announce li { display: flex; gap: 8px; align-items: baseline; font-weight: 500; }
.scope { flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: rgba(255,255,255,.2); }

/* on-call */
.oncall summary { padding: 11px 14px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; list-style: none; }
.oncall summary::-webkit-details-marker { display: none; }
.oncall summary::before { content: '▸'; color: var(--muted); }
.oncall[open] summary::before { content: '▾'; }
.oncall summary strong { margin-right: 10px; }
.oncall-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 4px 14px 14px; }
.oncall-body h3 { margin-bottom: 6px; }
table.mini th, table.mini td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
table.mini th { color: var(--muted); font-weight: 600; }
table.mini tr.now td { background: var(--amber-soft); }

/* timer */
.timer, .timer-idle { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.timer-idle { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.timer { border-color: var(--green-line); }
.timer.paused { border-color: var(--amber-line); }
.timer.is-over { border-color: var(--red-line); }
.timer-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); animation: pulse 1.4s infinite; }
.timer.paused .timer-dot { background: var(--amber); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.timer-clock { font: 600 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--green); transition: width .4s; }
.timer.is-over .bar > div { background: var(--red); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.cmp-wrike { border-left: 3px solid #08cf65; }
.alert-near, .alert-over { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 8px; }
.alert-near { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.alert-over { background: #b42520; color: #fff; }

/* pills & chips */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted); border: 1px solid transparent; }
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.pill-gray { background: var(--surface-3); color: var(--muted); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.pill-teal { background: var(--teal-soft); color: var(--teal); }
.pill-navy { background: var(--navy); color: #fff; }
.pill-pto { background: var(--pto-soft); color: var(--pto); border-color: var(--pto-line); }
.pill-unavail { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.pill-outline { background: transparent; border-color: var(--line-2); color: var(--text); }
.role-FT { background: var(--accent-soft); color: var(--accent); }
.role-PT { background: var(--teal-soft); color: var(--teal); }
.role-CT { background: var(--amber-soft); color: var(--amber); }
.chip { display: inline-flex; align-items: center; padding: 0 6px; height: 19px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
a.chip:hover { text-decoration: none; filter: brightness(.95); }
.chip-outline { background: transparent; border-color: var(--line-2); color: var(--text); }
.chip-wrike { background: #e3f9ee; color: #0b7a3e; }
[data-theme="dark"] .chip-wrike { background: #133524; color: #5fe39a; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .chip-wrike { background: #133524; color: #5fe39a; } }
.chip-wstat { background: transparent; border-color: var(--line-2); }
.chip-wstat.over { color: var(--red); border-color: var(--red-line); }
.chip-time { background: var(--accent-soft); color: var(--accent); }
.chip-rec { background: var(--teal-soft); color: var(--teal); }
.chip-warn { background: var(--pto-soft); color: var(--pto); border-color: var(--pto-line); }
.chip-running { background: var(--green-soft); color: var(--green); }

/* priority + status */
.prio { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 19px; padding: 0 4px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #fff; }
.prio.p1 { background: var(--p1); } .prio.p2 { background: var(--p2); } .prio.p3 { background: var(--p3); } .prio.p4 { background: var(--p4); }
[data-theme="dark"] .prio { color: #0d1424; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .prio { color: #0d1424; } }
select.status { width: auto; padding: 0 20px 0 6px; height: 21px; font-size: 11px; font-weight: 600; border-radius: 5px; }
.status-chip { display: inline-flex; align-items: center; padding: 0 6px; height: 19px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.s-ns { background: var(--surface-3); color: var(--muted); }
.s-ip { background: var(--accent-soft); color: var(--accent); }
.s-pa { background: var(--amber-soft); color: var(--amber); }
.s-co { background: var(--green-soft); color: var(--green); }
.s-ca { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }

/* avatars */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: 700; flex: none; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-gold { background: var(--gold); color: #1d2b4f; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* planner */
.dept { display: flex; flex-direction: column; gap: 10px; }
.dept > h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; padding: 6px 2px 0; border-bottom: 2px solid var(--navy); padding-bottom: 6px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.person-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.person-name { font-weight: 700; color: var(--text); font-size: 14.5px; }
.days-scroll { overflow-x: auto; }
.days { display: grid; grid-template-columns: repeat(var(--cols), minmax(210px, 1fr)); }
.day { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 120px; min-width: 0; }
.day:last-child { border-right: 0; }
.day.today { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.day.pto { background: var(--pto-soft); }
.day.unavail { background: repeating-linear-gradient(135deg, var(--surface-3) 0 6px, var(--surface-2) 6px 12px); }
.pto-card.unavail { border-color: var(--line-2); border-left-color: var(--muted); }
.pto-card.unavail .pto-title { color: var(--text); }
.day.off { background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); }
.day-h { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.day-name { font-weight: 700; }
.day.today .day-name { color: var(--accent); }
.cap { font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 5px; border-radius: 4px; background: var(--surface-3); white-space: nowrap; }
.cap.over { background: var(--red-soft); color: var(--red); }
.day-f { display: flex; gap: 10px; flex-wrap: wrap; padding: 6px 8px; margin-top: auto; font-size: 12px; border-top: 1px dashed var(--line); }
.off-flag { font-size: 12px; color: var(--muted); padding: 8px; font-style: italic; }
.pto-card { margin: 6px; padding: 7px 9px; border-radius: 7px; background: var(--surface); border: 1px solid var(--pto-line); border-left: 4px solid var(--pto); }
.pto-title { font-weight: 700; color: var(--pto); font-size: 12.5px; }
.pto-sub { font-size: 12px; color: var(--muted); }
.pto-warn { font-size: 12px; color: var(--amber); font-weight: 600; margin-top: 3px; }

/* task rows */
.tasks { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.task { display: flex; gap: 6px; padding: 6px; border-radius: 7px; border: 1px solid transparent; }
.task:hover { background: var(--surface-2); border-color: var(--line); }
.task-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-title { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.btn-start { border: 1px solid var(--green-line); background: var(--green-soft); color: var(--green); border-radius: 5px; font-size: 11px; font-weight: 600; padding: 0 7px; height: 20px; cursor: pointer; }
.move { display: inline-flex; opacity: 0; transition: opacity .15s; }
.task:hover .move, .task:focus-within .move { opacity: 1; }
.move button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; padding: 0 3px; }
.move button:hover { color: var(--text); }
.tasks.wide .task { padding: 8px 10px; }
.tasks.wide .task-side { flex-direction: row; align-items: center; }
@media (hover: none) { .move { opacity: 1; } }

/* tooltips */
[data-tip] { position: relative; cursor: default; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: #111827; color: #fff; font-size: 11.5px; font-weight: 500; padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 50; pointer-events: none;
  max-width: 280px; white-space: normal; width: max-content; text-transform: none; letter-spacing: 0;
}

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid > label, .form-grid label:not(.check):not(.radio-btn) { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.full { grid-column: 1 / -1; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-btn { position: relative; display: inline-flex; cursor: pointer; }
.radio-btn input { position: absolute; opacity: 0; pointer-events: none; }
.radio-btn span { padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 7px; font-size: 12.5px; font-weight: 500; background: var(--surface); }
.radio-btn input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.radio-btn input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.form-grid > label.check { flex-direction: row; align-items: center; font-weight: 500; }
.check input { width: 16px; height: 16px; margin: 0; flex: none; }
.check-list { display: flex; flex-direction: column; gap: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.check-strip { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.input-suffix { display: flex; align-items: center; gap: 6px; }
.summary-box, .info-box, .wrike-box, .bamboo-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.wrike-box, .wrike-stats { border-left: 3px solid #08cf65; }
.wrike-stats { background: var(--surface-2); border: 1px solid var(--line); border-left-width: 3px; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.warn-box, .alert-box { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber); border-radius: 8px; padding: 9px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.alert-box { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.alert-box .check { color: var(--text); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.stat-v { font-size: 17px; font-weight: 700; }
.dept-pick { display: flex; flex-direction: column; gap: 4px; }
.dept-opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.daychips { display: inline-flex; gap: 2px; }
.daychips span { width: 22px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.daychips span.on { background: var(--navy); color: #fff; }
[data-theme="dark"] .daychips span.on { background: var(--accent); color: #0d1424; }

/* tables / layout */
.table-wrap { overflow-x: auto; }
table.grid th, table.grid td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 700; white-space: nowrap; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.inactive td, table.grid tr.closed td { opacity: .6; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.main-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.side-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.date-chip { flex: none; width: 42px; text-align: center; border-radius: 7px; background: var(--pto-soft); color: var(--pto); font-size: 10px; font-weight: 700; padding: 3px 0; line-height: 1.2; }
.date-chip .big { font-size: 17px; }
.sync-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border-radius: 8px; background: var(--green-soft); border: 1px solid var(--green-line); }
.sync-strip form { margin: 0; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.of-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.of-row:last-child { border-bottom: 0; }
.of-row form { display: flex; gap: 6px; align-items: center; margin: 0; }
.of-row select { width: auto; padding: 3px 6px; font-size: 12.5px; }

/* my week */
.profile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; }
.h-name { font-size: 19px; font-weight: 700; }
.day-card { overflow: hidden; }
.day-card.today { border-color: var(--accent); }
.day-card.off { opacity: .8; }
.day-card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.day-card .pto-card { margin: 8px 12px; }

/* discussions */
.disc td { font-size: 13px; }
.disc td form { margin: 0; }
.disc input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }
.notes { display: grid; gap: 4px; font-size: 12.5px; margin-top: 4px; }
.notes b { color: var(--muted); font-weight: 600; }
.history { margin-top: 6px; font-size: 12px; }
.history summary { cursor: pointer; color: var(--muted); }
.history ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.history li { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* recurring */
.rec-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; }
.rec-list { display: flex; flex-direction: column; gap: 6px; }
.rec-card { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface); }
.rec-card:hover { text-decoration: none; border-color: var(--line-2); background: var(--surface-2); }
.rec-card.on { border-color: var(--accent); background: var(--accent-soft); }
.rec-card.paused { opacity: .6; }
.rec-card.team { border-left: 3px solid var(--teal); }
.rec-edit { align-content: start; }

/* modal */
dialog#modal { border: 0; padding: 0; border-radius: 12px; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog#modal.wide { width: min(1180px, calc(100vw - 24px)); }
dialog#modal::backdrop { background: rgba(15, 20, 35, .55); }
.modal-shell { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-x { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.modal-x:hover { background: var(--surface-3); color: var(--text); }
.modal-content { padding: 16px 18px; overflow: auto; }
.modal-body-wrap { display: flex; flex-direction: column; gap: 12px; }
.modal-body-wrap .form-actions { position: sticky; bottom: -16px; background: var(--surface); padding-bottom: 4px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 9px 16px; border-radius: 8px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 1000; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #b42520; }

/* expand day */
.expand { display: flex; flex-direction: column; gap: 10px; }
.expand-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.expand-body { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; }
.expand-side { display: flex; flex-direction: column; gap: 10px; }
.expand-side [data-unsched] { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.un-card { border: 1px solid var(--line); border-left: 4px solid var(--p4); border-radius: 7px; padding: 6px 8px; background: var(--surface); cursor: grab; display: flex; flex-direction: column; gap: 4px; }
.un-card.p1 { border-left-color: var(--p1); } .un-card.p2 { border-left-color: var(--p2); } .un-card.p3 { border-left-color: var(--p3); }
.un-card.sel { outline: 2px solid var(--accent); }
.un-card select { width: auto; padding: 2px 4px; font-size: 11.5px; }
.add-blocks { display: flex; flex-direction: column; gap: 6px; }
.expand-cal { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.note-pto, .note-sel, .note-warn { font-size: 12.5px; padding: 7px 10px; border-radius: 7px; }
.note-pto { background: var(--pto-soft); color: var(--pto); border: 1px solid var(--pto-line); }
.note-sel { background: var(--accent-soft); color: var(--accent); }
.note-warn { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-line); }
.cal { display: grid; grid-template-columns: 70px minmax(0, 1fr); max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.cal-times { position: relative; border-right: 1px solid var(--line); }
.cal-t { position: absolute; right: 6px; font-size: 10.5px; color: var(--muted); transform: translateY(-6px); }
.cal-t:first-child { transform: none; }
.cal-t.hour { font-weight: 600; color: var(--text); }
.cal-grid { position: relative; }
.cal-slot { position: absolute; left: 0; right: 0; height: 22px; border-top: 1px dotted var(--line); }
.cal-slot.hour { border-top: 1px solid var(--line-2); }
.cal-slot.ooh { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 7px); }
.cal-t.ooh { color: var(--muted); opacity: .75; }
.cal-edge { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--accent); z-index: 1; pointer-events: none; }
.cal-edge span { position: absolute; right: 4px; top: 2px; font-size: 10px; font-weight: 600; color: var(--accent); background: var(--surface); padding: 0 4px; border-radius: 3px; }
.cal-block.overtime { outline: 2px dashed var(--amber); outline-offset: -2px; }
.expand-head .seg button:disabled { opacity: .45; cursor: default; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--red); z-index: 3; }
.cal-block { position: absolute; z-index: 2; border-radius: 6px; padding: 2px 6px; overflow: hidden; cursor: grab; font-size: 11.5px; line-height: 1.25;
  background: var(--accent-soft); border: 1px solid var(--accent); border-left-width: 4px; color: var(--text); }
.cal-block.p1 { border-color: var(--p1); } .cal-block.p2 { border-color: var(--p2); } .cal-block.p4 { border-color: var(--p4); background: var(--surface-3); }
.cal-block.k-new { background: var(--surface-3); border-color: var(--line-2); border-style: dashed; border-left-style: solid; }
.cal-block.k-pto { background: repeating-linear-gradient(135deg, var(--pto-soft) 0 8px, color-mix(in srgb, var(--pto-soft) 70%, var(--pto)) 8px 10px); border-color: var(--pto); color: var(--pto); font-weight: 600; }
.cal-block.running { box-shadow: 0 0 0 2px var(--green); }
.cal-block.sel { box-shadow: 0 0 0 2px var(--accent); z-index: 4; }
.cal-block.dragging, .un-card.dragging { opacity: .45; }
.cb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 64px; }
.cb-time { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.cal-block.tiny-block .cb-time { display: none; }
.cb-ctl { position: absolute; top: 1px; right: 2px; display: flex; gap: 1px; opacity: 0; }
.cal-block:hover .cb-ctl, .cal-block.sel .cb-ctl, .cal-block:focus-within .cb-ctl { opacity: 1; }
.cb-ctl button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 4px; font-size: 10px; padding: 0 4px; cursor: pointer; line-height: 16px; }
@media (hover: none) { .cb-ctl { opacity: 1; } }

/* login / setup */
.narrow { max-width: 440px; margin: 40px auto; width: 100%; padding: 22px; display: flex; flex-direction: column; gap: 14px; }

/* responsive */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .rec-layout { grid-template-columns: 1fr; }
  .expand-body { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .topbar { padding: 10px 16px; }
  .me-link span:last-child { display: none; }
  .tabs { padding: 0 8px; }
  .page { padding: 14px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .oncall-body, .cmp-grid { grid-template-columns: 1fr; }
  .days { grid-template-columns: repeat(var(--cols), minmax(240px, 82vw)); }
  .modal-content { padding: 14px; }
  .seg { max-width: 100%; }
  .timer-clock { font-size: 18px; }
}
