/* Flex Timetable customer dashboard. Plain CSS (no build step), follows the design canvas. */
:root {
    --ground: #EEF0EC;
    --side: #F8F9F6;
    --paper: #FFFFFF;
    --ink: #15201A;
    --ink-2: #3E4A43;
    --ink-3: #56625B;
    --line: #D5D9D3;
    --line-2: #E3E6E1;
    --line-3: #EEF0EC;
    --field: #B9C0B8;
    --accent: #1E6B4A;
    --accent-ink: #14532D;
    --ok-bg: #DCEBE2;
    --warn-bg: #FCEBD2;
    --warn-ink: #8A3B06;
    --amber-bg: #FBF1D3;
    --amber-ink: #4A3300;
    --muted-bg: #E9ECE8;
    --g1: #E3EFE8; --g1-line: #BCD3C5;
    --g2: #F8EBC8; --g2-line: #E2CF95;
    --g3: #E4E9F2; --g3-line: #BFC9DA;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --sans: 'IBM Plex Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: 12px; }
.sr { position: absolute; left: -9999px; }
.num { font-family: var(--mono); text-align: right; white-space: nowrap; }

/* shell */
.shell { min-height: 100vh; display: flex; align-items: stretch; }
.side { width: 240px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 20px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-weight: 600; font-size: 15px; color: var(--ink); text-decoration: none; }
.picker { position: relative; }
.picker > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); min-height: 44px; }
.picker > summary::-webkit-details-marker { display: none; }
.picker-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.picker-name b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-name span { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.picker-menu { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 6px 18px rgba(21, 32, 26, .08); }
.picker-menu h4 { margin: 6px 8px 2px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; color: var(--ink-3); }
.picker-menu button { all: unset; cursor: pointer; padding: 8px; border-radius: 4px; font-size: 13px; }
.picker-menu button:hover, .picker-menu button.on { background: var(--ground); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-3); padding: 0 10px 6px; }
.nav a, .nav span.item { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 5px; color: var(--ink); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--line-3); }
.nav a.on { background: var(--ink); color: #FFF; font-weight: 500; }
.nav .count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.nav a.on .count { color: #C9D2CC; }
.nav span.item { color: var(--ink-3); }
.nav .soon { font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 10px 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.side-foot b { display: block; font-size: 13px; }
.side-foot span { font-size: 12px; color: var(--ink-3); }
.linkbtn { all: unset; cursor: pointer; font-size: 12px; color: var(--accent); }
.linkbtn:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; padding: 28px 40px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1280px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.crumb { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.title { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; }
.lead { font-size: 14px; color: var(--ink-2); max-width: 720px; margin: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.grow { flex: 999 1 560px; min-width: 0; }
.aside { flex: 1 1 300px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec-head h2 { font-size: 15px; font-weight: 600; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--field); border-radius: 6px; background: var(--paper); color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 600; }
.btn-dark:hover { background: #24342B; color: #FFF; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-danger { background: #A3330E; border-color: #A3330E; color: #FFF; font-weight: 600; }
.btn-danger:hover { background: #7F2709; border-color: #7F2709; color: #FFF; }
.btn[disabled], .btn-dark[disabled] { opacity: .45; cursor: not-allowed; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--warn-ink); }
.btn-quiet:hover { border-color: transparent; text-decoration: underline; color: var(--warn-ink); }
form.inline { display: inline; margin: 0; }

/* panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.pad { padding: 18px 20px; }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.notice b { display: block; font-size: 14px; }
.notice span { font-size: 13px; color: var(--ink-2); }
.flash { padding: 12px 16px; border-radius: 8px; background: var(--ok-bg); color: var(--accent-ink); font-weight: 500; }
.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); line-height: 1.5; }
.howto b { color: var(--ink); }
.cardpick { display: flex; flex-direction: column; gap: 6px; }
.cardpick-rows { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cardpick-row { display: inline-flex; align-items: center; gap: 6px; }
.cardpick-name { font-size: 13px; min-width: 120px; }
.cardpick-name .muted { font-size: 11px; }
.cp-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; }
.cp-btn:hover:not(:disabled) { border-color: var(--ink); }
.cp-btn:disabled { opacity: .35; cursor: default; }
.cp-n { min-width: 22px; text-align: center; font-family: var(--mono); font-weight: 700; font-size: 15px; }
.field-wide { grid-column: 1 / -1; }
.setup > summary { cursor: pointer; list-style: none; }
.setup > summary::-webkit-details-marker { display: none; }
.setup > summary h2::before { content: "▸ "; color: var(--ink-3); }
.setup[open] > summary h2::before { content: "▾ "; }
.setup[open] > summary { margin-bottom: 12px; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ss { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line-2); }
.ss:first-child { border-top: 0; }
.ss-n { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink-3); background: var(--paper); }
.ss-done .ss-n { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--accent-ink); }
.ss-next .ss-n { background: var(--ink); border-color: var(--ink); color: #fff; }
.ss-next { background: #F6F8F5; border-radius: 6px; }
.ss-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ss-act { flex: none; display: inline-flex; align-items: center; gap: 12px; }
@media (max-width: 560px) { .ss { flex-wrap: wrap; } .ss-act { width: 100%; justify-content: flex-end; } }
.nextstep { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 4px; }
.startover { border-color: #F2C1B3; }
.startover > summary { cursor: pointer; }
.so-opts { display: flex; flex-direction: column; gap: 8px; }
.so-opts label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.so-opts label .small { display: block; }
.datacheck { border: 1px solid #F2C1B3; background: #FFF6F2; border-radius: 8px; padding: 10px 14px; color: var(--warn-ink); }
.datacheck > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.datacheck > summary .small { color: var(--ink-2); }
.dc-icon { width: 18px; height: 18px; border-radius: 50%; background: var(--warn-ink); color: #FFF; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.datacheck ul { margin: 8px 0 2px; padding-left: 18px; font-size: 13px; color: var(--ink); }
.datacheck li { margin: 3px 0; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 8px; background: var(--ink); color: #FFF; font-size: 14px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.toast-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; background: #2F855A; color: #FFF; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.toast-error { background: #FFF; color: var(--warn-ink); border: 1px solid #F2C1B3; }
.toast-error .toast-icon { background: var(--warn-ink); }
.toast-text { flex: 1; }
.toast-x { all: unset; cursor: pointer; flex: none; padding: 0 4px; opacity: .7; font-size: 13px; }
.toast-x:hover { opacity: 1; }
.btn[data-loading] { opacity: .6; pointer-events: none; }
.flash-error { background: var(--warn-bg); color: var(--warn-ink); }
.empty { padding: 28px 20px; text-align: center; color: var(--ink-2); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--accent-ink); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-muted { background: var(--muted-bg); color: var(--ink-2); }
.pill-run { background: var(--amber-bg); color: var(--amber-ink); }
.pill-round { border-radius: 999px; padding: 3px 9px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* tables */
.tbl-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--ink-3); font-size: 12px; font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td, .tbl tbody th { padding: 12px 16px; border-bottom: 1px solid var(--line-3); vertical-align: middle; }
.tbl tbody th { text-align: left; font-weight: 600; color: var(--ink); font-size: 13px; }
.tbl tr:last-child td, .tbl tr:last-child th { border-bottom: 0; }
.tbl tr.hl { background: #F6F8F5; }
.tbl .r { text-align: right; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tile { padding: 16px 18px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; }
.tile:last-child { border-right: 0; }
a.tile:hover { background: #F6F8F5; color: var(--ink); }
.tile .k { font-size: 12px; color: var(--ink-3); }
.tile .v { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1; }
.tile .d { font-size: 12px; color: var(--ink-2); }

/* lists */
.list { margin: 0; padding: 0; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.list > li { padding: 14px 16px; border-bottom: 1px solid var(--line-3); display: flex; flex-direction: column; gap: 4px; }
.list > li:last-child { border-bottom: 0; }
.list .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 600; }
.list .sub { font-size: 12px; color: var(--ink-2); }

/* heat cells (busiest teachers) */
.heat { display: block; text-align: center; padding: 6px 0; border-radius: 3px; background: var(--muted-bg); font-family: var(--mono); }
.heat.hot { background: var(--ink); color: #FFF; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label, .legend { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .select { min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; width: 100%; }
.input:focus, .select:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.choice b { display: block; font-size: 14px; font-weight: 600; }
.choice span { font-size: 13px; color: var(--ink-2); }
.choice.off { opacity: .5; cursor: not-allowed; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.day span { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 6px; background: var(--paper); font-size: 14px; }
.day input:checked + span { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 600; }
.day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
[x-cloak] { display: none !important; }
.savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; background: var(--paper); border: 1px solid var(--ink); border-radius: 8px; box-shadow: 0 6px 20px rgba(21, 32, 26, .12); }
.savebar .msg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; }
.savebar .actions { display: flex; gap: 8px; }
.savebar-error { border-color: var(--warn-ink); background: var(--warn-bg); color: var(--warn-ink); }
.input.bad { border-color: var(--warn-ink); box-shadow: inset 0 0 0 1px var(--warn-ink); background: var(--warn-bg); }
.input.need { border-color: #C9A227; box-shadow: inset 0 0 0 1px #C9A227; background: var(--amber-bg); }
.tagset.need { padding: 6px; border: 1px dashed #C9A227; border-radius: 6px; background: var(--amber-bg); }
.tagset.bad { padding: 6px; border: 1px solid var(--warn-ink); border-radius: 6px; background: var(--warn-bg); }
.rule.draft { border-color: #C9A227; box-shadow: inset 3px 0 0 #C9A227; }
.rule .todo { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--amber-ink); }
.handover { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.error { color: var(--warn-ink); font-size: 13px; }
.step { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.step + .step { border-top: 1px solid var(--line-2); }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #FFF; font-family: var(--mono); font-size: 12px; }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--field); border-radius: 6px; overflow: hidden; background: var(--paper); }
.seg a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; color: var(--ink); text-decoration: none; font-size: 14px; }
.seg a + a { border-left: 1px solid var(--field); }
.seg a.on { background: var(--ink); color: #FFF; font-weight: 500; }
.iconbtn { width: 42px; height: 42px; border: 1px solid var(--field); border-radius: 6px; background: var(--paper); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.toolbar .group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* timetable */
.tt-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.tt { min-width: 980px; display: grid; grid-template-columns: 96px 1fr; row-gap: 4px; }
.tt-head { position: relative; height: 44px; }
.tt-head span { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; padding-left: 4px; font-family: var(--mono); }
.tt-head b { font-size: 13px; font-weight: 600; }
.tt-head i { font-style: normal; font-size: 11px; color: var(--ink-3); }
.tt-day { display: flex; align-items: center; font-size: 14px; font-weight: 600; padding-right: 8px; }
.tt-row { position: relative; height: 88px; }
.tt-b { position: absolute; top: 0; bottom: 0; padding: 0 2px; }
.tt-b > div { height: 100%; border-radius: 4px; overflow: hidden; }
.b-slot > div { border: 1px dashed var(--line); }
.b-off > div { background: #DCE0DA; }
.b-break > div { background: var(--muted-bg); display: flex; align-items: center; justify-content: center; }
.b-break em { writing-mode: vertical-rl; transform: rotate(180deg); font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--ink-2); white-space: nowrap; }
.b-blocked > div, .b-unavailable > div { background: repeating-linear-gradient(135deg, #E9ECE8 0 6px, #DFE3DD 6px 12px); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-2); text-align: center; padding: 0 4px; }
.b-unavailable > div { background: repeating-linear-gradient(135deg, #FBF1D3 0 6px, #F3E5BA 6px 12px); color: var(--amber-ink); }
.b-card > div { background: var(--paper); border: 1px solid #C9CFC8; padding: 6px 9px; display: flex; flex-direction: column; justify-content: space-between; gap: 2px; min-width: 0; }
.b-card .s { font-size: 18px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-card .m { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-card.split > div { flex-direction: row; align-items: center; padding: 0 8px; gap: 6px; justify-content: space-between; }
.b-card.split .s { font-size: 14px; flex: none; overflow: visible; }
.b-card.split .m { text-align: right; min-width: 0; }
.b-card.t-g1 > div { background: var(--g1); border-color: var(--g1-line); }
.b-card.t-g2 > div { background: var(--g2); border-color: var(--g2-line); }
.b-card.t-g3 > div { background: var(--g3); border-color: var(--g3-line); }
.b-card.t-g1 .m, .b-card.t-g2 .m, .b-card.t-g3 .m { color: var(--ink-2); }
.legend-row { display: flex; flex-wrap: wrap; gap: 16px 22px; font-size: 12px; color: var(--ink-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 8px; }
.sw { width: 18px; height: 12px; border-radius: 2px; display: inline-block; border: 1px solid var(--line); }

/* run monitor */
.bar { height: 8px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.bar > div { height: 100%; background: var(--ink); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: grid; grid-template-columns: 18px 1fr auto; gap: 12px; align-items: start; }
.steps .tick { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--accent); }
.steps .now { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--ink); position: relative; }
.steps .wait { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); }
.steps b { display: block; font-size: 14px; font-weight: 600; }
.steps span { font-size: 13px; color: var(--ink-2); }
.chart { width: 100%; height: auto; display: block; }

/* history list */
.runlist { margin: 0; padding: 0; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.runlist a { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line-3); color: var(--ink); text-decoration: none; }
.runlist li:last-child a { border-bottom: 0; }
.runlist a:hover { background: #F6F8F5; }
.runlist a.on { background: var(--ink); color: #FFF; }
.runlist a.on .muted, .runlist a.on .soft { color: #C9D2CC; }
.runlist .l1, .runlist .l2 { display: flex; justify-content: space-between; gap: 8px; }
.runlist .l1 { font-size: 14px; font-weight: 600; }
.runlist .l2 { font-size: 12px; }
.runlist .l2 > span:last-child, .runlist .l1 > span:last-child { white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a { padding: 6px 10px; border: 1px solid var(--field); border-radius: 999px; background: var(--paper); color: var(--ink); text-decoration: none; font-size: 13px; }
.filters a.on { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 12px; padding: 4px 8px; border-radius: 4px; background: var(--ground); }
.moves { width: 100%; border-collapse: collapse; font-size: 13px; }
.moves td { padding: 7px 0; border-bottom: 1px solid var(--line-3); }
.moves tr:last-child td { border-bottom: 0; }
details > summary { cursor: pointer; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }

/* availability editor */
.avail { display: flex; flex-direction: column; gap: 10px; }
.avail-grid { border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.avail-grid th { font-weight: 400; }
.avail-head, .avail-day { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; font-family: var(--mono); color: var(--ink-3); padding: 2px; border-radius: 4px; }
.avail-head b { color: var(--ink); font-size: 12px; }
.avail-head span { font-size: 10px; }
.avail-day { font-family: var(--sans); font-weight: 600; color: var(--ink); font-size: 13px; padding: 0 8px 0 0; align-items: flex-start; }
.avail-head:hover, .avail-day:hover { background: var(--line-3); }
.cell { width: 46px; height: 34px; border-radius: 4px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; cursor: pointer; font-family: var(--sans); }
.c-ok { background: var(--ok-bg); color: var(--accent-ink); }
.c-avoid { background: var(--amber-bg); color: var(--amber-ink); border-color: #EAD9A5; }
.c-off { background: #FCE3DC; color: #9A2B12; border-color: #F2C1B3; }
.c-blocked { background: repeating-linear-gradient(135deg, #E9ECE8 0 5px, #DCE0DA 5px 10px); color: var(--ink-2); font-size: 9px; font-weight: 500; cursor: default; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 2px; }
.c-none { background: transparent; cursor: default; }
.c-pinned { box-shadow: inset 0 0 0 2px #B7791F; }
.c-free { background: var(--paper); border-color: var(--line); color: var(--ink-3); }
.c-free:hover { border-color: #B7791F; background: #FFF4D6; }
.c-dim { opacity: .45; cursor: default; }
.c-dim:hover { border-color: var(--line); background: var(--paper); }
.c-off.c-dim:hover { background: #FCE3DC; border-color: #F2C1B3; }
.c-pin-own { background: #FFF4D6; border-color: #B7791F; }
.c-pin-pair { background: #F1EFE8; border-color: var(--line); opacity: .8; cursor: default; }
.c-pin-busy { background: #E6E9EF; color: var(--ink-2); font-size: 10px; font-weight: 600; cursor: default; }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* data editors */
.split2 { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split2 > .listcol { flex: 1 1 280px; max-width: 340px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.split2 > .formcol { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pick { margin: 0; padding: 0; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; max-height: 70vh; overflow-y: auto; }
.pick button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-3); }
.pick li:last-child button { border-bottom: 0; }
.pick button:hover { background: #F6F8F5; }
.pick button.on { background: var(--ink); color: #FFF; }
.pick button.on .muted, .pick button.on .soft { color: #C9D2CC; }
.pick .code { font-family: var(--mono); font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.input[readonly] { background: var(--line-3); color: var(--ink-2); }
.formbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.formbar .spacer { flex: 1; }
.tagset { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--field); border-radius: 999px; background: var(--paper); font-size: 13px; cursor: pointer; }
.tag input { width: 15px; height: 15px; accent-color: var(--ink); margin: 0; }
.tag:has(input:checked) { background: var(--ink); color: #FFF; border-color: var(--ink); }
.subtle-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.subtle-tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.subtle-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line-3); }
.subtle-tbl input.input, .subtle-tbl select.select { min-height: 36px; }

/* lesson matrix */
.matrix { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.matrix th { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 6px 4px; text-align: center; border-radius: 4px; white-space: nowrap; }
.matrix th.g1 { background: var(--g1); }
.matrix th.g2 { background: var(--g2); }
.matrix .m-class { font-family: var(--sans); text-align: left; padding: 0 10px 0 4px; font-size: 13px; position: sticky; left: 0; background: var(--paper); z-index: 1; }
.matrix td { padding: 0; }
.mcell { all: unset; box-sizing: border-box; cursor: pointer; width: 64px; min-height: 58px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); display: flex; flex-direction: column; gap: 1px; }
.mcell b { font-family: var(--mono); font-size: 16px; line-height: 1.1; }
.mcell span { font-size: 10px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcell .mono { font-size: 10px; color: var(--ink-2); }
.mcell .mcards { letter-spacing: -0.4px; }
.mcell:hover { border-color: var(--ink); }
.mcell.on { background: var(--ink); border-color: var(--ink); color: #FFF; }
.mcell.on span, .mcell.on .mono { color: #C9D2CC; }
.mcell { position: relative; }
.mcell .mtime { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #B7791F; }
.mcell.noteach { background: #FFF4D6; border-color: #E5C07B; }
.mcell.noteach .mono { color: #8A5A00; font-weight: 600; }
.mcell.on.noteach { background: var(--ink); border-color: var(--ink); }
.mcell.on.noteach .mono { color: #F6D58E; }
.mcell.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.addlessons { border-top: 1px solid var(--line); padding-top: 10px; }
.addlessons > summary { cursor: pointer; font-size: 14px; }
.paintbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; margin-top: -8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 13px; }
.paintbar .select { width: auto; min-width: 220px; }
.matrix th.m-unused { color: var(--ink-3); font-weight: 400; }
.nt-count { margin-left: 4px; padding: 1px 6px; border-radius: 9px; background: #FFF4D6; color: #8A5A00; font-size: 11px; font-weight: 600; }
.nt-warn { font-size: 13px; color: #8A5A00; }
.nt-warn b { font-weight: 600; }
.mcell.empty { border-style: dashed; align-items: center; justify-content: center; }
.mcell.empty span { font-size: 16px; color: var(--line); }
.mcell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* rules */
.rulegroup { display: flex; flex-direction: column; gap: 8px; }
.rulegroup > h2 { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .08em; color: var(--ink-3); }
.rule { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.rule.off { opacity: .6; }
.rule .what { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 360px; }
.rule .what > span:first-child { font-size: 14px; font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rule .why { font-size: 12px; color: var(--ink-2); }
.rule .how { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.num-in { width: 64px !important; min-height: 34px !important; text-align: center; font-family: var(--mono); padding: 0 6px !important; }
.chip-in { min-height: 34px !important; width: auto !important; padding: 0 8px !important; font-size: 13px !important; }
.strength { display: inline-flex; border: 1px solid var(--field); border-radius: 6px; overflow: hidden; }
.strength button { all: unset; cursor: pointer; padding: 6px 12px; font-size: 13px; background: var(--paper); }
.strength button + button { border-left: 1px solid var(--field); }
.strength button.on { background: var(--ink); color: #FFF; font-weight: 500; }
.strength button:focus-visible { outline: 2px solid var(--accent); }

/* sign in */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 14px; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav-title { width: 100%; }
    .side-foot { margin-top: 0; }
    .main { padding: 20px 16px 40px; }
    .title { font-size: 26px; }
}
.pairbulk { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 12px; border: 1px solid var(--line-2); border-radius: 8px; }
.pairskip { margin: 6px 0 0; padding-left: 18px; }
.pairgroups { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.pairgroup { border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; }
.pairgroup > summary { cursor: pointer; font-size: 14px; }
.pairgroup[open] > summary { margin-bottom: 6px; }
.pairgroup .pill { margin-left: 6px; }
.rtabs { max-width: 100%; overflow-x: auto; align-self: flex-start; }
.rtabs a { white-space: nowrap; gap: 6px; }
.rtabs .n { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rtabs a.on .n { color: rgba(255, 255, 255, .7); }
.rtabs .dot { width: 8px; height: 8px; border-radius: 50%; background: #C9A227; }
.rtabs .dot.bad { background: var(--warn-ink); }
