/* Liquid glass theme in the Chunhui logo colours (crimson, orange, peach, rose). */
:root {
  --brand: #c8004a;
  --brand-hover: #a8003e;
  --brand-2: #d9363a;
  --accent: #ec6a2a;
  --peach: #f29b6c;
  --rose: #e0687a;
  --brand-soft: rgb(200 0 74 / 9%);
  --brand-gradient: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  --background: #fbf4f0;
  --surface: #fff;
  --surface-muted: rgb(255 255 255 / 55%);
  --text: #2a1f22;
  --muted: #6c5c5f;
  --border: rgb(120 50 60 / 16%);
  --divider: rgb(120 50 60 / 10%);
  --success: #1f7a52;
  --success-soft: rgb(31 122 82 / 11%);
  --warning: #965600;
  --warning-soft: rgb(236 150 20 / 15%);
  --danger: #b42318;
  --danger-soft: rgb(180 35 24 / 9%);
  --glass: linear-gradient(160deg, rgb(255 255 255 / 74%) 0%, rgb(255 255 255 / 50%) 100%);
  --glass-strong: linear-gradient(160deg, rgb(255 255 255 / 90%) 0%, rgb(255 255 255 / 78%) 100%);
  --glass-fill: linear-gradient(180deg, rgb(255 255 255 / 78%) 0%, rgb(255 255 255 / 48%) 100%);
  --glass-edge: rgb(255 255 255 / 78%);
  --glass-shadow:
    inset 0 1px 0 rgb(255 255 255 / 90%),
    inset 0 -1px 0 rgb(255 255 255 / 30%),
    0 2px 6px rgb(110 20 40 / 5%),
    0 14px 34px -14px rgb(110 20 40 / 24%);
  --fill-shadow: inset 0 1px 0 rgb(255 255 255 / 95%), 0 1px 2px rgb(110 20 40 / 7%), 0 4px 12px -6px rgb(110 20 40 / 16%);
  --blur: blur(24px) saturate(180%);
  --focus-ring: 0 0 0 3px rgb(200 0 74 / 20%);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --radius: 12px;
  --radius-lg: 20px;
  --control-height: 36px;
  --touch-height: 44px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body, h1, h2, h3, p, ul, dl, dd { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; font-weight: 700; line-height: 1.4; letter-spacing: 0.01em; }
h2 { font-size: 16px; font-weight: 650; margin-bottom: var(--space-3); }
h3 { font-size: 14px; font-weight: 650; margin-bottom: var(--space-2); }
h1 small, h2 small { font-size: 13px; font-weight: 400; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.error-text { color: var(--danger); display: block; }
code.secret { font-size: 20px; padding: 2px 10px; background: var(--brand-soft); color: var(--brand); border-radius: 8px; user-select: all; }

/* Backdrop: soft colour fields behind the glass, fixed so they do not scroll. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42vmax 42vmax at 4% 6%, rgb(236 106 42 / 30%), transparent 70%),
    radial-gradient(46vmax 46vmax at 96% 2%, rgb(200 0 74 / 20%), transparent 70%),
    radial-gradient(50vmax 50vmax at 88% 96%, rgb(242 155 108 / 32%), transparent 70%),
    radial-gradient(40vmax 40vmax at 10% 96%, rgb(224 104 122 / 22%), transparent 70%),
    linear-gradient(160deg, #fff8f3 0%, #fbeeee 100%);
}

/* Glass surfaces. Nested panels use --glass-fill without their own blur. */
.app-sidebar, .card, .sheet, .tabs, .notice {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* Sidebar navigation. */
.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.app-sidebar {
  display: flex; flex-direction: column; gap: var(--space-6);
  margin: var(--space-3) 0 var(--space-3) var(--space-3); padding: var(--space-4) var(--space-3);
  height: calc(100vh - 2 * var(--space-3)); border-radius: var(--radius-lg);
  position: sticky; top: var(--space-3); z-index: 3;
}
.brand { display: flex; align-items: center; gap: var(--space-3); color: var(--text); padding: var(--space-1) var(--space-1) 0; }
.brand:hover { text-decoration: none; }
.brand img { flex: none; filter: drop-shadow(0 4px 8px rgb(200 0 74 / 22%)); }
.brand span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand strong { font-size: 15px; letter-spacing: 0.04em; }
.brand em {
  font-style: normal; font-weight: 650; font-size: 13px; letter-spacing: 0.18em;
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand small { color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campus-switch { display: grid; gap: var(--space-1); font-size: 13px; }
.campus-menu { position: relative; }
.campus-menu summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-height); padding: 0 var(--space-2) 0 var(--space-3);
  list-style: none; cursor: pointer; font-size: 14px; border: 1px solid var(--glass-edge); border-radius: var(--radius);
  background: var(--glass-fill); box-shadow: var(--fill-shadow); transition: border-color 0.15s, background 0.15s;
}
.campus-menu summary::-webkit-details-marker { display: none; }
.campus-menu summary:hover, .campus-menu[open] summary { border-color: rgb(200 0 74 / 28%); background: rgb(255 255 255 / 88%); }
.campus-menu summary span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campus-menu summary svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.campus-menu[open] summary svg { transform: rotate(180deg); }
/* Sidebar dropdown panels: solid white, since the sidebar glass behind them would show through. */
.campus-menu-panel, .user-menu-panel {
  position: absolute; left: 0; right: 0; z-index: 20; display: grid; gap: 2px; padding: var(--space-1);
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgb(110 20 40 / 8%), 0 18px 36px -12px rgb(110 20 40 / 28%);
}
.campus-menu-panel { top: calc(100% + 6px); }
.campus-menu-panel button, .select-panel [role=option] {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 7px var(--space-3) 7px var(--space-2);
  border: 0; border-radius: 8px; background: none; text-align: left; font-size: 14px; cursor: pointer;
}
.campus-menu-panel button::before, .select-panel [role=option]::before { content: ""; width: 16px; flex: none; text-align: center; }
.campus-menu-panel button:hover, .select-panel [role=option]:hover:not(:disabled) { background: var(--brand-soft); }
.campus-menu-panel button:focus-visible, .select-panel [role=option]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.campus-menu-panel button[aria-current], .select-panel [aria-selected=true] { color: var(--brand); font-weight: 600; }
.campus-menu-panel button[aria-current]::before, .select-panel [aria-selected=true]::before { content: "✓" / ""; }
.side-nav { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.side-nav a {
  padding: 9px var(--space-4); border-radius: var(--radius); color: var(--text); white-space: nowrap;
  border: 1px solid transparent; transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.side-nav a:hover { background: var(--glass-fill); border-color: var(--glass-edge); text-decoration: none; }
.side-nav a.active {
  background: var(--brand-gradient); color: #fff; font-weight: 600; border-color: rgb(255 255 255 / 30%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%), 0 8px 18px -8px rgb(200 0 74 / 65%), 0 4px 14px -8px rgb(236 106 42 / 60%);
}
.user-menu { position: relative; border-top: 1px solid var(--divider); padding-top: var(--space-2); }
.user-menu summary {
  display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2); list-style: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius); transition: background 0.15s, border-color 0.15s;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--glass-fill); border-color: var(--glass-edge); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--brand-gradient); color: #fff; font-weight: 600; box-shadow: 0 4px 10px -4px rgb(200 0 74 / 55%);
}
.user-name { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.user-name strong, .user-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name strong { font-weight: 600; }
.user-name small { color: var(--muted); }
.user-menu summary > svg, .menu-item svg {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.user-menu summary > svg { color: var(--muted); transform: rotate(180deg); transition: transform 0.15s; }
.user-menu[open] summary > svg { transform: none; }
.user-menu-panel { bottom: calc(100% + 6px); }
.user-info { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-3); padding: var(--space-2) var(--space-3) var(--space-3); margin-bottom: 2px; border-bottom: 1px solid var(--divider); font-size: 12px; }
.user-info dt { color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 7px var(--space-3);
  border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; font-size: 14px; cursor: pointer;
}
.menu-item:hover { background: var(--brand-soft); text-decoration: none; }
.menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.menu-item svg { color: var(--muted); }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }

/* Layout. */
.main { width: 100%; max-width: 1280px; margin: 0 auto; padding: var(--space-6); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-content: start; }
.narrow { max-width: 560px; width: 100%; margin: 0 auto; display: grid; gap: var(--space-4); }
.narrow.wide { max-width: 860px; }
.page-head { display: grid; gap: var(--space-2); }
.page-head.row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
/* Back link: glass pill with a chevron that nudges left on hover. */
.crumb { font-size: 13px; }
.crumb a {
  display: inline-flex; align-items: center; gap: 2px; min-height: 30px; padding: 0 14px 0 8px;
  border: 1px solid var(--glass-edge); border-radius: 999px;
  background: var(--glass-fill); box-shadow: var(--fill-shadow);
  color: var(--muted); font-weight: 500;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.crumb a::before {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor; transition: transform 0.15s;
  -webkit-mask: url("chevron-left.svg") center / contain no-repeat;
  mask: url("chevron-left.svg") center / contain no-repeat;
}
.crumb a:hover { color: var(--brand); background: rgb(255 255 255 / 92%); border-color: rgb(200 0 74 / 22%); text-decoration: none; }
.crumb a:hover::before { transform: translateX(-2px); }
.crumb a:focus-visible { outline: none; box-shadow: var(--fill-shadow), var(--focus-ring); }
.card { border-radius: var(--radius-lg); padding: var(--space-4) 20px; }
.card > p.muted { margin-bottom: var(--space-3); }
.table-wrap { overflow-x: auto; }
.table-wrap.card { background: var(--glass-strong); padding: var(--space-2); }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }

/* Controls. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-height: var(--control-height); padding: 0 18px;
  border: 1px solid var(--glass-edge); border-radius: 999px;
  background: var(--glass-fill); box-shadow: var(--fill-shadow);
  color: var(--text); cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}
.button:hover { background: rgb(255 255 255 / 92%); border-color: rgb(200 0 74 / 22%); text-decoration: none; }
.button:active { transform: scale(0.97); }
.button.primary {
  background: var(--brand-gradient); border-color: rgb(255 255 255 / 30%); color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%), 0 8px 18px -8px rgb(200 0 74 / 65%), 0 4px 14px -8px rgb(236 106 42 / 55%);
}
.button.primary:hover { background: linear-gradient(135deg, var(--brand-hover) 0%, #c42b31 100%); }
.button.danger { color: var(--danger); border-color: rgb(180 35 24 / 25%); }
.button.danger:hover { background: var(--danger-soft); }
.button.small { min-height: 28px; padding: 0 var(--space-3); font-size: 12px; }
.button.block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
.link.danger { color: var(--danger); }
.small-link { font-size: 12px; font-weight: 400; margin-left: var(--space-2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  min-height: var(--control-height); padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: 10px; background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 1px 2px rgb(110 20 40 / 6%);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { padding: var(--space-2) var(--space-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: var(--focus-ring); }
.button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
.form { display: grid; gap: var(--space-4); }
.form .field input:not([type=checkbox]):not([type=radio]), .form .field select { width: 100%; }
.field { display: grid; gap: var(--space-1); }
.field .label, .field > label.label { font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error .select-button, .select.invalid .select-button { border-color: var(--danger); }
/* Custom select (see app.js): the invisible native select and the button share one grid cell. */
.select { display: inline-grid; min-width: 0; }
.select > .select-native, .select > .select-button { grid-area: 1 / 1; }
.select > .select-native { opacity: 0; pointer-events: none; }
.select-button {
  display: flex; align-items: center; gap: var(--space-2); min-width: 0; min-height: var(--control-height); padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--border); border-radius: 10px; background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 1px 2px rgb(110 20 40 / 6%); text-align: left; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.select-button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-button.placeholder span { color: var(--muted); }
.select-button svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.select-button:hover:not(:disabled) { border-color: rgb(200 0 74 / 28%); background: rgb(255 255 255 / 88%); }
.select-button:focus-visible, .select.open .select-button, .select-native:focus + .select-button { outline: none; border-color: var(--brand); background: #fff; box-shadow: var(--focus-ring); }
.select.open .select-button svg { transform: rotate(180deg); }
.select-button:disabled { opacity: 0.55; cursor: not-allowed; }
.select-panel {
  position: fixed; inset: auto; margin: 0; max-width: calc(100vw - 16px); max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-1); color: var(--text); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgb(110 20 40 / 8%), 0 18px 36px -12px rgb(110 20 40 / 28%);
}
.select-panel:popover-open { display: grid; gap: 2px; align-content: start; }
.select-panel [role=option]:disabled { color: var(--muted); cursor: not-allowed; }
.select-group { display: grid; gap: 2px; }
.select-group + .select-group, [role=option] + .select-group { margin-top: var(--space-1); padding-top: var(--space-1); border-top: 1px solid var(--divider); }
.select-group-label { padding: 4px var(--space-3); font-size: 12px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.check { display: inline-flex; align-items: center; gap: var(--space-1); cursor: pointer; }
.check-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.check-row > div { display: contents; }
.check.pill {
  padding: 5px var(--space-3); border: 1px solid var(--glass-edge); border-radius: 999px;
  background: var(--glass-fill); box-shadow: var(--fill-shadow); transition: background 0.15s, border-color 0.15s;
}
.check.pill:has(input:checked) { border-color: rgb(200 0 74 / 45%); background: rgb(200 0 74 / 10%); color: var(--brand); font-weight: 600; }
.picker-group { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: var(--space-2); align-items: start; padding: 6px 0; }
.picker-group + .picker-group { border-top: 1px solid var(--divider); }
.picker-group > span { font-size: 13px; padding-top: 6px; }
.rule-form .select { max-width: 320px; }
.rule-form .field input[type=number] { max-width: 120px; }
.other-rules {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin-top: calc(-1 * var(--space-2));
  padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: rgb(255 255 255 / 55%); border: 1px dashed var(--border); font-size: 13px;
}
.other-rules ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin: 0; padding: 0; list-style: none; }
/* Temporary meal form: sections split by dividers, add-ons as cards with a stepper. */
.card.extra-form { gap: 0; padding: 0; }
.extra-form > .notice { margin: var(--space-4) 20px 0; }
.form-section { padding: var(--space-4) 20px; }
section.form-section { display: grid; gap: var(--space-2); }
.form-section + .form-section { border-top: 1px solid var(--divider); }
.form-section .label { font-weight: 600; }
.form-section .label small { margin-left: var(--space-1); font-weight: 400; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); }
.addon-card {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 6px 6px 6px var(--space-3); border: 1px solid var(--glass-edge); border-radius: var(--radius);
  background: var(--glass-fill); box-shadow: var(--fill-shadow); transition: background 0.15s, border-color 0.15s;
}
.addon-card label { display: grid; min-width: 0; line-height: 1.35; cursor: pointer; }
.addon-card.picked { border-color: rgb(200 0 74 / 45%); background: rgb(200 0 74 / 8%); }
.addon-card.picked strong { color: var(--brand); }
.addon-card.has-error { border-color: var(--danger); }
.stepper { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--border); border-radius: 999px; background: rgb(255 255 255 / 80%); }
.stepper button { width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--brand); font-size: 18px; line-height: 1; cursor: pointer; }
.stepper button:hover { background: var(--brand-soft); }
.stepper button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.stepper input[type=number] {
  width: 36px; min-height: 32px; padding: 0; border: 0; background: none; box-shadow: none;
  text-align: center; font-variant-numeric: tabular-nums; appearance: textfield;
}
.stepper input[type=number]:focus { background: none; box-shadow: none; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.addons { display: block; font-size: 0.9em; color: var(--brand); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.search-bar { display: flex; gap: var(--space-2); }
.search-bar input { flex: 1; }
/* Pill search with the submit button inside, sized like .button. */
form.search-field {
  display: flex; align-items: center; gap: var(--space-1);
  min-height: var(--control-height); padding: 3px 3px 3px var(--space-3);
  border: 1px solid var(--border); border-radius: 999px; background: rgb(255 255 255 / 72%);
  box-shadow: inset 0 1px 2px rgb(110 20 40 / 6%);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.search-field:focus-within { border-color: var(--brand); background: #fff; box-shadow: var(--focus-ring); }
.search-field svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.search-field input[type=search], .search-field input[type=search]:focus {
  width: 168px; min-height: 0; padding: 0 var(--space-1); border: 0; background: transparent; box-shadow: none;
}
.search-field button {
  min-height: 28px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.search-field button:hover { background: rgb(200 0 74 / 16%); }
.search-field button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.login-body::before {
  background:
    radial-gradient(48vmax 48vmax at 8% 12%, rgb(236 106 42 / 45%), transparent 70%),
    radial-gradient(50vmax 50vmax at 92% 8%, rgb(200 0 74 / 34%), transparent 70%),
    radial-gradient(52vmax 52vmax at 86% 94%, rgb(242 155 108 / 45%), transparent 70%),
    radial-gradient(44vmax 44vmax at 12% 92%, rgb(224 104 122 / 36%), transparent 70%),
    linear-gradient(160deg, #fff6f0 0%, #fbe9ec 100%);
}
.login-main { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.login-card { width: min(420px, 100%); display: grid; gap: var(--space-4); padding: 36px 32px 32px; border-radius: 28px; }
.login-card .field input { width: 100%; }
.login-card .button.block { min-height: 42px; margin-top: var(--space-2); font-size: 15px; }
.login-brand { display: grid; justify-items: center; gap: var(--space-3); text-align: center; margin-bottom: var(--space-2); }
.login-brand img { filter: drop-shadow(0 8px 16px rgb(200 0 74 / 25%)); }
.login-brand strong { font-size: 20px; letter-spacing: 0.06em; }

/* Feedback. */
/* Messages float as toasts at the top; successes fade on their own, the rest stay longer. */
.toasts {
  position: fixed; top: var(--space-4); left: 50%; z-index: 50; transform: translateX(-50%);
  display: grid; gap: var(--space-2); width: max-content; max-width: min(480px, calc(100vw - 2 * var(--space-4)));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  box-shadow: 0 12px 32px -12px rgb(110 20 40 / 35%); animation: toast-in 0.2s ease-out;
}
.toast > span { flex: 1; padding-top: 2px; }
.toast.leaving { opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.2s; }
.toast-close { flex: none; width: 26px; height: 26px; border: 0; border-radius: 8px; background: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: 0.6; }
.toast-close:hover { opacity: 1; background: rgb(0 0 0 / 6%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.notice { padding: var(--space-2) var(--space-4); border-radius: var(--radius); }
.notice.success { background: linear-gradient(var(--success-soft), var(--success-soft)), var(--glass-strong); border-color: rgb(31 122 82 / 25%); color: var(--success); }
.notice.warning { background: linear-gradient(var(--warning-soft), var(--warning-soft)), var(--glass-strong); border-color: rgb(236 150 20 / 35%); color: var(--warning); }
.notice.error { background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--glass-strong); border-color: rgb(180 35 24 / 25%); color: var(--danger); }
.tag {
  display: inline-block; padding: 1px var(--space-2); border-radius: 999px; font-size: 12px; white-space: nowrap;
  background: rgb(255 255 255 / 70%); border: 1px solid var(--divider);
}
.tag.success { background: var(--success-soft); border-color: rgb(31 122 82 / 20%); color: var(--success); }
.tag.warning { background: var(--warning-soft); border-color: rgb(236 150 20 / 30%); color: var(--warning); }

/* Tables. */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: var(--space-2) 10px; border-bottom: 1px solid var(--divider); text-align: left; vertical-align: top; }
.table thead th { background: rgb(200 0 74 / 6%); color: #5a2a36; font-weight: 600; white-space: nowrap; border-bottom-color: rgb(200 0 74 / 14%); }
.table thead th:first-child { border-top-left-radius: 10px; }
.table thead th:last-child { border-top-right-radius: 10px; }
.table tbody tr:hover > td { background: rgb(200 0 74 / 3%); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 5px var(--space-2); }
tr.muted td { color: var(--muted); }
.row-actions { display: flex; gap: var(--space-3); }
.row-actions form { display: inline; }
.cell-stop { color: var(--danger); font-weight: 600; }
.cell-none { color: var(--muted); }
.list { list-style: none; padding: 0; display: grid; gap: var(--space-1); }

/* Home. */
.day-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); align-items: stretch; }
.day-card { display: flex; flex-direction: column; gap: var(--space-3); }
.day-card header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.day-card header h2 { margin: 0; font-size: 18px; }
.day-card header h2 small { margin-left: var(--space-1); color: var(--muted); font-size: 14px; font-weight: 500; }
.day-card.stage-print { border-color: rgb(31 122 82 / 30%); box-shadow: var(--glass-shadow), 0 0 0 3px rgb(31 122 82 / 7%); }
.day-card.stage-pending { border-color: rgb(236 150 20 / 40%); box-shadow: var(--glass-shadow), 0 0 0 3px rgb(236 150 20 / 10%); }
.day-card .actions { margin-top: auto; }
.meal-lines { display: grid; gap: var(--space-2); }
.meal-line {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-3); align-items: start;
  background: var(--glass-fill); border: 1px solid var(--glass-edge); box-shadow: var(--fill-shadow); border-radius: var(--radius); padding: var(--space-2) var(--space-3);
}
.meal-total { display: grid; justify-items: center; }
.meal-total span { color: var(--muted); font-size: 12px; }
.combos { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; align-self: center; font-size: 13px; }
.combos li { display: flex; justify-content: space-between; gap: var(--space-2); }
.combos li b { font-variant-numeric: tabular-nums; font-weight: 600; }
.combos li b::before { content: "× "; color: var(--muted); font-weight: 400; }
.day-notes { margin: 0; font-size: 13px; }
.day-card .notice { margin: 0; font-size: 13px; }
.meal-total strong, .stat strong {
  font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3;
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Resident page. */
.resident-head { align-items: flex-start; }
.resident-head h1 small { margin-left: var(--space-1); }
.resident-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-size: 13px; }
.diet-tag { padding: 1px var(--space-2); border-radius: 6px; background: var(--warning-soft); color: var(--warning); font-weight: 600; }
.card-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-3); margin-bottom: var(--space-3); }
.card-head h2 { margin: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.rule-col { min-width: 0; padding: var(--space-2) var(--space-2) var(--space-1); border: 1px solid var(--glass-edge); border-radius: var(--radius); background: var(--glass-fill); box-shadow: var(--fill-shadow); }
.rule-col-head { display: flex; align-items: center; gap: 2px; padding: 0 0 6px var(--space-1); border-bottom: 1px solid var(--divider); }
.rule-col-head h3 { margin: 0 auto 0 0; font-size: 15px; color: #5a2a36; }
.rule-col-head .row-edit { color: var(--brand); white-space: nowrap; }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 4px var(--space-1); border-radius: 8px; transition: background 0.15s; }
.rule + .rule { border-top: 1px solid var(--divider); }
.rule:hover { background: rgb(255 255 255 / 70%); }
.rule .tag { flex: none; }
.rule-name { flex: 1; min-width: 0; }
.rule-actions { flex: none; display: flex; }
.rule-actions form { display: contents; }
.rule-empty { padding: var(--space-2) var(--space-1); color: var(--muted); }
.table.week { table-layout: fixed; min-width: 940px; }
.table.week th, .table.week td { padding: 6px var(--space-2); }
.week thead th { font-size: 13px; line-height: 1.35; }
.week thead th small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.week .week-corner { width: 72px; }
.week tbody th { color: #5a2a36; font-weight: 600; white-space: nowrap; }
.week td { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.week tbody tr > td.is-locked { background: rgb(110 20 40 / 3.5%); }
.week thead th.is-locked { background: rgb(110 20 40 / 8%); }
.week thead th.is-today { box-shadow: inset 0 3px 0 var(--brand); color: var(--brand); }
.week thead th.is-today small { color: var(--brand); }
.week tbody tr > td.is-today { background: rgb(200 0 74 / 4%); }
.week tr.extras-row > * { border-bottom: 0; }
.extra-line + .extra-line { margin-top: 2px; }
.extra-line b { color: var(--brand); font-weight: 600; }
.cell-action { margin-top: 4px; }
.cell-toggle {
  min-height: 22px; padding: 0 var(--space-2); border-radius: 6px; font-size: 12px; cursor: pointer;
  border: 1px solid rgb(180 35 24 / 22%); background: rgb(255 255 255 / 70%); color: var(--danger); transition: background 0.15s, border-color 0.15s;
}
.cell-toggle:hover { background: var(--danger-soft); border-color: rgb(180 35 24 / 40%); }
.cell-toggle.restore { border-color: rgb(31 122 82 / 30%); color: var(--success); }
.cell-toggle.restore:hover { background: var(--success-soft); }
.cell-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
form.inline { display: inline; margin-left: var(--space-2); }

/* Campus, area and floor settings. */
.campus-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.campus-info h2 { margin-bottom: var(--space-1); font-size: 18px; }
.campus-info p { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: 13px; }
.lock-time { padding: 2px var(--space-3); border-radius: 999px; background: var(--brand-soft); color: #5a2a36; }
.lock-time b { color: var(--brand); font-variant-numeric: tabular-nums; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); align-items: start; }
.area-card { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2); }
.area-head { display: flex; align-items: center; gap: var(--space-2); padding: 0 0 var(--space-2) var(--space-1); border-bottom: 1px solid var(--divider); }
.area-head h2 { margin: 0; font-size: 17px; }
.area-head small { margin-right: auto; }
.floor-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.floor-row {
  display: flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-2) 0 var(--space-1);
  border: 1px solid transparent; border-radius: 10px; transition: background 0.15s, border-color 0.15s;
}
.floor-row:hover { background: var(--glass-fill); border-color: var(--glass-edge); }
.floor-name { flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.floor-row.inactive .floor-name { color: var(--muted); font-weight: 400; }
.bed-chip {
  min-width: 5.5em; padding: 2px var(--space-3); border-radius: 999px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums;
  background: var(--brand-soft); border: 1px solid rgb(200 0 74 / 14%); transition: background 0.15s, border-color 0.15s;
}
.bed-chip:hover { background: rgb(200 0 74 / 15%); border-color: rgb(200 0 74 / 30%); text-decoration: none; }
.bed-chip.empty { background: var(--warning-soft); border-color: rgb(236 150 20 / 30%); color: var(--warning); }
.bed-chip.empty:hover { background: rgb(236 150 20 / 24%); }
.row-edit { padding: 2px var(--space-2); border-radius: 8px; color: var(--muted); font-size: 13px; }
.row-edit:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.floor-empty { padding: var(--space-2); }
.add-floor { justify-self: start; padding: 4px var(--space-2); border-radius: 8px; font-size: 13px; color: var(--muted); }
.add-floor:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
/* A row needs about 330px, so columns are only added when each still gets that much:
   one column, then dishes, staples and add-ons beside the long single list, then three. */
.category-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "a" "b" "c"; }
.category-col:nth-child(1) { grid-area: a; }
.category-col:nth-child(2) { grid-area: b; }
.category-col:nth-child(3) { grid-area: c; }
@media (min-width: 1100px) {
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "a b" "c b"; grid-template-rows: auto 1fr; }
}
@media (min-width: 1440px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "a b c"; grid-template-rows: auto; }
}
.category-col { display: grid; gap: var(--space-4); align-content: start; }
.category-row { min-height: 36px; }
.category-row { gap: 6px; padding-right: var(--space-1); }
.category-row .row-edit { padding: 2px 6px; }
.category-row .floor-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-days { padding: 1px 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.category-row form { display: contents; }
.category-price { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meal-marks { display: flex; gap: 2px; }
.meal-marks i {
  width: 20px; height: 22px; display: grid; place-content: center; border-radius: 6px; font-style: normal; font-size: 12px;
  color: rgb(110 20 40 / 22%); background: rgb(110 20 40 / 3%);
}
.meal-marks i.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.category-row.inactive .meal-marks i.on { color: var(--muted); background: rgb(110 20 40 / 6%); }
.area-add {
  display: grid; place-content: center; justify-items: center; gap: var(--space-1); min-height: 120px; color: var(--muted);
  background: rgb(255 255 255 / 25%); border: 1.5px dashed rgb(200 0 74 / 22%); box-shadow: none; transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.area-add span { font-size: 22px; line-height: 1; }
.area-add:hover { color: var(--brand); background: rgb(255 255 255 / 55%); border-color: rgb(200 0 74 / 45%); text-decoration: none; }

/* Drag sorting. */
.drag-handle { cursor: grab; touch-action: none; user-select: none; color: var(--muted); padding: 0 var(--space-1); }
.drag-handle:hover { color: var(--brand); }
.drag-col { width: 2em; }
.dragging { opacity: 0.7; background: rgb(200 0 74 / 8%); }
.dragging .drag-handle { cursor: grabbing; }
.table tr.group-row th { background: rgb(110 20 40 / 4%); color: var(--muted); font-weight: 600; }

/* Floor guide: the campus is one building, highest level on top; each area on a level is a unit. */
@property --lit { syntax: "<number>"; inherits: true; initial-value: 0; }
.tower-defs { position: absolute; }
.tower-card { min-width: 0; }
.tower-scene {
  position: relative; overflow: hidden; padding: var(--space-3) var(--space-4) 0; border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(255 240 232 / 70%) 0%, rgb(255 255 255 / 0%) 70%);
}
.cloud { position: absolute; width: 120px; fill: rgb(255 255 255 / 85%); animation: cloud-drift 46s linear infinite; }
.cloud-a { top: 6px; left: -130px; }
.cloud-b { top: 60px; left: -130px; width: 84px; animation-duration: 64s; animation-delay: -30s; opacity: 0.7; }
.tower { position: relative; max-width: 600px; margin: 0 auto; }
.tower-body { position: relative; margin-right: 14px; }
.tower-body::after {
  content: ""; position: absolute; top: 28px; right: -14px; bottom: 0; width: 14px; transform: skewY(-40deg); transform-origin: left top;
  background: linear-gradient(180deg, #e7a3ac, #d98390); animation: tower-fade 0.6s ease both; animation-delay: calc(var(--n) * 90ms + 0.2s);
}
.tower-roof, .tower-ground { display: block; overflow: visible; }
.tower-roof { animation: roof-drop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1.2) both; animation-delay: calc(var(--n) * 90ms); }
.beacon { animation: beacon 2.4s ease-in-out infinite; }
/* Fit every level in one screen: share the viewport height left after the page chrome, within 40–60px per level. */
.level { display: flex; min-height: clamp(40px, calc((100dvh - 270px) / var(--n, 10)), 60px); animation: level-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 90ms); }
.level-no {
  flex: 0 0 64px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2)); border-top: 3px solid rgb(120 0 40 / 35%);
}
.unit {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2); color: var(--text);
  background: linear-gradient(180deg, #fffaf7, #fbe7e3); border-top: 3px solid rgb(200 0 74 / 16%); border-left: 3px solid rgb(120 50 60 / 12%);
  transition: transform 0.2s, box-shadow 0.2s;
}
.unit:hover, .unit:focus-visible {
  z-index: 1; text-decoration: none; outline: none; transform: scale(1.03);
  box-shadow: 0 0 0 2px var(--brand), 0 14px 30px -12px rgb(200 0 74 / 55%);
}
.windows {
  flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); justify-items: center;
  height: 24px; overflow: hidden; container-type: inline-size;
}
@container (width < 26px) { .win { display: none; } }
.win { width: 18px; height: 24px; --lit: 0; transition: --lit 0.3s ease; }
.win-lit { opacity: var(--lit); }
.win:nth-child(5n + 2) { animation: window-glow 6s ease-in-out infinite; animation-delay: calc(var(--i) * -1.3s + var(--w) * -0.7s); }
.unit:hover .win, .unit:focus-visible .win { animation: none; --lit: 1; transition: --lit 0.25s ease calc(var(--w) * 40ms); }
.unit-name, .unit-count {
  display: flex; align-items: center; gap: var(--space-2); padding: 2px var(--space-2); border-radius: 8px; line-height: 1.3; white-space: nowrap;
  background: rgb(255 255 255 / 88%); box-shadow: 0 2px 8px -4px rgb(110 20 40 / 35%);
}
.unit-name small { color: var(--muted); font-size: 12px; }
.unit-name .unit-unset { display: flex; align-items: center; gap: 4px; color: var(--warning); }
.unit-unset::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); animation: beacon 1.8s ease-in-out infinite; }
.unit-count { display: flex; align-items: center; gap: 2px; font-weight: 600; }
.unit-count i { font-style: normal; color: var(--brand); max-width: 0; opacity: 0; overflow: hidden; transition: max-width 0.2s, opacity 0.2s; }
.unit:hover .unit-count i, .unit:focus-visible .unit-count i { max-width: 1em; opacity: 1; }
/* Floor bed configuration. */
.bed-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-right: auto; }
.bed-stats .tag { padding: 2px var(--space-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.bed-add { display: grid; gap: var(--space-2); }
.bed-add h2 { font-size: 16px; margin-bottom: var(--space-1); }
.bed-add-row { display: grid; grid-template-columns: minmax(96px, 160px) minmax(0, 1fr) auto; gap: var(--space-3); align-items: end; }
.bed-add-row input { width: 100%; }
.room-grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.room-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); padding-bottom: var(--space-2); margin-bottom: var(--space-1); border-bottom: 1px solid var(--divider); }
.room-head h2 { margin: 0; font-size: 17px; font-variant-numeric: tabular-nums; }
.room-head .free { color: var(--warning); font-weight: 600; }
.bed-rows { list-style: none; margin: 0 calc(-1 * var(--space-2)); padding: 0; display: grid; gap: 2px; }
.bed-rows li { display: flex; align-items: center; gap: var(--space-3); min-height: 36px; padding: 0 var(--space-2); border-radius: 10px; transition: background 0.15s; }
.bed-rows li:hover { background: var(--glass-fill); }
.bed-rows .bed-no { flex: none; min-width: 4.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.bed-holders { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.bed-holders a { color: var(--text); font-weight: 600; }
.bed-holders a:hover { color: var(--brand); }
.bed-rows form { margin-left: auto; }
button.row-edit { border: 0; background: none; cursor: pointer; }
.row-edit.danger:hover { background: var(--danger-soft); color: var(--danger); }
.unit.inactive { background: repeating-linear-gradient(135deg, #f6f1f1 0 8px, #efe8e8 8px 16px); color: var(--muted); }
.unit.inactive .windows { filter: grayscale(1); opacity: 0.5; }
.tower-empty { padding: var(--space-4) 0; text-align: center; }
@keyframes level-rise { from { opacity: 0; transform: translateY(28px) scaleY(0.7); } }
@keyframes roof-drop { from { opacity: 0; transform: translateY(-24px); } }
@keyframes tower-fade { from { opacity: 0; } }
@keyframes beacon { 50% { opacity: 0.25; } }
@keyframes window-glow { 0%, 100% { --lit: 0; } 50% { --lit: 0.7; } }
@keyframes cloud-drift { to { transform: translateX(calc(100vw + 260px)); } }
.bed {
  border: 1px solid var(--glass-edge); border-radius: var(--radius); background: var(--glass-fill); box-shadow: var(--fill-shadow); color: var(--text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.bed:hover {
  background: rgb(255 255 255 / 92%); border-color: rgb(200 0 74 / 30%); text-decoration: none; transform: translateY(-1px);
  box-shadow: inset 0 1px 0 #fff, 0 10px 22px -12px rgb(200 0 74 / 45%);
}
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); align-items: start; }
.room-card h2 { margin-bottom: var(--space-2); }
.bed-list { display: grid; gap: var(--space-2); }
.bed { display: grid; gap: var(--space-1); padding: var(--space-2) var(--space-3); }
.bed-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bed-no { color: var(--brand); font-weight: 600; font-size: 13px; }
.bed.empty { border-style: dashed; background: transparent; box-shadow: none; }
.bed.empty .bed-no { color: var(--muted); }
.bed-meals { display: grid; gap: 2px; font-size: 13px; }
.bed-meals > div { display: grid; grid-template-columns: 1.5em minmax(0, 1fr); }
.bed-meals dt { color: var(--muted); }

/* Sheets. */
.sheet-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; width: fit-content; max-width: 100%; padding: var(--space-1); border-radius: 16px; }
.tabs a { padding: 6px var(--space-4); border-radius: 12px; color: var(--text); border: 1px solid transparent; transition: background 0.15s, box-shadow 0.15s; }
.tabs a:hover { background: rgb(255 255 255 / 60%); text-decoration: none; }
.tabs a.active { background: #fff; border-color: rgb(200 0 74 / 18%); color: var(--brand); font-weight: 600; box-shadow: 0 2px 10px -2px rgb(110 20 40 / 18%); }
.sheet { background: var(--glass-strong); border-radius: var(--radius-lg); padding: var(--space-4) 20px; display: grid; gap: var(--space-3); }
.sheet-title {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
  border-bottom: 2px solid var(--text); padding-bottom: var(--space-2);
}
.sheet-title h1 { font-size: 18px; }
.sheet-title p { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); font-size: 13px; }
.sheet-title p strong { font-size: 15px; }
.tag.danger { background: var(--danger-soft); border-color: rgb(180 35 24 / 25%); color: var(--danger); font-weight: 600; }
.sheet-block { display: grid; gap: var(--space-2); }
.floor-block { padding-top: var(--space-3); border-top: 1px solid var(--divider); }
.floor-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
.floor-head h2 { margin: 0; border-left: 4px solid var(--brand); border-image: linear-gradient(var(--brand), var(--accent)) 1; padding-left: var(--space-2); }
.meal-counts { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); color: var(--muted); font-size: 13px; }
.meal-counts b { color: var(--brand); font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 2px; }
.meal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); align-items: start; }
.meal-box { border: 1px solid rgb(200 0 74 / 16%); border-radius: var(--radius); background: rgb(255 255 255 / 70%); overflow: hidden; }
.meal-box-head {
  display: flex; align-items: baseline; gap: var(--space-1); padding: 6px var(--space-3); color: var(--muted);
  background: rgb(200 0 74 / 6%); border-bottom: 1px solid rgb(200 0 74 / 14%);
}
.meal-box-head span { margin-right: auto; color: #5a2a36; font-weight: 650; font-size: 15px; }
.meal-box-head strong { color: var(--brand); font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.meal-box .table td { padding: 3px var(--space-3); }
.meal-box .table tr:last-child td { border-bottom: 0; }
.meal-box > p { padding: 4px var(--space-3); }
.floor-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.combo-table tbody th { width: 4em; vertical-align: top; color: #5a2a36; background: rgb(200 0 74 / 3%); font-weight: 600; }
.combo-table tbody th { border-bottom-color: transparent; }
.combo-table tbody tr.meal-start:not(:first-child) > * { box-shadow: inset 0 1px 0 rgb(200 0 74 / 22%); }
.table.detail { table-layout: fixed; }
.table.detail th:nth-child(1) { width: 6%; }
.table.detail th:nth-child(2), .table.detail th:nth-child(3) { width: 9%; }
.table.detail th:nth-child(n+4):nth-child(-n+6) { width: 19%; }
.table.detail th:last-child { width: 19%; }
.table.detail tbody tr.room-start > td { box-shadow: inset 0 1px 0 rgb(120 50 60 / 22%); }
.table.detail .room, .table.detail .name { font-weight: 600; }
.table.detail tr.no-order > td { color: var(--muted); font-weight: 400; }
.table.detail tr.no-order > td.diet-note { color: var(--warning); }
.diet-note { color: var(--warning); }
.extra-label { color: var(--brand); }
/* On screen the floors of a detail sheet stack, so only the first one repeats the sheet title. */
@media screen { .sheet.page + .sheet.page .sheet-title { display: none; } }

/* Monthly settlement. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-3); }
.stat { display: grid; gap: var(--space-1); padding: var(--space-3) var(--space-4); }
.category-stats { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.category-stats .pill { padding: var(--space-1) var(--space-3); border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--glass-fill); box-shadow: var(--fill-shadow); }
.category-stats .pill strong { color: var(--brand); margin-left: var(--space-1); }
.monthly-table td { white-space: nowrap; }
.monthly-table thead th.num { white-space: normal; }
.monthly-table thead th[rowspan] { vertical-align: bottom; }
.monthly-table thead th.group { text-align: center; }
.monthly-table thead tr + tr th { border-radius: 0; }
.monthly-table.compact th, .monthly-table.compact td { padding: 5px 6px; }

/* Without backdrop blur or when the user asks for less transparency, glass becomes solid. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: rgb(255 255 255 / 95%); --glass-strong: #fff; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: rgb(255 255 255 / 96%); --glass-strong: #fff; --glass-fill: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media screen and (max-width: 760px) {
  :root { --blur: blur(16px) saturate(170%); }
  .app-shell { display: block; }
  .app-sidebar {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2);
    height: auto; margin: var(--space-2); padding: var(--space-2) var(--space-3); top: var(--space-2); border-radius: 16px;
  }
  .brand img { width: 32px; height: 32px; }
  .side-nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; }
  .campus-menu-panel { left: auto; min-width: 220px; }
  .campus-menu-panel button, .select-panel [role=option] { min-height: var(--touch-height); }
  .user-menu { margin-left: auto; border-top: 0; padding-top: 0; }
  .user-menu .user-name { display: none; }
  .user-menu summary > svg { transform: none; }
  .user-menu[open] summary > svg { transform: rotate(180deg); }
  .user-menu-panel { left: auto; min-width: 240px; bottom: auto; top: calc(100% + 6px); }
  .menu-item { min-height: var(--touch-height); }
  .main { padding: var(--space-3); }
  .card { padding: var(--space-3) var(--space-4); }
  .rule-grid, .meal-grid, .floor-body, .picker-group { grid-template-columns: 1fr; }
  .form-section { padding: var(--space-3) var(--space-4); }
  .extra-form > .notice { margin: var(--space-3) var(--space-4) 0; }
  .stepper button { width: 40px; height: 40px; }
  .button, input:not([type=checkbox]):not([type=radio]), select, .select-button { min-height: var(--touch-height); }
  input:not([type=checkbox]):not([type=radio]), select, .select-button { font-size: 16px; }
  .search-field { flex: 1 1 100%; min-height: var(--touch-height); }
  .area-grid { grid-template-columns: 1fr; }
  .category-grid .area-card { padding-inline: var(--space-2); }
  .bed-add-row { grid-template-columns: minmax(0, 1fr); }
  .bed-rows li { min-height: var(--touch-height); }
  .floor-row { min-height: var(--touch-height); }
  .search-field button { min-height: 36px; }
  .search-field input[type=search], .search-field input[type=search]:focus { flex: 1; width: auto; }
  .sheet { padding: var(--space-3); }
  .tower-scene { padding: var(--space-3) var(--space-2) 0; }
  .level { min-height: 40px; }
  .level-no { flex-basis: 44px; font-size: 14px; }
  .unit { gap: var(--space-1); padding: 0 var(--space-1); }
  .unit-name, .unit-count { padding: 2px 6px; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  :root { font-size: 12px; background: #fff; }
  body { background: #fff; }
  body::before { display: none; }
  .app-shell { display: block; }
  .no-print, .app-sidebar, .toasts, .notice { display: none !important; }
  .main { padding: 0; max-width: none; display: block; }
  .card, .day-card.stage-print, .day-card.stage-pending, .sheet, .tabs, .meal-line, .bed, .rule, .button, .button.primary {
    background: #fff; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-color: #ccc;
  }
  .meal-total strong, .stat strong { background: none; color: inherit; }
  .button, .button.primary { color: inherit; }
  .sheet { border: 0; padding: 0; border-radius: 0; display: block; }
  .sheet > * + * { margin-top: 10px; }
  .sheet.page + .sheet.page { break-before: page; }
  .floor-head, .meal-box-head { break-after: avoid; }
  .floor-head h2 { border-image: none; border-left-color: #000; }
  .meal-box { border-color: #555; border-radius: 0; background: #fff; }
  .meal-box-head { background: #eee; border-color: #555; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .meal-box-head strong, .meal-counts b, .extra-label, .addons { color: inherit; }
  .meal-box .table td { border: 0; border-top: 1px solid #555; }
  .floor-block { border-top: 0; padding-top: 0; }
  .table.detail tbody tr.room-start > td, .combo-table tbody tr.meal-start > * { box-shadow: none; }
  .combo-table tbody th { border-bottom-color: #555; }
  .combo-table tbody tr:not(.meal-start) > th { border-top-style: hidden; }
  .tag { border-color: #555; color: inherit; background: none; }
  .table { border-collapse: collapse; }
  .table th, .table td { border: 1px solid #555; padding: 3px 5px; }
  .table thead th { background: #eee; color: inherit; border-color: #555; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table thead { display: table-header-group; }
  .table tr { break-inside: avoid; }
  a { color: inherit; }
}
