/* 当直室 — DUTY ROOM. Design tokens first; components below. No inline styles are used (CSP). */
:root {
  --bg: #f5f4ef; --surface: #fff; --surface-2: #fafaf6; --surface-3: #f0f1ea; --sunken: #ebece5;
  --ink: #17282e; --ink-2: #3c4f56; --muted: #596a6e; --faint: #9aa5a6; --line: #e1e4dc; --line-2: #eceee7;
  --navy: #162a33; --navy-2: #213a46; --navy-ink: #e8efec; --navy-muted: #a3b5b6;
  --green: #d3e6c1; --green-2: #e8f2df; --green-ink: #2a5a45;
  --ward: #4b6a4c; --ward-bg: #ecf2e7; --er: #355f7d; --er-bg: #e6eff6;
  --danger: #a1313d; --danger-bg: #fcecec; --danger-line: #efc6c9;
  --warn: #805b12; --warn-bg: #fbf2d9; --warn-line: #ead79f;
  --ok: #286346; --ok-bg: #e4f1e7; --ok-line: #bcdcc6;
  --mine: #e3f0d6; --mine-line: #b5d29b;
  --r-s: 8px; --r: 12px; --r-l: 18px; --r-xl: 24px;
  --shadow-s: 0 1px 2px rgb(22 42 51 / .05); --shadow: 0 1px 2px rgb(22 42 51 / .04), 0 8px 24px rgb(22 42 51 / .05); --shadow-l: 0 24px 70px rgb(10 26 33 / .24);
  --focus: 0 0 0 3px rgb(64 128 160 / .42);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", Meiryo, system-ui, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Charter, Georgia, "Hiragino Mincho ProN", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  font-family: var(--font); font-size: 14px; line-height: 1.7; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a20; --surface: #14232a; --surface-2: #172830; --surface-3: #1c3039; --sunken: #0b161b;
    --ink: #e6eeeb; --ink-2: #c2cfcd; --muted: #9aabab; --faint: #6c7f82; --line: #263b43; --line-2: #1f333a;
    --navy: #0a151b; --navy-2: #17303b; --navy-ink: #e6eeeb; --navy-muted: #8fa3a6;
    --green: #a8cc92; --green-2: #20372d; --green-ink: #bfe0aa;
    --ward: #a9cba0; --ward-bg: #1d3329; --er: #9cc3e2; --er-bg: #1a3040;
    --danger: #ff9ba3; --danger-bg: #3a1d22; --danger-line: #6b2f37;
    --warn: #f1cf7c; --warn-bg: #3a3017; --warn-line: #6a5622;
    --ok: #9fdcb4; --ok-bg: #173527; --ok-line: #2f6447;
    --mine: #23402d; --mine-line: #3d6b49;
    --shadow-s: none; --shadow: 0 1px 0 rgb(255 255 255 / .03); --shadow-l: 0 24px 70px rgb(0 0 0 / .55);
    --focus: 0 0 0 3px rgb(140 200 230 / .45);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100dvh; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3 { font-feature-settings: "palt"; letter-spacing: .01em; line-height: 1.45; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: .1em .35em; border-radius: 5px; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: var(--green); color: var(--navy); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.icon.mini { width: 14px; height: 14px; }
.sr-only, .offscreen { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--navy); color: var(--navy-ink); padding: 10px 14px; border-radius: var(--r-s); text-decoration: none; }
.skip:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }
.muted { color: var(--muted); }
.pad { padding: 16px 18px; }
.lead { color: var(--ink-2); line-height: 1.9; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.8; }
.hint.between { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: flex-start; }
.hint.between .counter { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.footnote { color: var(--muted); font-size: 11px; line-height: 1.9; margin-top: 22px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.eyebrow { font-size: 10.5px; letter-spacing: .22em; font-weight: 650; color: var(--muted); text-transform: uppercase; }
.names { margin-top: 8px; font-size: 12px; line-height: 1.9; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border-radius: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .16s var(--ease), border-color .16s, transform .12s, box-shadow .16s; box-shadow: var(--shadow-s); }
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: color-mix(in srgb, var(--line) 60%, var(--ink) 18%); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.btn.primary:hover:not(:disabled) { background: var(--navy-2); border-color: var(--navy-2); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--green); color: #0e1a20; border-color: var(--green); } .btn.primary:hover:not(:disabled) { background: #bcd9a9; border-color: #bcd9a9; } }
.btn.accent { background: var(--green); color: #102027; border-color: var(--green); }
.btn.accent:hover:not(:disabled) { background: #c4dcae; }
.btn.on-dark { background: rgb(255 255 255 / .08); color: var(--navy-ink); border-color: rgb(255 255 255 / .18); box-shadow: none; }
.btn.on-dark:hover:not(:disabled) { background: rgb(255 255 255 / .15); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger-solid { color: #2a0d11; } }
.btn.small { min-height: 32px; padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.large { min-height: 50px; padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.primary.is-busy::after { border-color: var(--navy-ink) transparent var(--navy-ink) transparent; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-2); transition: background .16s; }
.icon-button:hover { background: var(--surface-3); }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--green-ink); font-weight: 600; font-size: 12.5px; padding: 6px 0; }
@media (prefers-color-scheme: light) { .text-link { color: #2a5a45; } }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Badges, notices, meters */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); margin-left: 6px; white-space: nowrap; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; line-height: 1.85; margin: 14px 0; }
.notice > .icon { margin-top: 3px; color: var(--muted); }
.notice strong { display: block; margin-bottom: 2px; }
.notice ul { margin-top: 6px; display: grid; gap: 3px; font-size: 12.5px; }
.notice ul li::before { content: "・"; color: var(--muted); }
.notice.is-ok { background: var(--ok-bg); border-color: var(--ok-line); } .notice.is-ok > .icon { color: var(--ok); }
.notice.is-warn { background: var(--warn-bg); border-color: var(--warn-line); } .notice.is-warn > .icon { color: var(--warn); }
.notice.is-danger { background: var(--danger-bg); border-color: var(--danger-line); } .notice.is-danger > .icon { color: var(--danger); }
.notice .text-link { margin-left: auto; white-space: nowrap; }
.meter { height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-top: 12px; }
.meter > i { display: block; height: 100%; width: calc(var(--ratio, 0) * 100%); background: linear-gradient(90deg, #7d9f6f, #5f8a5c); border-radius: inherit; transition: width .6s var(--ease); }
.panel > .meter { margin: 0; border-radius: 0; height: 3px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--green); color: #12242c; font-weight: 700; font-size: 19px; flex: none; box-shadow: inset 0 -2px 0 rgb(0 0 0 / .06); }
.brand-text { font-size: 19px; font-weight: 650; letter-spacing: .14em; line-height: 1.2; }
.brand-text small { display: block; font-size: 8.5px; letter-spacing: .3em; font-weight: 600; opacity: .62; margin-top: 4px; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; background: var(--navy); color: var(--navy-ink); padding: 26px 16px 20px; display: flex; flex-direction: column; gap: 34px; z-index: 20; }
.sidebar .brand { padding: 0 8px; }
.nav { display: grid; gap: 4px; }
.nav button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 10px; color: var(--navy-muted); font-size: 13.5px; font-weight: 550; text-align: left; transition: background .16s, color .16s; position: relative; }
.nav button:hover { background: rgb(255 255 255 / .06); color: var(--navy-ink); }
.nav button.is-active { background: rgb(255 255 255 / .1); color: #fff; }
.nav button.is-active::before { content: ""; position: absolute; left: -16px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.nav-short { display: none; }
.sidebar-foot { margin-top: auto; font-size: 11.5px; line-height: 1.9; color: var(--navy-muted); padding: 0 8px; }
.who { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgb(255 255 255 / .1); color: var(--navy-ink); font-size: 12.5px; line-height: 1.5; }
.who small { display: block; color: var(--navy-muted); font-size: 10.5px; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--green-2); color: var(--green-ink); font-weight: 700; font-size: 12.5px; flex: none; }
.sidebar .avatar { background: var(--green); color: #12242c; }
.workarea { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 16px; height: 64px; padding: 0 36px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; min-width: 0; white-space: nowrap; }
.crumb > span:nth-child(3) { color: var(--ink); font-weight: 600; }
.crumb-sep { width: 14px; height: 14px; opacity: .6; }
.crumb-month { margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 0 6px; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: #5d9a6f; box-shadow: 0 0 0 3px rgb(93 154 111 / .18); }
.sync.is-stale { color: var(--warn); font-weight: 600; background: var(--warn-bg); padding: 6px 10px; border-radius: 999px; }
.sync.is-offline { color: var(--danger); }
.main { padding: 0 36px 56px; max-width: 1680px; width: 100%; margin: 0 auto; outline: none; transition: opacity .2s; }
.main.is-loading { opacity: .55; pointer-events: none; }

/* Page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 30px 0 22px; }
.page-title .eyebrow { margin-bottom: 8px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 8px; line-height: 1.8; max-width: 62ch; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.month-display { display: flex; align-items: center; gap: 16px; }
.month-number { font-family: var(--serif); font-size: 64px; line-height: .9; letter-spacing: -.03em; font-weight: 400; font-variant-numeric: lining-nums; }
.month-title { font-size: 21px; font-weight: 550; letter-spacing: .02em; margin-bottom: 6px; }
.month-switch { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; box-shadow: var(--shadow-s); }
.month-switch .icon-button { width: 34px; height: 34px; }
.month-input input { border: 0; background: transparent; padding: 6px 6px; font-size: 13px; font-weight: 600; width: 132px; text-align: center; color: var(--ink); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stats.mini { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat.is-attention { border-color: var(--warn-line); background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(135deg, var(--warn-line), var(--line)) border-box; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--serif); font-size: 36px; line-height: 1.2; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums lining-nums; }
.stat-value small { font-family: var(--font); font-size: 14px; letter-spacing: 0; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head.wrap { flex-wrap: wrap; }
.panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.panel-body { padding: 18px 20px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }

/* Admin calendar */
.calendar-grid .weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.weekdays span { text-align: center; font-size: 11px; font-weight: 650; color: var(--muted); padding: 9px 0; letter-spacing: .12em; }
.weekdays .is-sun { color: var(--danger); } .weekdays .is-sat { color: var(--er); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line-2); }
.day { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-height: 128px; min-width: 0; padding: 9px 8px 10px; background: var(--surface); text-align: left; transition: background .14s, box-shadow .14s; }
.day:not(.is-blank):hover { background: var(--surface-2); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--green) 70%, var(--ink) 10%); z-index: 1; }
.day.is-blank { background: var(--surface-2); }
.day.is-holiday { background: color-mix(in srgb, var(--surface) 92%, #e9b9a7 8%); }
.day.has-hard { box-shadow: inset 0 0 0 2px var(--danger-line); }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 22px; }
.day-num { font-family: var(--serif); font-size: 17px; line-height: 1; font-variant-numeric: lining-nums; }
.day.is-holiday .day-num { color: var(--danger); }
.day.is-today .day-num { display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -3px 0 -3px -3px; border-radius: 50%; background: var(--navy); color: var(--navy-ink); font-size: 14px; }
.day-note { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slots { display: grid; gap: 4px; }
.slot { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 11.5px; line-height: 1.5; }
.slot .role { flex: none; font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 5px; background: var(--ward-bg); color: var(--ward); letter-spacing: .02em; }
.slot.is-er .role { background: var(--er-bg); color: var(--er); }
.slot .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.slot.is-empty .name { color: var(--muted); }
.slot.is-fixed .name { color: var(--ink-2); }
.slot.is-hard { color: var(--danger); } .slot.is-hard .role { background: var(--danger-bg); color: var(--danger); }
.slot.is-soft { color: var(--warn); } .slot.is-soft .role { background: var(--warn-bg); color: var(--warn); }
.slot .icon.mini { margin-left: auto; }
.slot .tag { margin-left: auto; background: var(--ok-bg); color: var(--ok); font-size: 9px; padding: 0 4px; border-radius: 4px; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.is-ward { background: var(--ward-bg); box-shadow: inset 0 0 0 1px var(--ward); } .lg.is-er { background: var(--er-bg); box-shadow: inset 0 0 0 1px var(--er); }
.lg.is-hard { background: var(--danger-bg); box-shadow: inset 0 0 0 1px var(--danger); } .lg.is-soft { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn); } .lg.is-excepted { background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok); }
.calendar-list { display: none; }
.list-day { display: flex; gap: 16px; align-items: center; width: 100%; padding: 13px 16px; border-bottom: 1px solid var(--line-2); text-align: left; background: var(--surface); }
.list-day.is-holiday .list-date strong { color: var(--danger); }
.list-date { display: grid; min-width: 44px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.list-date strong { font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--ink); }
.list-slots { flex: 1; display: grid; gap: 5px; min-width: 0; }
.list-slot { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.list-slot small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.list-slot span { text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-slot.is-empty span { color: var(--muted); } .list-slot.is-hard span { color: var(--danger); } .list-slot.is-soft span { color: var(--warn); }
.chev { color: var(--faint); }

/* Rail */
.rail { display: grid; gap: 14px; }
.rail-card { border-radius: var(--r-l); padding: 20px; background: var(--surface-3); border: 1px solid var(--line); }
.rail-card.is-dark { background: radial-gradient(120% 140% at 100% 0%, var(--navy-2), var(--navy)); color: var(--navy-ink); border-color: transparent; box-shadow: var(--shadow); }
.rail-card.is-dark .eyebrow { color: var(--green); opacity: .9; }
.rail-card.is-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.rail-card h3 { font-size: 17px; margin: 8px 0 8px; line-height: 1.55; }
.rail-card p { font-size: 12.5px; line-height: 1.85; opacity: .86; }
.rail-card .btn { width: 100%; margin-top: 16px; }
.rail-list .rail-title { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 6px; }
.rail-list ul { padding: 0 18px; }
.rail-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; line-height: 1.5; }
.rail-list li small { display: block; color: var(--muted); font-size: 10.5px; }
.rail-list .text-link { padding: 12px 18px 14px; }

/* Tables and filters */
.filters { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-3); padding: 3px; border-radius: 11px; }
.filters button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; transition: background .15s, color .15s; }
.filters button span { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .8; }
.filters button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }
.search { position: relative; display: block; min-width: 200px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tbody th { font-weight: 500; }
.table td small, .table th small { display: block; font-size: 11px; color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.is-muted { opacity: .62; }
.table.compact th, .table.compact td { padding: 9px 12px; }
.person { display: flex; align-items: center; gap: 12px; }
.person > span:last-child { line-height: 1.5; }
.traits { display: flex; flex-wrap: wrap; gap: 4px; max-width: 340px; }

/* Forms */
.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.field input, .field select, .field textarea, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 400; font-size: 14px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.8; min-height: 84px; }
.field input:focus, .field select:focus, textarea:focus, .search input:focus { border-color: color-mix(in srgb, var(--line) 30%, #4a8aa9 70%); }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { width: 90px; }
.with-unit span { font-weight: 500; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-grid; place-items: center; min-width: 44px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; transition: all .15s; }
.chip input:checked + span { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.chip input:focus-visible + span { box-shadow: var(--focus); }
.toggles { display: grid; gap: 8px; }
.toggle, .check { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.toggle { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); }
.toggle input, .check input { width: 18px; height: 18px; accent-color: var(--green-ink); flex: none; }
.file { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 9px 16px; border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--line) 50%, var(--ink) 25%); background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s; }
.file:hover { background: var(--surface-3); }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file:focus-within { box-shadow: var(--focus); }
.form-error, .dialog-error { color: var(--danger); font-size: 12.5px; line-height: 1.8; white-space: pre-line; }
.form-error:empty { display: none; }
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings .panel-body > p { line-height: 1.9; }

/* Dialogs */
dialog { width: min(640px, calc(100% - 24px)); max-height: min(88dvh, 920px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-l); overflow: auto; overscroll-behavior: contain; }
dialog.wide { width: min(980px, calc(100% - 24px)); }
dialog[open] { animation: rise .26s var(--ease); }
dialog::backdrop { background: rgb(9 22 28 / .42); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s ease; }
.dialog-head { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 18px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.title-note { font-size: 12px; font-weight: 600; color: var(--danger); }
.dialog-body { padding: 20px 22px 22px; display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.dialog-actions.stack-s { flex-direction: column; align-items: stretch; }
.dialog-actions.stack-s .btn, .dialog-actions .btn.wrap { white-space: normal; text-align: center; line-height: 1.5; padding-block: 10px; }
.choice { display: grid; gap: 2px; } .choice small { font-weight: 500; font-size: 12px; opacity: .82; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--muted); }
.checklist { display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.checklist li.is-hard { background: var(--danger-bg); color: var(--danger); } .checklist li.is-warn { background: var(--warn-bg); color: var(--warn); } .checklist li.is-ok { background: var(--ok-bg); color: var(--ok); }
.rules { display: grid; gap: 10px; }
.rules li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.8; }
.rules .icon { color: var(--ok); margin-top: 4px; }
.issue-list { display: grid; gap: 6px; }
.issue-list button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); transition: background .15s; }
.issue-list button:hover { background: var(--surface-3); }
.issue-date { min-width: 76px; font-weight: 650; font-size: 12.5px; }
.issue-main { flex: 1; display: grid; font-size: 12.5px; line-height: 1.7; min-width: 0; }
.issue-main span { color: var(--muted); }
.issue-list .is-hard button { border-color: var(--danger-line); }
.preview summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 6px 0; }
.added { display: grid; gap: 2px; margin-top: 6px; max-height: 280px; overflow: auto; }
.added li { display: grid; grid-template-columns: 90px 90px 1fr; gap: 10px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; }
.added li:nth-child(odd) { background: var(--surface-2); }
.creds { display: grid; gap: 14px; }
.cred { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.cred-label { grid-column: 1 / -1; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.cred code { background: none; padding: 0; font-size: 13px; word-break: break-all; line-height: 1.7; user-select: all; }
.cred code.code { font-size: 18px; letter-spacing: .06em; }
.msg { white-space: pre-wrap; font-family: var(--font); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin: 4px 0 6px; word-break: break-all; }
.btn.is-done { border-color: var(--ok-line); color: var(--ok); }
.detail { display: grid; gap: 2px; }
.detail > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.detail dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.detail dd.notes { white-space: pre-wrap; line-height: 1.85; }
.section-title { font-size: 13px; color: var(--muted); margin-top: 6px; }
.versions { display: grid; gap: 4px; }
.versions li { display: grid; grid-template-columns: 64px 150px 1fr; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; background: var(--surface-2); }
.versions .v { font-weight: 700; }
.plain { display: grid; gap: 3px; font-size: 12.5px; }
.ro-slots { display: grid; gap: 6px; }
.ro-slots li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.ro-slots li span:first-child { min-width: 80px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--surface-3); font-size: 12px; font-weight: 600; color: var(--ink-2); }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-3); }
.segmented button { padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; white-space: nowrap; }
.segmented button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-s); }

/* Day editor */
.day-editor { display: grid; gap: 14px; }
.de-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.de-grid { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 14px; align-items: start; }
.de-slots { display: grid; gap: 8px; }
.de-slot { display: grid; gap: 2px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
button.de-slot:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--ink) 25%); }
.de-slot.is-active { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
@media (prefers-color-scheme: dark) { .de-slot.is-active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); } }
.de-slot.is-hard { background: var(--danger-bg); border-color: var(--danger-line); }
.de-slot.is-soft { background: var(--warn-bg); border-color: var(--warn-line); }
.de-slot.is-fixed { background: var(--surface-2); border-style: dashed; }
.de-role { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
.de-who { font-size: 16px; font-weight: 650; }
.de-slot.is-empty .de-who { color: var(--muted); }
.de-meta { font-size: 11.5px; color: var(--muted); }
.de-state { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; line-height: 1.6; margin-top: 4px; }
.de-slot.is-hard .de-state { color: var(--danger); } .de-slot.is-soft .de-state { color: var(--warn); } .de-state.is-note { color: var(--muted); }
.de-cands { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.de-search { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.de-search .search { flex: 1; min-width: 160px; }
.de-search .check { font-size: 12.5px; color: var(--muted); }
.cand-list { max-height: min(52dvh, 460px); overflow: auto; padding: 6px; display: grid; gap: 2px; }
.cand-group { display: flex; justify-content: space-between; padding: 10px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.cand-empty { padding: 20px; text-align: center; color: var(--muted); }
.cand { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 12px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; transition: background .12s; }
.cand:hover { background: var(--surface-3); }
.cand.is-current { background: var(--green-2); box-shadow: inset 0 0 0 1px var(--mine-line); }
.cand-name { font-weight: 650; font-size: 13.5px; }
.cand-meta { grid-column: 1; font-size: 11.5px; color: var(--muted); }
.cand-count { grid-row: 1; grid-column: 2; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.cand-state { grid-column: 1 / -1; display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; line-height: 1.6; }
.cand.is-ok .cand-state { color: var(--ok); } .cand.is-soft .cand-state { color: var(--warn); } .cand.is-hard { opacity: .78; } .cand.is-hard .cand-state { color: var(--danger); }
.cand.is-clear { grid-template-columns: auto 1fr; align-items: center; color: var(--muted); }

/* History */
.timeline { padding: 6px 18px; }
.event { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.event:last-child { border-bottom: 0; }
.event-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); flex: none; }
.event-body { min-width: 0; flex: 1; display: grid; gap: 3px; }
.event-meta { font-size: 11.5px; color: var(--muted); }
.event-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; flex-wrap: wrap; }
.event-detail { font-size: 12.5px; color: var(--ink-2); }
.changes summary { cursor: pointer; font-size: 12px; color: var(--green-ink); font-weight: 600; padding: 4px 0; }
.changes ul { display: grid; gap: 2px; font-size: 12px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); max-height: 260px; overflow: auto; }
.more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line-2); }
.empty { display: grid; justify-items: center; gap: 8px; padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; color: var(--faint); }
.empty h3 { color: var(--ink); }

/* Login */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100dvh; }
.login-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; background: radial-gradient(130% 100% at 0% 100%, var(--navy-2), var(--navy)); color: var(--navy-ink); }
.login-art .brand, .art-copy, .art-steps { position: relative; z-index: 1; }
.art-copy .eyebrow { color: var(--green); margin-bottom: 20px; }
.art-title { font-size: clamp(30px, 3.4vw, 50px); line-height: 1.55; font-weight: 500; letter-spacing: .02em; font-feature-settings: "palt"; }
.art-text { color: var(--navy-muted); margin-top: 18px; font-size: 13.5px; }
.art-steps { display: flex; gap: 36px; color: var(--navy-muted); font-size: 10.5px; letter-spacing: .22em; }
.art-steps span { display: block; font-family: var(--serif); color: var(--green); font-size: 28px; letter-spacing: 0; margin-bottom: 6px; }
.orbit { position: absolute; width: 680px; height: 680px; right: -260px; bottom: -200px; border-radius: 50%; border: 1px solid rgb(211 230 193 / .14); animation: drift 26s linear infinite; }
.orbit::before, .orbit::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgb(211 230 193 / .12); inset: 70px; }
.orbit::after { inset: 150px; border-color: rgb(211 230 193 / .1); }
.login-side { display: grid; place-items: center; padding: 48px 32px; outline: none; }
.login-side.wide { grid-column: 1 / -1; }
.login-card { width: 100%; max-width: 400px; display: grid; gap: 16px; }
.login-card h1 { font-size: 26px; }
.login-points { display: grid; gap: 12px; margin-top: 6px; }
.login-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.login-points .icon { color: var(--green-ink); margin-top: 3px; }
.code-input { position: relative; display: block; }
.code-input input { width: 100%; padding: 14px 52px 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-family: var(--mono); font-size: 17px; letter-spacing: .06em; }
.code-input .icon-button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.login-foot { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }

/* Doctor */
.doctor { max-width: 880px; margin: 0 auto; padding: 0 28px 150px; }
.d-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.d-head .brand-text { font-size: 17px; }
.d-hello { margin: 28px 0 16px; display: grid; gap: 4px; }
.d-hello h1 { font-size: 26px; }
.d-hello p:last-child { color: var(--muted); }
.month-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scroll-snap-type: x mandatory; }
.mchip { scroll-snap-align: start; display: grid; gap: 1px; min-width: 132px; text-align: left; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.mchip span { font-weight: 650; }
.mchip small { color: var(--muted); font-size: 11px; }
.mchip.is-open small { color: var(--ok); font-weight: 600; }
.mchip.is-on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
@media (prefers-color-scheme: dark) { .mchip.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); } }
.tabs { display: flex; margin: 8px 0 18px; }
.tabs button { flex: 1; padding: 10px; position: relative; }
.tabs .dot { position: absolute; top: 8px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: #5d9a6f; }
.d-status { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 22px 24px; border-radius: var(--r-l); color: var(--navy-ink); background: radial-gradient(120% 160% at 100% 0%, var(--navy-2), var(--navy)); box-shadow: var(--shadow); margin-bottom: 18px; }
.d-status.is-closed { background: var(--surface-3); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.d-status .eyebrow { color: var(--green); }
.d-status.is-closed .eyebrow { color: var(--muted); }
.d-status h2 { font-size: 18px; margin: 6px 0 4px; }
.d-status p { font-size: 12.5px; opacity: .88; }
.countdown { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgb(211 230 193 / .16); color: var(--green); font-weight: 650; }
.d-count { text-align: center; flex: none; }
.d-count strong { display: block; font-family: var(--serif); font-size: 44px; line-height: 1; font-weight: 400; color: var(--green); font-variant-numeric: tabular-nums lining-nums; }
.d-status.is-closed .d-count strong { color: var(--ink); }
.d-count span { font-size: 11px; opacity: .8; }
.d-section { margin: 18px 0 8px; display: grid; gap: 10px; }
.d-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.d-label-row { display: flex; justify-content: space-between; align-items: center; }
.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ptype { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: border-color .15s, box-shadow .15s, background .15s; }
.ptype i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ptype.is-ng i { background: #c86b75; } .ptype.is-pref i { background: #6f9c7c; }
.ptype span { font-weight: 650; font-size: 13px; line-height: 1.35; }
.ptype small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.ptype.is-on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); background: var(--surface-2); }
@media (prefers-color-scheme: dark) { .ptype.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); } }
.ptype:disabled { opacity: .5; }
.rcal { display: grid; gap: 8px; }
.rweek, .rdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.rweek span { text-align: center; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.rweek .is-sun { color: var(--danger); } .rweek .is-sat { color: var(--er); }
.rday { display: grid; place-items: center; align-content: center; gap: 2px; aspect-ratio: 1 / .92; min-height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: transform .12s var(--ease), background .15s, border-color .15s; }
.rday:not(:disabled):hover { border-color: color-mix(in srgb, var(--line) 40%, var(--ink) 30%); }
.rday:not(:disabled):active { transform: scale(.96); }
.rday.is-blank { border: 0; background: none; }
.rnum { font-family: var(--serif); font-size: 19px; line-height: 1; font-variant-numeric: lining-nums; }
.rtag { font-size: 10px; font-weight: 650; color: var(--muted); min-height: 14px; line-height: 1.4; }
.rday.is-holiday .rnum { color: var(--danger); } .rday.is-sat .rnum { color: var(--er); }
.rday.is-ng { background: var(--danger-bg); border-color: var(--danger-line); } .rday.is-ng .rtag, .rday.is-ng .rnum { color: var(--danger); }
.rday.is-pref { background: var(--ok-bg); border-color: var(--ok-line); } .rday.is-pref .rtag, .rday.is-pref .rnum { color: var(--ok); }
.rday.is-today { box-shadow: inset 0 0 0 2px var(--line); }
.rday:disabled { cursor: default; opacity: .62; }
.d-history { margin: 14px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.d-history summary { cursor: pointer; padding: 12px 16px; font-weight: 650; font-size: 13px; }
.d-history ol { display: grid; gap: 2px; padding: 0 12px 12px; }
.d-history li { display: grid; grid-template-columns: 64px 150px 1fr; gap: 10px; font-size: 12.5px; padding: 6px 4px; border-top: 1px solid var(--line-2); }
.submit-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px max(24px, calc((100vw - 880px) / 2 + 28px)) max(14px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px); border-top: 1px solid var(--line); }
.bar-text p { font-weight: 650; font-size: 14px; }
.bar-text p.is-dirty { color: var(--warn); }
.bar-text small { color: var(--muted); font-size: 11.5px; }
.d-mine { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; padding: 22px 24px; border-radius: var(--r-l); background: radial-gradient(120% 160% at 100% 0%, var(--navy-2), var(--navy)); color: var(--navy-ink); margin-bottom: 12px; flex-wrap: wrap; }
.d-mine .eyebrow { color: var(--green); }
.d-mine h2 { font-size: 18px; margin: 6px 0 12px; font-weight: 550; }
.d-mine h2 strong { font-family: var(--serif); font-size: 30px; font-weight: 400; color: var(--green); }
.mine-list { display: flex; flex-wrap: wrap; gap: 8px; }
.mine-list li { display: grid; gap: 1px; padding: 9px 13px; border-radius: 12px; background: rgb(255 255 255 / .08); font-size: 12px; }
.mine-date { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.mine-date small { font-family: var(--font); font-size: 10.5px; color: var(--navy-muted); margin-left: 6px; }
.sched { display: grid; gap: 8px; margin-top: 12px; }
.sday { display: flex; gap: 18px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.sday.is-mine { background: var(--mine); border-color: var(--mine-line); }
.sdate { display: grid; min-width: 46px; font-size: 11px; color: var(--muted); line-height: 1.35; }
.sdate strong { font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--ink); }
.sday.is-holiday .sdate strong { color: var(--danger); }
.sslots { flex: 1; display: grid; gap: 6px; min-width: 0; }
.sslot { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.sslot small { color: var(--muted); white-space: nowrap; }
.sslot.is-me span { font-weight: 700; color: var(--ok); }

/* Gentle entrance for page content (disabled with reduced motion) */
.main > section, .main > .workspace, .main > .stats, .d-body > *, .login-card { animation: fadeUp .32s var(--ease) both; }
.main > :nth-child(2) { animation-delay: .03s; } .main > :nth-child(3) { animation-delay: .06s; } .main > :nth-child(4) { animation-delay: .09s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-color-scheme: dark) {
  .login-side { background: var(--surface); }
  .login-art { background: radial-gradient(130% 100% at 0% 100%, #1c3a3f, #0b161b 70%); }
}

/* Toast, boot, motion */
#toast { position: fixed; left: 50%; bottom: 26px; z-index: 60; display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(560px, calc(100vw - 28px)); padding: 12px 18px; border-radius: 14px; background: var(--navy); color: var(--navy-ink); box-shadow: var(--shadow-l); font-size: 13.5px; line-height: 1.7; opacity: 0; transform: translate(-50%, 18px); pointer-events: none; transition: opacity .22s, transform .28s var(--ease); cursor: pointer; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.success .icon { color: var(--green); }
#toast.error { background: #7c2731; color: #fff; }
@media (prefers-color-scheme: dark) { #toast { background: #e6eeeb; color: #0e1a20; } #toast.success .icon { color: #2a5a45; } #toast.error { background: #ffb3b9; color: #2a0d11; } }
.doctor ~ #toast, body:has(.submit-bar) #toast { bottom: 96px; }
.boot { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 100dvh; color: var(--muted); }
.boot .brand-mark { animation: breathe 1.6s ease-in-out infinite; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes breathe { 50% { transform: scale(.92); opacity: .7; } }
@keyframes drift { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }

/* Responsive */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .day { min-height: 118px; }
}
@media (max-width: 1080px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 22px 10px; align-items: center; }
  .sidebar .brand-text, .sidebar-foot p, .who > span:last-child, .nav-full { display: none; }
  .sidebar .brand { padding: 0; }
  .nav button { justify-content: center; padding: 10px; }
  .nav button.is-active::before { left: -10px; }
  .who { border: 0; padding: 0; }
  .topbar, .main { padding-left: 24px; padding-right: 24px; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .de-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  :root { font-size: 14.5px; }
  input, select, textarea, .field input, .field select, .field textarea, .search input { font-size: 16px; } /* iOS does not zoom into 16px fields */
  .code-input input { font-size: 16px; letter-spacing: .02em; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px max(6px, env(safe-area-inset-bottom)); gap: 0; border-top: 1px solid rgb(255 255 255 / .08); }
  .sidebar .brand, .sidebar-foot { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; gap: 2px; }
  .nav button { flex: 1; flex-direction: column; gap: 3px; min-height: 52px; padding: 6px 2px; font-size: 10.5px; }
  .nav button.is-active::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav-short { display: inline; }
  .topbar { height: 56px; padding: 0 16px; }
  .crumb-root, .crumb-sep, .hide-s { display: none; }
  .crumb-month { margin: 0; padding: 0; border: 0; }
  .main { padding: 0 16px 108px; }
  .page-head { flex-direction: column; align-items: stretch; margin: 22px 0 16px; gap: 14px; }
  .page-tools { justify-content: flex-start; }
  .month-number { font-size: 52px; }
  h1 { font-size: 24px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px 12px 10px; border-radius: 14px; }
  .stat-label { font-size: 10.5px; } .stat-label .icon { display: none; }
  .stat-value { font-size: 25px; } .stat-value small { font-size: 11px; }
  .stat-foot { font-size: 10px; }
  .calendar-grid { display: none; }
  .calendar-list { display: block; }
  .legend { display: none; }
  .panel-head { padding: 12px 14px; flex-wrap: wrap; }
  .panel-head .row { width: 100%; }
  .panel-head .row .btn { flex: 1; }
  .table th, .table td { padding: 11px 12px; }
  .hide-m { display: none; }
  .search { min-width: 0; flex: 1 1 100%; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  dialog[open] { animation: sheet .3s var(--ease); }
  .dialog-head { padding: 16px 18px; }
  .dialog-body { padding: 16px 18px max(20px, env(safe-area-inset-bottom)); }
  .detail > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .versions li, .d-history li { grid-template-columns: 56px minmax(0, 1fr); }
  .versions li span:last-child, .d-history li span:last-child { grid-column: 2; }
  .added li { grid-template-columns: 80px 1fr; } .added li strong { grid-column: 2; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { min-height: 220px; padding: 26px 24px; }
  .art-copy { margin: 18px 0 0; } .art-text, .art-steps { display: none; }
  .art-title { font-size: 26px; }
  .orbit { width: 420px; height: 420px; right: -170px; bottom: -260px; }
  .login-side { padding: 30px 22px 48px; place-items: start center; }
  .doctor { padding: 0 16px 150px; }
  .d-hello h1 { font-size: 23px; }
  .d-status { padding: 18px; }
  .d-status h2 { font-size: 16px; }
  .d-count strong { font-size: 38px; }
  .palette { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ptype { min-height: 52px; padding: 8px 10px; gap: 8px; }
  .ptype span { font-size: 12px; }
  .rweek, .rdays { gap: 5px; }
  .rday { min-height: 52px; border-radius: 12px; }
  .rnum { font-size: 17px; }
  .rtag { font-size: 9px; }
  .submit-bar { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .submit-bar .btn.large { min-height: 48px; padding: 10px 16px; font-size: 14px; }
  .bar-text p { font-size: 13px; }
  .bar-text small { font-size: 10.5px; }
  .de-search .check { font-size: 12px; }
  .cand-list { max-height: 46dvh; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media print {
  .sidebar, .topbar, .page-tools, .rail, .legend, .footnote, .calendar-list, .submit-bar, #toast, .month-chips, .tabs, .d-head .btn { display: none !important; }
  .shell { display: block; } .main { padding: 0; max-width: none; }
  .calendar-grid { display: block !important; } .workspace { display: block; } .stats { display: none; }
  .panel { box-shadow: none; border-color: #ccc; } .day { min-height: 110px; }
  body, :root { background: #fff; color: #000; }
}
