/* ===== Theme tokens ===== */
:root {
  --bg-top: #cfe7fb;          /* baby blue */
  --bg-bottom: #eef7ff;
  --surface: #ffffff;         /* primary: white */
  --surface-2: #f3f8fd;
  --surface-3: #e7f0f9;
  --text: #0b1520;            /* black text */
  --muted: #5a6b7d;
  --border: #d2dde8;
  --border-strong: #b4c4d4;
  --accent: #1f5fae;
  --accent-hover: #174b8b;
  --accent-soft: #e2edf9;
  --on-accent: #ffffff;
  --short-bg: #fbd3d3; --short-text: #9b1c1c; --short-strong: #d93b3b;
  --at-bg: #fde9c4;    --at-text: #7c4a00;
  --ok-bg: #dcf2e2;    --ok-text: #1b6533;
  --holiday-bg: #ebe2fb; --holiday-text: #5a2ea6;
  --weekend-bg: #f0f5fa;
  --leave-bg: #fff3d6;  --leave-text: #7a5200;
  --train-bg: #e6e9ee;  --train-text: #4a5563;
  --cover-bg: #dff1f7;  --cover-text: #0c5a75;
  --variant-bg: #e3ecff; --variant-text: #2140a0;
  --shadow: 0 1px 2px rgba(16, 38, 64, .06), 0 4px 16px rgba(16, 38, 64, .08);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-top: #0c1622; --bg-bottom: #122133;
    --surface: #152231; --surface-2: #1a2a3c; --surface-3: #213448;
    --text: #e6edf5; --muted: #9aabbe; --border: #2a3d52; --border-strong: #3a526b;
    --accent: #6aa8f0; --accent-hover: #8cbdf5; --accent-soft: #1d3350; --on-accent: #08121d;
    --short-bg: #5a1d22; --short-text: #ffc9c9; --short-strong: #ef5b5b;
    --at-bg: #4d3a12; --at-text: #ffe0a3;
    --ok-bg: #173d27; --ok-text: #b5ecc6;
    --holiday-bg: #33264f; --holiday-text: #d7c6ff;
    --weekend-bg: #182838;
    --leave-bg: #43361a; --leave-text: #ffe2a8;
    --train-bg: #2a3440; --train-text: #c3ccd7;
    --cover-bg: #123b4a; --cover-text: #a9e3f5;
    --variant-bg: #22305a; --variant-text: #c3d2ff;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg-top: #0c1622; --bg-bottom: #122133;
  --surface: #152231; --surface-2: #1a2a3c; --surface-3: #213448;
  --text: #e6edf5; --muted: #9aabbe; --border: #2a3d52; --border-strong: #3a526b;
  --accent: #6aa8f0; --accent-hover: #8cbdf5; --accent-soft: #1d3350; --on-accent: #08121d;
  --short-bg: #5a1d22; --short-text: #ffc9c9; --short-strong: #ef5b5b;
  --at-bg: #4d3a12; --at-text: #ffe0a3;
  --ok-bg: #173d27; --ok-text: #b5ecc6;
  --holiday-bg: #33264f; --holiday-text: #d7c6ff;
  --weekend-bg: #182838;
  --leave-bg: #43361a; --leave-text: #ffe2a8;
  --train-bg: #2a3440; --train-text: #c3ccd7;
  --cover-bg: #123b4a; --cover-text: #a9e3f5;
  --variant-bg: #22305a; --variant-text: #c3d2ff;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom)) fixed;
  background-color: var(--bg-bottom);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Top bar ===== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; min-height: 56px;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 650; white-space: nowrap; }
.brand .logo {
  background: var(--accent); color: var(--on-accent);
  font-weight: 800; letter-spacing: .5px; font-size: 12px;
  padding: 5px 7px; border-radius: 6px;
}
.brand .sub { font-weight: 500; color: var(--muted); }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--muted); padding: 8px 11px; border-radius: 8px; font-weight: 550; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav .sep { width: 1px; background: var(--border); margin: 8px 6px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.user-chip .role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.topbar .nav-toggle { display: none; }

/* ===== Layout ===== */
main { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.day-cards > .card, .grid-2 > .card { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
footer.site-footer {
  color: var(--muted); font-size: 12px; text-align: center; padding: 16px 20px 24px;
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center;
}

/* ===== Controls ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 550; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--short-text); border-color: var(--short-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.icon { padding: 7px 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; cursor: pointer; font-weight: 550; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
input[type=text], input[type=email], input[type=search], input[type=date], input[type=time], input[type=number], input[type=month], select, textarea {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 13px; }
label.field > span.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* ===== Pills & legend ===== */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.short { background: var(--short-bg); color: var(--short-text); }
.pill.at { background: var(--at-bg); color: var(--at-text); }
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.holiday { background: var(--holiday-bg); color: var(--holiday-text); }
.pill.neutral { background: var(--surface-3); color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend .k { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 4px; font-weight: 700; font-size: 11px; border: 1px solid var(--border); }

/* ===== Alerts ===== */
.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border: 1px solid transparent; }
.alert.warn { background: var(--at-bg); color: var(--at-text); }
.alert.info { background: var(--accent-soft); color: var(--text); border-color: var(--border); }

/* ===== Schedule grid ===== */
.grid-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); max-height: calc(100vh - 220px); }
table.sched { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
table.sched th, table.sched td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0; text-align: center; height: 28px; }
table.sched thead th { position: sticky; background: var(--surface-2); z-index: 3; font-weight: 600; }
table.sched thead tr.r-month th { top: 0; height: 26px; }
table.sched thead tr.r-num th { top: 26px; height: 26px; }
table.sched thead tr.r-dow th { top: 52px; height: 22px; font-size: 11px; color: var(--muted); font-weight: 600; }
table.sched .namecol { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 0 10px; min-width: 170px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--border-strong); }
table.sched thead .namecol { z-index: 4; background: var(--surface-2); }
table.sched.month td.day, table.sched.month th.day { width: 34px; min-width: 34px; }
table.sched.week td.day, table.sched.week th.day { width: 110px; min-width: 110px; }
table.sched th.day.out { color: var(--muted); opacity: .6; }
table.sched th.day.weekend, table.sched td.day.weekend { background: var(--weekend-bg); }
table.sched th.day.holiday, table.sched td.day.holiday { background: var(--holiday-bg); }
table.sched th.day.today { box-shadow: inset 0 -3px 0 var(--accent); }
table.sched tr.r-num th.day.short { background: var(--short-strong); color: #fff; }
table.sched th.clickable { cursor: pointer; }
table.sched th.clickable:hover { filter: brightness(.95); }

tr.section th { position: sticky; left: 0; background: var(--accent); color: var(--on-accent); text-align: left; padding: 0; height: 32px; cursor: pointer; }
tr.section th .inner { position: sticky; left: 0; display: inline-flex; gap: 10px; align-items: center; padding: 0 10px; }
tr.section th .caret { display: inline-block; transition: transform .15s; }
tr.section.collapsed th .caret { transform: rotate(-90deg); }
tr.section th .meta { font-weight: 400; opacity: .85; font-size: 12px; }
tr.group td { background: var(--surface-3); text-align: left; font-weight: 650; font-size: 12px; color: var(--muted); height: 24px; }
tr.group td .inner { position: sticky; left: 0; padding: 0 10px; display: inline-block; }
tr.person td.namecol .nc { display: flex; align-items: center; gap: 6px; }
tr.person td.namecol .tag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
tr.person.nocount td.namecol { color: var(--muted); }
tr.person.covering td.namecol { font-style: italic; }
tr.person.hl td.namecol { background: var(--accent-soft); }

td.day .c { display: grid; place-items: center; width: 100%; height: 100%; font-weight: 650; font-size: 12px; }
td.day.editable { cursor: pointer; }
td.day.editable:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
td.day .c.work { color: var(--text); }
td.day .c.variant { background: var(--variant-bg); color: var(--variant-text); }
td.day .c.train { background: var(--train-bg); color: var(--train-text); }
td.day .c.leave { background: var(--leave-bg); color: var(--leave-text); }
td.day .c.partial { box-shadow: inset 0 -3px 0 var(--leave-text); }
td.day .c.cover { background: var(--cover-bg); color: var(--cover-text); font-size: 10px; }
td.day .c.gone { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--surface-3) 4px 8px); }
td.day .c.ov::after { content: ''; position: absolute; }
td.day { position: relative; }
td.day.ovr::before { content: ''; position: absolute; top: 0; right: 0; border: 4px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent); }
table.sched.week td.day .c { font-size: 12px; font-weight: 600; }
table.sched.week td.day .c small { display: block; font-weight: 400; font-size: 10.5px; opacity: .8; }

tr.coverage td { background: var(--surface-2); font-weight: 700; height: 28px; }
tr.coverage td.namecol { background: var(--surface-2); font-weight: 650; }
tr.coverage td.day.short { background: var(--short-bg); color: var(--short-text); }
tr.coverage td.day.at { background: var(--at-bg); color: var(--at-text); }
tr.coverage td.day.ok { color: var(--ok-text); }
tr.coverage td.day small { font-weight: 500; opacity: .75; font-size: 10px; }
tr.coverage { border-bottom: 2px solid var(--border-strong); }

/* ===== Day view ===== */
.day-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.day-card .hdr { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.day-card .times { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.day-card ul { list-style: none; margin: 0; padding: 0; }
.day-card li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.day-card li .who { display: flex; flex-direction: column; }
.day-card li .who small { color: var(--muted); }
.day-card details { margin-top: 10px; }
.day-card summary { cursor: pointer; color: var(--muted); font-weight: 600; }

/* ===== Personal calendar ===== */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dh { text-align: center; font-size: 12px; font-weight: 650; color: var(--muted); padding: 4px 0; }
.cal .cell { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-height: 84px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal .cell.out { opacity: .45; }
.cal .cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .cell .n { font-weight: 700; font-size: 12px; display: flex; justify-content: space-between; }
.cal .cell .tag { font-size: 11.5px; padding: 3px 6px; border-radius: 6px; font-weight: 600; }
.cal .cell .tag.work { background: var(--accent-soft); color: var(--accent); }
.cal .cell .tag.variant { background: var(--variant-bg); color: var(--variant-text); }
.cal .cell .tag.off { background: var(--surface-3); color: var(--muted); }
.cal .cell .tag.leave { background: var(--leave-bg); color: var(--leave-text); }
.cal .cell .tag.train { background: var(--train-bg); color: var(--train-text); }
.cal .cell .tag.cover { background: var(--cover-bg); color: var(--cover-text); }
.cal .cell .hol { font-size: 11px; color: var(--holiday-text); background: var(--holiday-bg); border-radius: 6px; padding: 2px 6px; font-weight: 600; }

/* ===== Tables ===== */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .3px; background: var(--surface-2); }
table.list tr:hover td { background: var(--surface-2); }
table.list td.num, table.list th.num { text-align: center; }
.table-wrap { overflow-x: auto; }
table.mins input { width: 60px; text-align: center; }

/* ===== Modal / popover / toast ===== */
dialog.modal { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog.modal::backdrop { background: rgba(10, 22, 36, .45); }
dialog.modal .m-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
dialog.modal .m-head h2 { margin: 0; }
dialog.modal .m-body { padding: 18px; overflow: auto; max-height: calc(100vh - 180px); }
dialog.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
dialog.modal .m-foot .left { margin-right: auto; }
.popover { position: absolute; z-index: 100; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px; min-width: 210px; }
.popover .ph { padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.popover .ph small { color: var(--muted); display: block; }
.popover button { display: flex; width: 100%; align-items: center; gap: 8px; background: none; border: 0; padding: 7px 8px; border-radius: 6px; cursor: pointer; text-align: left; }
.popover button:hover { background: var(--surface-2); }
.popover button .sw { min-width: 26px; text-align: center; font-weight: 700; font-size: 11px; border-radius: 4px; padding: 2px 0; border: 1px solid var(--border); }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 550; }

.impact { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.impact .ih { background: var(--surface-2); padding: 8px 12px; font-weight: 650; font-size: 13px; }
.impact table { width: 100%; border-collapse: collapse; font-size: 13px; }
.impact td { padding: 6px 12px; border-top: 1px solid var(--border); }

/* ===== Sign-in ===== */
.signin { max-width: 980px; margin: 30px auto; display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; align-items: start; }
.signin .brand-lg { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.signin .brand-lg .logo { background: var(--accent); color: var(--on-accent); font-weight: 800; padding: 8px 10px; border-radius: 8px; }
.sso-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; margin-top: 10px; }
.sso-btn:hover { background: var(--surface-2); }
.sso-btn .ms { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.sso-btn .ms i { width: 9px; height: 9px; display: block; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 8px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.role-cards { display: grid; gap: 12px; }
.role-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); display: grid; gap: 10px; }
.role-card .rh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.role-card p { margin: 0; color: var(--muted); font-size: 13px; }
.role-card .row { display: flex; gap: 8px; }
.role-card .row select { flex: 1; }
.demo-badge { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; background: var(--at-bg); color: var(--at-text); padding: 3px 8px; border-radius: 999px; }

.week-editor { display: grid; grid-template-columns: 60px repeat(7, 1fr) 32px; gap: 4px; align-items: center; }
.week-editor .h { font-size: 11px; font-weight: 650; color: var(--muted); text-align: center; }
.week-editor select { padding: 5px 2px; text-align: center; }
.order-list { list-style: none; margin: 0; padding: 0; }
.order-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.order-list li .n { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.order-list li .name { flex: 1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .brand .sub { display: none; }
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .topbar .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav { display: none; order: 10; flex-basis: 100%; flex-direction: column; padding-bottom: 8px; }
  .nav.open { display: flex; }
  .nav .sep { display: none; }
  .user-chip { display: none; }
  main { padding: 16px; }
  .signin { grid-template-columns: 1fr; margin-top: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  table.sched .namecol { min-width: 120px; max-width: 130px; }
  .grid-wrap { max-height: none; }
}
@media (max-width: 560px) {
  .cal .cell { min-height: 60px; padding: 4px; }
  .cal .cell .tag { font-size: 10px; padding: 2px 3px; }
  .cal .cell .tag .t { display: none; }
}

/* ===== On-call ===== */
tr.section.oncall th { background: var(--oncall); }
tr.oncall-row td { height: 28px; }
tr.oncall-row td.namecol { font-weight: 600; font-size: 12px; }
td.oc { background: var(--oncall-soft); color: var(--oncall-text); font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 1px; border-left: 2px solid var(--oncall); }
td.oc.conflict { background: var(--at-bg); color: var(--at-text); }
td.oc.hl { box-shadow: inset 0 0 0 2px var(--accent); }
.oc-card .who { font-size: 18px; font-weight: 700; margin: 4px 0 2px; }
.oc-card .phone { font-size: 15px; font-weight: 600; }
.oc-card .phone a { text-decoration: none; }
.oc-card .when { color: var(--muted); font-size: 12px; }
.oc-card .next { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.oc-card .next strong { color: var(--text); }
:root { --oncall: #5b3fa6; --oncall-soft: #efe9fb; --oncall-text: #45308a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --oncall: #8f74e0; --oncall-soft: #2c2350; --oncall-text: #d9ccff; } }
:root[data-theme="dark"] { --oncall: #8f74e0; --oncall-soft: #2c2350; --oncall-text: #d9ccff; }
td.oc.daycover { background: var(--cover-bg); color: var(--cover-text); border-left-style: dashed; }
td.day .c.holoff { color: var(--holiday-text); font-weight: 700; }

/* ===== Events ===== */
.ev-blue   { --ev: #2f6fd6; --ev-soft: #e1ebfb; --ev-text: #1d4d9e; }
.ev-green  { --ev: #2e8b57; --ev-soft: #ddf2e5; --ev-text: #1d6440; }
.ev-orange { --ev: #d9822b; --ev-soft: #fcebd9; --ev-text: #8a4c10; }
.ev-pink   { --ev: #c2417f; --ev-soft: #f9e0ec; --ev-text: #8c2659; }
.ev-teal   { --ev: #158c8c; --ev-soft: #d9f1f1; --ev-text: #0d5f5f; }
.ev-slate  { --ev: #56677a; --ev-soft: #e6eaef; --ev-text: #3a4756; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ev-blue { --ev-soft: #1d3150; --ev-text: #b9d0f5; }
  :root:not([data-theme="light"]) .ev-green { --ev-soft: #173a29; --ev-text: #b2e3c6; }
  :root:not([data-theme="light"]) .ev-orange { --ev-soft: #45301a; --ev-text: #f5cfa4; }
  :root:not([data-theme="light"]) .ev-pink { --ev-soft: #45202f; --ev-text: #f3bcd5; }
  :root:not([data-theme="light"]) .ev-teal { --ev-soft: #133a3a; --ev-text: #a9e3e3; }
  :root:not([data-theme="light"]) .ev-slate { --ev-soft: #263240; --ev-text: #c9d3de; }
}
:root[data-theme="dark"] .ev-blue { --ev-soft: #1d3150; --ev-text: #b9d0f5; }
:root[data-theme="dark"] .ev-green { --ev-soft: #173a29; --ev-text: #b2e3c6; }
:root[data-theme="dark"] .ev-orange { --ev-soft: #45301a; --ev-text: #f5cfa4; }
:root[data-theme="dark"] .ev-pink { --ev-soft: #45202f; --ev-text: #f3bcd5; }
:root[data-theme="dark"] .ev-teal { --ev-soft: #133a3a; --ev-text: #a9e3e3; }
:root[data-theme="dark"] .ev-slate { --ev-soft: #263240; --ev-text: #c9d3de; }
.ev-chip { display: inline-block; background: var(--ev-soft); color: var(--ev-text); border-left: 3px solid var(--ev); border-radius: 4px; padding: 1px 6px; font-size: 11.5px; font-weight: 650; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
tr.event-row td { height: 24px; }
tr.event-row td.namecol { font-weight: 650; font-size: 12px; color: var(--muted); }
td.evcell { background: var(--ev-soft); color: var(--ev-text); border-left: 3px solid var(--ev) !important; font-weight: 650; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 1px; }
td.evcell.clickable { cursor: pointer; }
td.evcell.clickable:hover { filter: brightness(.96); }
td.ev-gap { background: var(--surface); }
table.sched thead tr.r-dow th.evday { background: var(--ev); color: #fff; }
.ev-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.ev-swatch input { position: absolute; opacity: 0; }
.ev-swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--ev); cursor: pointer; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.ev-swatch input:checked + span { box-shadow: 0 0 0 3px var(--text); }
.ev-swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal .cell .ev-chip { font-size: 10.5px; }

/* ===== Lates (managers only) ===== */
td.day.late::after { content: ''; position: absolute; left: 3px; bottom: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--short-strong); box-shadow: 0 0 0 1.5px var(--surface); }

/* ===== Reports ===== */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.tile .tl { font-size: 12px; color: var(--muted); }
.tile .tv { font-size: 24px; font-weight: 650; }
.tile .tu { font-size: 13px; font-weight: 500; color: var(--muted); }
.counter { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--short-bg); color: var(--short-text); font-weight: 700; font-variant-numeric: tabular-nums; }
table.list td.num { font-variant-numeric: tabular-nums; }
tr.clickrow { cursor: pointer; }
tr.clickrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
svg.spark { display: block; }
svg.spark .sp { fill: var(--border-strong); }
svg.spark .sp-now { fill: var(--accent); }
svg.spark .sp-base { stroke: var(--border-strong); stroke-width: 1; }
.chart-wrap { position: relative; }
svg.team-chart { width: 100%; height: auto; display: block; }
svg.team-chart .grid { stroke: var(--border); stroke-width: 1; }
svg.team-chart .base { stroke: var(--border-strong); stroke-width: 1; }
svg.team-chart .ax { fill: var(--muted); font-size: 11px; }
svg.team-chart .b { fill: var(--border-strong); }
svg.team-chart .b-now { fill: var(--accent); }
svg.team-chart g.bar.hover .b, svg.team-chart g.bar.hover .b-now { fill: var(--accent-hover); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; } .tile .tv { font-size: 20px; } }
td.evcell.one { overflow: visible; text-overflow: clip; position: relative; }
td.evcell.one span { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); white-space: nowrap; z-index: 1; color: var(--ev-text); }
tr.event-row td.ev-gap { background: transparent; }

/* ===== Event staffing ===== */
table.staff-table tr.grp td { background: var(--surface-3); }
table.staff-table tr.unassigned td:first-child { box-shadow: inset 3px 0 0 var(--at-text); }
table.staff-table select { max-width: 230px; }

/* ===== Account menu ===== */
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 4px 8px 4px 4px; cursor: pointer; color: inherit; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); }
.user-btn .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: .3px; flex: none; }
.user-btn .caret { color: var(--muted); font-size: 11px; }
@media (max-width: 860px) { .user-btn .caret { display: none; } }

/* ===== User guide ===== */
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-toc { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 1px; padding: 12px; max-height: calc(100vh - 100px); overflow: auto; }
.help-toc .tg { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 10px 8px 4px; }
.help-toc .tg:first-child { margin-top: 2px; }
.help-toc a { text-decoration: none; color: var(--text); padding: 5px 8px; border-radius: 6px; font-size: 13px; }
.help-toc a:hover { background: var(--surface-2); }
.help-toc a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.help-body { display: grid; gap: 14px; min-width: 0; }
.help-group { margin: 10px 0 0; font-size: 18px; }
.help-group:first-child { margin-top: 0; }
.help-sec { scroll-margin-top: 76px; line-height: 1.6; }
.help-sec + .help-sec { margin-top: 0; }
.help-sec h3 { font-size: 16px; margin-bottom: 8px; }
.help-sec h4 { font-size: 13.5px; margin: 14px 0 4px; }
.help-sec p, .help-sec li, .help-sec dd { max-width: 75ch; }
.help-sec ul, .help-sec ol { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.help-sec.flash { animation: helpflash 2.2s ease-out 1; }
@keyframes helpflash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) { .help-sec.flash { animation: none; box-shadow: 0 0 0 3px var(--accent); } }
.hsw { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); font-weight: 700; font-size: 11px; vertical-align: 1px; }
.hbtn { display: inline-block; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 7px; font-size: 12px; font-weight: 600; line-height: 20px; background: var(--surface-2); white-space: nowrap; }
.hcodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; margin: 6px 0 8px; font-size: 13px; }
.hcodes > div { display: flex; align-items: center; gap: 8px; }
.hcorner { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--border); position: relative; vertical-align: -2px; }
.hcorner::after { content: ''; position: absolute; top: 0; right: 0; border: 4px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent); }
.hdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--short-strong); vertical-align: 1px; }
.hfaq dt { font-weight: 650; margin-top: 10px; }
.hfaq dd { margin: 2px 0 0; color: var(--muted); }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-toc { position: static; max-height: none; }
}
@media print {
  .topbar, .site-footer, .help-toc, .page-head .toolbar, .toast-host { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .help-layout { display: block; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .help-sec.hidden { display: none !important; }
  .help-group { break-after: avoid; }
}

/* ===== Phone numbers ===== */
.phone-wrap { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.phone-wrap a { text-decoration: none; }
.phone-wrap a:hover { text-decoration: underline; }
.copy-btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 6px; font-size: 11px; font-weight: 600; padding: 1px 6px; cursor: pointer; line-height: 16px; }
.copy-btn:hover { color: var(--text); background: var(--surface-2); }
