/* Design tokens: all application surfaces share this scale. */
:root {
  --brand: #b0003f;
  --brand-hover: #94003a;
  --brand-soft: #fcedf2;
  --brand-softer: #fdf5f8;
  --brand-border: #f0c4d3;
  --background: #f5f3f0;
  --surface: #fff;
  --surface-muted: #f8f6f4;
  --surface-hover: #f3efec;
  --text: #241f1d;
  --text-2: #4a423e;
  --muted: #776c66;
  --border: #e6e0db;
  --border-strong: #cfc6bf;
  --divider: #efeae6;
  --success: #1d7350;
  --success-soft: #e8f5ee;
  --success-border: #b9dcc9;
  --warning: #9a5800;
  --warning-soft: #fff4e0;
  --warning-border: #f0d29d;
  --danger: #b42318;
  --danger-soft: #fdeeec;
  --danger-border: #f2c6c0;
  --info: #2f5f98;
  --info-soft: #ebf2fb;
  --info-border: #c3d6ee;
  --on-brand: #fff;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --font-small: 13px;
  --font-control: 14px;
  --font-body: 15px;
  --font-section: 17px;
  --font-title: 22px;
  --line-body: 1.5;
  --radius-control: 8px;
  --radius: 12px;
  --radius-pill: 999px;
  --control-height: 34px;
  --control-small: 28px;
  --touch-height: 44px;
  --sidebar-width: 232px;
  --shadow: 0 1px 2px rgb(36 31 29 / 4%), 0 2px 8px rgb(36 31 29 / 4%);
  --shadow-raised: 0 4px 16px rgb(36 31 29 / 8%);
  --shadow-bar: 0 -4px 20px rgb(36 31 29 / 8%);
  --focus-halo: 0 0 0 3px rgb(176 0 63 / 14%);
  --z-sticky: 2;
  --z-sidebar: 5;
  --z-skip: 100;
  --transition: 150ms ease;
  color-scheme: light;
  accent-color: var(--brand);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: var(--font-body);
  line-height: var(--line-body);
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

/* Base */
* { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd, ul { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary, select, label:has(> input[type=radio]), label:has(> input[type=checkbox]) { cursor: pointer; }
h1 { font-size: var(--font-title); line-height: 1.35; font-weight: 650; letter-spacing: .5px; }
h2 { font-size: var(--font-section); line-height: 1.4; font-weight: 650; }
h3 { font-size: var(--font-body); font-weight: 650; margin: var(--space-6) 0 var(--space-3); }
small, .help { font-size: var(--font-small); }
.muted, .help { color: var(--muted); }
.required { color: var(--brand); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.full { width: 100%; }
.full-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.empty { color: var(--muted); text-align: center; padding: var(--space-8) var(--space-4); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:is(a, button, summary, input, select, textarea, label):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skip-link { position: absolute; top: -100px; left: var(--space-3); background: var(--surface); padding: var(--space-3); z-index: var(--z-skip); }
.skip-link:focus { top: var(--space-3); }

/* Frame: left sidebar + content */
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; z-index: var(--z-sidebar); display: flex; flex-direction: column; gap: var(--space-6); height: 100dvh; padding: var(--space-5) var(--space-3) var(--space-4); background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; letter-spacing: .5px; }
.brand small { display: block; color: var(--muted); font-size: var(--font-small); letter-spacing: 2px; }
.side-nav { display: grid; gap: var(--space-1); }
.nav-item { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3); color: var(--text-2); border-radius: 10px; font-weight: 500; transition: background var(--transition), color var(--transition); }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-hover); text-decoration: none; }
.nav-item.active { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.nav-item.active .icon { color: var(--brand); }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: auto; padding: var(--space-3) var(--space-2) 0; border-top: 1px solid var(--divider); }
.side-user-info { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.side-user-info strong, .side-user-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info strong { font-size: var(--font-control); font-weight: 600; line-height: 1.3; }
.side-user-info small { color: var(--muted); font-size: 12px; }
.side-user-actions { display: flex; gap: 2px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--radius-control); background: none; color: var(--muted); }
.icon-button:hover { background: var(--surface-hover); color: var(--brand); }
.avatar { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 650; font-size: var(--font-small); }
.side-user .avatar { width: 34px; height: 34px; font-size: var(--font-control); }
.avatar.large { width: 44px; height: 44px; font-size: 18px; }
.main { width: 100%; max-width: 1480px; margin: 0 auto; padding: var(--space-4) var(--space-6) var(--space-6); }

/* Page heading */
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-3); }
.page-sub { margin-top: 2px; color: var(--muted); }
.page-meta { display: flex; flex-wrap: wrap; gap: 2px var(--space-5); margin-top: 4px; color: var(--muted); font-size: var(--font-control); }
.page-meta strong { color: var(--text); font-weight: 600; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.back-link { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 var(--space-1) -4px; padding: 1px var(--space-1); border-radius: 6px; color: var(--muted); font-size: var(--font-control); }
.back-link .icon { width: 16px; height: 16px; }
.back-link:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3); }
.tabs a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 0 14px; border-radius: var(--radius-pill); color: var(--text-2); font-weight: 500; transition: background var(--transition); }
.tabs a:hover { background: var(--surface-hover); text-decoration: none; }
.tabs a.active { background: var(--text); color: #fff; }
.tabs a.active .count { background: rgb(255 255 255 / 20%); color: #fff; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 650; line-height: 1; }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-size: var(--font-control); font-weight: 550; white-space: nowrap; transition: background var(--transition), border-color var(--transition), box-shadow var(--transition); }
.button .icon { width: 16px; height: 16px; }
.button:hover { background: var(--surface-hover); text-decoration: none; }
.button:disabled { opacity: .45; cursor: not-allowed; }
[data-busy] { opacity: .6; cursor: progress; pointer-events: none; }
.button.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgb(176 0 63 / 25%); }
.button.primary:hover:not(:disabled) { background: var(--brand-hover); }
.button.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.button.soft:hover { background: #f8dde7; }
.button.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.button.ghost:hover { background: var(--surface-hover); }
.button.danger { color: var(--danger); border-color: var(--danger-border); }
.button.danger:hover { background: var(--danger-soft); }
.button.small { min-height: var(--control-small); padding: 0 var(--space-3); font-size: var(--font-small); }
.link { padding: 0; border: 0; background: none; color: var(--brand); font-size: inherit; }
.link.danger { color: var(--danger); }
form.inline { display: inline; }
input[type=text], input[type=search], input[type=date], input[type=month], input[type=password], input:not([type]), input[type=email], input[type=number], input[type=tel], select, textarea { width: 100%; min-height: var(--control-height); padding: 0 var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-size: var(--font-control); transition: border-color var(--transition), box-shadow var(--transition); }
select { padding-right: var(--space-6); }
textarea { min-height: 72px; padding: 6px var(--space-3); line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b9aea6; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus-halo); outline: none; }
input::placeholder, textarea::placeholder { color: #a39890; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; }

/* Segmented control: radios styled as joined buttons */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-hover); border-radius: 10px; }
.segmented label { position: relative; display: inline-flex; }
.segmented input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 var(--space-3); border-radius: 7px; color: var(--text-2); font-size: var(--font-control); font-weight: 500; white-space: nowrap; transition: background var(--transition), color var(--transition), box-shadow var(--transition); }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgb(36 31 29 / 14%); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.segmented .seg-count { color: var(--muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Toolbar (list filters) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.search-box { position: relative; flex: 1 1 280px; max-width: 420px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { min-height: 36px; padding-left: 38px; border-radius: 10px; background: var(--surface); font-size: var(--font-body); }

/* Notices and tags */
.messages { display: grid; gap: var(--space-2); margin-bottom: var(--space-3); }
.notice { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text-2); margin-bottom: var(--space-3); }
.messages .notice { margin-bottom: 0; }
.notice .icon { margin-top: 2px; }
.notice.success { background: var(--success-soft); border-color: var(--success-border); color: var(--success); }
.notice.warning { background: var(--warning-soft); border-color: var(--warning-border); color: var(--warning); }
.notice.error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.notice.info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 var(--space-2); border-radius: 6px; background: var(--surface-hover); color: var(--text-2); font-size: 12.5px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.tag.success { background: var(--success-soft); color: var(--success); }
.tag.warning { background: var(--warning-soft); color: var(--warning); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.tag.plain { background: var(--surface-hover); color: var(--text); }
.tag.outline { background: none; box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-control); font-weight: 550; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-dot.in { color: var(--success); }
.status-dot.out { color: var(--muted); }

/* Panels and tables */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-3); box-shadow: var(--shadow); scroll-margin-top: var(--space-3); }
.panel > h2, .panel-heading { margin-bottom: var(--space-3); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.panel-heading h2 { margin: 0; }
.panel-title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .table-wrap { box-shadow: none; border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px var(--space-3); border-bottom: 1px solid var(--divider); text-align: left; vertical-align: middle; }
.table thead th { background: var(--surface-muted); color: var(--muted); font-size: var(--font-small); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 6px 10px; }
.table-wrap .table tbody tr { transition: background var(--transition); }
.table-wrap .table tbody tr:hover { background: var(--brand-softer); }
.sub { display: block; color: var(--muted); font-size: var(--font-small); line-height: 1.4; }
.table .actions-cell { text-align: right; white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3) var(--space-5); }
.detail-grid .wide { grid-column: 1 / -1; }
.detail-grid dt { color: var(--muted); font-size: var(--font-small); }
.detail-grid dd { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.section-label { margin: var(--space-4) 0 var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--divider); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3) var(--space-4); }
.field { display: grid; gap: 4px; align-content: start; }
.field > label { color: var(--text-2); font-weight: 550; font-size: var(--font-control); }
.field.choice-field, .field:has(textarea), .wide-field { grid-column: 1 / -1; }
.field.choice-field > div { display: flex; flex-wrap: wrap; gap: 6px; }
.field.choice-field > div > div { display: contents; }
.field.choice-field > div label { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); font-weight: 400; font-size: var(--font-control); transition: background var(--transition), border-color var(--transition); }
.field.choice-field > div label:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.field.choice-field > div label:has(input:checked) { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand); font-weight: 550; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.has-error > label { color: var(--danger); }
.error-text { color: var(--danger); font-size: var(--font-small); }
.check { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 500; min-height: var(--control-height); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.narrow-form { max-width: 560px; }
.stack-form { display: grid; gap: var(--space-3); }
/* Login */
.login-body { background: radial-gradient(1200px 600px at 15% -10%, #fbe3ec 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #f6e9dd 0%, transparent 55%), var(--background); }
.login-body .main { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); }
.login-card { width: min(420px, 100%); padding: 44px 36px 36px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 20px 48px rgb(36 31 29 / 10%); display: grid; gap: var(--space-8); }
.login-brand { display: grid; justify-items: center; gap: var(--space-2); text-align: center; }
.login-brand img { width: 56px; height: 56px; margin-bottom: var(--space-1); }
.login-brand h1 { font-size: 24px; font-weight: 700; letter-spacing: 2px; line-height: 1.3; }
.login-brand p { color: var(--muted); font-size: 15px; letter-spacing: 6px; padding-left: 6px; }
.login-card .field > label { font-size: var(--font-body); }
.login-card input { min-height: 46px; font-size: 16px; padding-inline: var(--space-4); border-radius: 10px; }
.login-card .button { min-height: 46px; font-size: 16px; margin-top: var(--space-2); border-radius: 10px; }
.login-card form { display: grid; gap: var(--space-4); }

.error-page { margin: 10vh auto 0; text-align: center; }
.error-page p { margin-top: var(--space-3); }
.table td.empty { text-align: center; }
.table tfoot th { background: var(--surface-muted); font-weight: 650; border-top: 1px solid var(--border); border-bottom: 0; }
.table .num { text-align: right; }
.space-top { margin-top: var(--space-3); }
.print-only { display: none; }
.sr-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.form-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.small-link { display: inline-flex; align-items: center; gap: 3px; font-size: var(--font-small); }
.small-link .icon { width: 14px; height: 14px; }
.month-nav { display: inline-flex; align-items: center; gap: var(--space-1); }
.month-nav strong { min-width: 7.5em; text-align: center; font-variant-numeric: tabular-nums; }
.inline-date input { width: auto; min-height: var(--control-small); }

/* 员工端：手机优先，顶栏 + 底部页签 */
.staff-body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.staff-bar { position: sticky; top: 0; z-index: var(--z-sidebar); display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-4); background: var(--surface); border-bottom: 1px solid var(--border); }
.staff-bar .brand { padding: 0; }
.staff-bar-actions { display: flex; align-items: center; gap: 2px; }
.staff-bar-actions .button { margin-right: var(--space-1); }
.staff-main { width: 100%; max-width: 640px; margin: 0 auto; padding: var(--space-3) var(--space-3) var(--space-6); }
.staff-main .panel { padding: var(--space-4); }
.tabbar { position: fixed; inset: auto 0 0; z-index: var(--z-sidebar); display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: env(safe-area-inset-bottom); background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); border-top: 1px solid var(--border); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); font-size: 12.5px; }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a:hover { text-decoration: none; color: var(--text); }
.tabbar a.active { color: var(--brand); font-weight: 650; }
.focus-card { margin-bottom: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--brand-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.focus-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-3); }
.focus-head h1 { font-size: 20px; }
.focus-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.focus-cells .cell { min-height: 76px; font-size: 17px; }
.focus-cells .cell-state { font-size: 15px; }
.deadline { display: flex; align-items: flex-start; gap: 6px; margin-top: var(--space-3); color: var(--warning); font-size: var(--font-control); }
.deadline .icon { margin-top: 2px; width: 16px; height: 16px; }
.plan-summary { display: flex; flex-wrap: wrap; gap: 2px var(--space-4); color: var(--text-2); font-size: var(--font-control); }
.month-mini { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); color: var(--text); }
.month-mini:hover { text-decoration: none; border-color: var(--brand-border); }
.month-mini strong { color: var(--brand); font-variant-numeric: tabular-nums; }

/* 报餐格子：已报为品牌色，不吃为灰框；带锁的已截止 */
.cell-form { display: contents; }
.cell { position: relative; display: grid; touch-action: manipulation; place-items: center; align-content: center; gap: 1px; width: 100%; min-height: 52px; padding: 4px 2px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1.25; transition: background var(--transition), border-color var(--transition), color var(--transition); }
.cell-name { font-weight: 600; }
.cell-state { font-size: 12.5px; }
.cell:not(.on) .cell-name { text-decoration: line-through; text-decoration-color: rgb(119 108 102 / 50%); }
.cell.on { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
button.cell:hover { border-color: var(--brand); }
button.cell.on:hover { background: var(--brand-hover); }
.cell.locked { border-style: dashed; background: var(--surface-muted); }
.cell.locked.on { border-color: var(--brand-border); border-style: solid; background: var(--brand-soft); color: var(--brand); }
.cell.late:not(.on) { border-style: dashed; }
.cell.adjusted::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 2px var(--surface); }
.cell[data-busy] { opacity: .6; }
.day-list { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.day-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: var(--space-1) var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--divider); scroll-margin-top: 72px; }
.day-row:first-child { padding-top: 0; border-top: 0; }
.day-label { display: grid; line-height: 1.3; }
.day-label strong { font-size: 15px; }
.day-label small { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.day-label .icon { width: 12px; height: 12px; }
.day-label .day-amount { color: var(--text-2); }
.day-row.is-today .day-label strong { color: var(--brand); }
.day-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.day-skip .link { font-size: 12px; line-height: 1.6; }

/* 固定报餐：每个餐次一组星期按钮 */
.plan-form { display: grid; gap: var(--space-3); }
.plan-meal { margin: 0; padding: var(--space-3) var(--space-4) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.plan-meal legend { float: left; width: 100%; margin-bottom: var(--space-3); padding: 0; font-size: var(--font-section); font-weight: 650; }
.plan-days { clear: both; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.plan-days > div { display: contents; }
.day-chip { position: relative; display: grid; touch-action: manipulation; place-items: center; min-height: var(--touch-height); border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: var(--font-control); font-weight: 600; }
.day-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.day-chip:has(input:checked) { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.day-chip:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.plan-quick { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.plan-edit summary { list-style: none; }
.plan-edit summary::-webkit-details-marker { display: none; }
.plan-edit[open] summary { margin-bottom: var(--space-3); }
.plan-edit .plan-form { max-width: 560px; }

/* 后台统计 */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.stat { display: grid; gap: 2px; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: var(--font-control); }
.stat strong { font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat strong small { color: var(--muted); font-size: var(--font-control); font-weight: 500; }
.stat em { color: var(--text-2); font-size: var(--font-small); font-style: normal; }
.stat.total { border-color: var(--brand-border); background: var(--brand-softer); }
.stat.total strong { color: var(--brand); }
.meal-lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); align-items: start; }
.meal-list .panel-heading { margin-bottom: var(--space-2); }
.count-plain { color: var(--muted); font-size: var(--font-control); font-weight: 500; }
.group { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); align-items: baseline; gap: var(--space-2); padding: 5px 0; border-top: 1px solid var(--divider); font-size: var(--font-control); }
.group:first-of-type { border-top: 0; }
.group-name { color: var(--muted); font-size: var(--font-small); }
.group-name em { font-style: normal; font-variant-numeric: tabular-nums; }
.names { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); }
.summary-table { max-width: 720px; }
.adjust-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.adjust-form .field { min-width: 200px; }
.adjust-form .field span { color: var(--text-2); font-weight: 550; font-size: var(--font-control); }
.adjust-form .actions { margin-top: 0; }
.employee-table { min-width: 860px; }
.employee-table tbody tr { position: relative; }
.employee-table tr.is-out td { color: var(--muted); }
.row-link { font-weight: 650; }
.row-link::after { content: ""; position: absolute; inset: 0; }
.plan-cell { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); font-size: var(--font-control); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 var(--space-3); align-items: start; }
.day-table { min-width: 560px; }
.day-table th:nth-child(n+2):nth-child(-n+4), .day-table td:nth-child(n+2):nth-child(-n+4) { width: 96px; }
.day-table td { padding-top: 4px; padding-bottom: 4px; }
.day-table .cell { min-height: 30px; border-radius: 8px; }
.day-table .cell-name { display: none; }
.day-table .cell-state { font-size: var(--font-control); font-weight: 600; white-space: nowrap; }
.day-table .cell.adjusted::after { top: 4px; right: 4px; width: 6px; height: 6px; }
.day-cell-date { width: 170px; white-space: nowrap; }
.day-table .day-skip .link { color: var(--muted); white-space: nowrap; }
.day-table .day-skip .link:hover { color: var(--brand); }
.day-cell-date .icon { width: 13px; height: 13px; color: var(--muted); vertical-align: -1px; }
.day-table tr.is-today td { background: var(--brand-softer); }
.nowrap-cells th, .nowrap-cells td { white-space: nowrap; }
input[type=file] { width: 100%; padding: var(--space-3); border: 1px dashed var(--border-strong); border-radius: var(--radius-control); background: var(--surface-muted); font-size: var(--font-control); }
input[type=file]::file-selector-button { margin-right: var(--space-3); padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; }
.sticky-actions { position: sticky; bottom: var(--space-2); z-index: var(--z-sticky); padding: var(--space-2) var(--space-3); background: rgb(255 255 255 / 94%); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-bar); }
.staff-body .sticky-actions { bottom: calc(68px + env(safe-area-inset-bottom)); }
.form-total { margin-right: auto; font-size: var(--font-control); color: var(--muted); }
.main > .sticky-actions { margin-top: var(--space-3); }
.form-total strong { margin: 0 2px; color: var(--brand); font-size: 18px; }

/* 初始密码单：打印后沿虚线剪开发给员工 */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.slip { padding: var(--space-4); border: 1px dashed var(--border-strong); border-radius: var(--radius-control); background: var(--surface); break-inside: avoid; }
.slip-name { display: flex; align-items: baseline; gap: var(--space-2); font-size: 18px; }
.slip-name small { color: var(--muted); font-size: var(--font-small); font-weight: 500; }
.slip dl { display: grid; gap: 2px; margin: var(--space-2) 0; }
.slip dl div { display: grid; grid-template-columns: 5.5em 1fr; align-items: baseline; }
.slip dt { color: var(--muted); font-size: var(--font-small); }
.slip dd { overflow-wrap: anywhere; }
.slip-title { margin-bottom: var(--space-2); color: var(--muted); font-size: 12px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: 2px; user-select: all; }

/* 窄屏：后台侧栏变顶栏 */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { position: sticky; flex-direction: row; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); height: auto; padding: var(--space-2) var(--space-4); border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; }
  .side-nav { display: flex; flex: 1; flex-wrap: wrap; }
  .nav-item { min-height: 38px; }
  .side-user { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-user-info small { display: none; }
  .main { padding: var(--space-4); }
  .meal-lists { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { flex-wrap: nowrap; gap: var(--space-2); padding: var(--space-2) var(--space-3); }
  .sidebar .brand span, .nav-item span, .side-user-info { display: none; }
  .side-nav { flex-wrap: nowrap; gap: 2px; }
  .nav-item { padding: 0 10px; }
  .hide-mobile { display: none !important; }
  .day-table { min-width: 480px; }
  .day-cell-date { width: auto; }
  .day-table th:nth-child(n+2):nth-child(-n+4), .day-table td:nth-child(n+2):nth-child(-n+4) { width: 64px; padding-inline: 4px; }
  .main { padding: var(--space-3); }
  .panel { padding: var(--space-4); }
  .search-box { max-width: none; }
  .button, input:not([type=checkbox]):not([type=radio]), select { min-height: var(--touch-height); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .day-row { grid-template-columns: 68px minmax(0, 1fr); }
  .plan-days { gap: 4px; }
  .day-chip { font-size: 13px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  :root { background: #fff; font-size: 12px; }
  .no-print, .sidebar, .messages, .back-link, .tabbar, .staff-bar { display: none !important; }
  .app-shell { display: block; }
  .main { max-width: none; padding: 0; }
  .panel, .table-wrap, .stat { box-shadow: none; }
  .tag { padding: 0; background: none; color: #000; }
  .table th, .table td { padding: 4px 6px; }
  .print-only { display: block; }
  .page-meta .print-only { display: inline; }
  .print-title { margin-bottom: 2px; color: #555; font-size: 11px; }
  a { color: inherit; }
  .stat-row { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .stat { padding: 6px 10px; }
  .stat strong { font-size: 22px; }
  .meal-lists { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .meal-list { padding: 8px 10px; }
  .group { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 3px 0; font-size: 11px; break-inside: avoid; }
  .slips { grid-template-columns: repeat(3, 1fr); gap: 0; }
  .slip { border-radius: 0; margin: -0.5px; }
  tr { break-inside: avoid; }
}
