:root {
  --ink: #152033;
  --muted: #5a6575;
  --subtle: #eef2f5;
  --surface: #ffffff;
  --surface-strong: #f7f9fb;
  --line: #d6dde6;
  --accent: #126176;
  --accent-dark: #0d4455;
  --good: #2f7d5a;
  --good-soft: #dff2e8;
  --warn: #a96505;
  --warn-soft: #fff1d7;
  --danger: #b42318;
  --danger-soft: #fde2df;
  --violet: #6550b8;
  --violet-soft: #ebe7ff;
  --blue-soft: #e0f0ff;
  --radius: 8px;
  --shadow: 0 16px 42px rgba(20, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--subtle);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent-dark);
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.app-brand img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--radius);
}

.app-brand strong,
.app-brand small {
  display: block;
  overflow-wrap: anywhere;
}

.app-brand strong {
  font-size: 1.12rem;
  line-height: 1.25;
}

.app-brand small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.header-actions,
.panel-actions,
.dialog-actions,
.surface-heading,
.surface-heading,
.list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-actions {
  display: none;
}

.icon-button,
.icon-text-button,
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.icon-button {
  width: 46px;
  padding: 0;
  background: var(--surface-strong);
  border-color: var(--line);
}

.icon-text-button,
.ghost-button {
  gap: 8px;
  padding: 10px 14px;
  color: var(--accent-dark);
  background: var(--surface);
  border-color: var(--line);
}

.primary-button {
  gap: 8px;
  padding: 12px 18px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(18, 97, 118, 0.18);
}

.primary-button:disabled,
.ghost-button:disabled {
  color: #7a8490;
  background: #e8edf2;
  border-color: #d3dbe4;
  box-shadow: none;
  cursor: not-allowed;
}

.primary-button.is-cancel {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.18);
}

.compact {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.92rem;
}

.icon-button:hover,
.icon-text-button:hover,
.primary-button:hover,
.ghost-button:hover,
.role-switch button:hover,
.icon-button:focus-visible,
.icon-text-button:focus-visible,
.primary-button:focus-visible,
.ghost-button:focus-visible,
.role-switch button:focus-visible {
  outline: 3px solid rgba(18, 97, 118, 0.22);
  outline-offset: 2px;
}

.app-main {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.control-band,
.today-strip,
.workflow-strip,
.role-panel,
.history-section {
  margin-top: 16px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(360px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.date-field,
.search-field,
.month-field,
.notes-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.date-input-row {
  position: relative;
  display: block;
  align-items: center;
}

.date-input-row strong {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c4ceda;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.date-input-row:focus-within strong {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 89, 103, 0.14);
}

.date-input-row input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.date-field input,
.search-field input,
.month-field input,
.notes-field textarea,
.handoff-list input,
.resident-row input,
.resident-row select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c4ceda;
  border-radius: var(--radius);
}

.date-field input {
  color-scheme: light;
}

.role-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
}

.role-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.role-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
}

.combined-roles [data-role="driver"] {
  display: none;
}

.combined-roles .role-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.is-vendor-view .workflow-strip,
.is-vendor-view [data-panel="vendor"],
.is-vendor-view .history-section {
  display: none !important;
}

.aggregate-mode .workflow-strip {
  display: none !important;
}

.aggregate-mode.is-facility-view .today-strip {
  display: none !important;
}

.is-monthly-view .today-strip,
.is-monthly-view .workflow-strip {
  display: none !important;
}

.is-monthly-view .date-field,
.is-monthly-view .storage-pill {
  display: none;
}

.is-monthly-view .control-band {
  grid-template-columns: 1fr;
}

.aggregate-mode .list-tools,
.aggregate-mode #addResidentButton {
  display: none !important;
}

.storage-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: nowrap;
}

.storage-pill span {
  width: 10px;
  height: 10px;
  background: var(--good);
  border-radius: 50%;
}

.storage-pill.is-dirty span {
  background: var(--warn);
}

.today-strip {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 12px;
}

.combined-roles .today-strip {
  grid-template-columns: 1fr;
}

.combined-roles .total-tile {
  display: none;
}

.total-tile,
.count-tile {
  min-height: 112px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(20, 32, 51, 0.06);
}

.total-tile {
  display: grid;
  align-content: center;
  color: #fff;
  background: var(--accent-dark);
  border-color: transparent;
}

.total-tile span,
.count-tile span {
  color: inherit;
  font-weight: 800;
}

.total-tile strong,
.count-tile strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 2.8rem;
  line-height: 1;
}

.total-tile small,
.count-tile small {
  font-size: 1rem;
}

.total-breakdown {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 800;
  line-height: 1.35;
}

.count-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.count-tile {
  min-width: 0;
}

.count-tile strong {
  font-size: 2.1rem;
  margin-top: 8px;
}

.count-group {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(20, 32, 51, 0.06);
}

.count-group h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.35;
}

.count-row-list {
  display: grid;
  gap: 8px;
}

.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.count-row span,
.count-row b,
.count-row em {
  min-width: 0;
}

.count-row span {
  display: grid;
  gap: 1px;
}

.count-row b {
  overflow-wrap: anywhere;
  font-size: 0.96rem;
  line-height: 1.25;
}

.count-row em {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-style: normal;
  font-weight: 900;
  font-size: 0.82rem;
  line-height: 1.2;
}

.count-row strong {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  gap: 3px;
  font-size: 1.8rem;
  line-height: 1;
}

.count-row small {
  font-size: 0.8rem;
}

.order-board {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.order-board.is-compact {
  grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1.55fr);
}

.order-hero {
  display: grid;
  align-content: center;
  min-height: 100%;
  padding: 18px;
  color: #fff;
  background: var(--accent-dark);
  border-radius: var(--radius);
}

.order-hero span {
  font-weight: 900;
}

.order-hero strong {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: clamp(3.2rem, 9vw, 5.8rem);
  line-height: 0.95;
}

.order-hero small {
  font-size: 1.05rem;
}

.order-hero em {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-style: normal;
  font-weight: 900;
}

.order-sections {
  display: grid;
  grid-template-columns: 1.28fr 1fr 0.82fr;
  gap: 12px;
  min-width: 0;
}

.order-section {
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(20, 32, 51, 0.06);
}

.order-section h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.order-lines {
  display: grid;
  gap: 8px;
}

.order-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.order-line span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.order-line b {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.25;
}

.order-line em {
  display: inline-flex;
  width: fit-content;
  padding: 2px 8px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-style: normal;
  font-weight: 900;
  font-size: 0.84rem;
  line-height: 1.2;
}

.order-line strong {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  gap: 4px;
  font-size: 2.25rem;
  line-height: 0.95;
}

.order-line small {
  font-size: 0.82rem;
}

.order-section:last-child .order-line {
  background: var(--danger-soft);
}

.tile-normal {
  background: var(--blue-soft);
}

.tile-soft {
  background: var(--warn-soft);
}

.tile-porridge {
  background: var(--good-soft);
}

.tile-chopped {
  background: var(--violet-soft);
}

.tile-mixer {
  background: var(--danger-soft);
}

.workflow-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.workflow-list li {
  min-height: 88px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.workflow-list li.is-done {
  border-color: rgba(47, 125, 90, 0.45);
  background: #f2fbf6;
}

.workflow-list strong,
.workflow-list span {
  display: block;
}

.workflow-list strong {
  font-size: 1rem;
}

.workflow-list span {
  color: var(--muted);
  font-size: 0.88rem;
}

.role-panel {
  display: none;
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.role-panel.is-active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-heading h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  line-height: 1.25;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-weight: 900;
  font-size: 0.82rem;
}

.facility-layout,
.vendor-layout,
.driver-layout {
  display: grid;
  gap: 20px;
  align-items: start;
}

.facility-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
}

.aggregate-mode .facility-layout {
  grid-template-columns: minmax(0, 1fr);
}

.vendor-layout,
.driver-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.combined-roles .vendor-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
}

.work-surface {
  min-width: 0;
}

.surface-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.surface-heading h2,
.work-surface h2,
.work-surface h3,
.history-section h2 {
  margin: 0;
  line-height: 1.35;
}

.work-surface h2,
.history-section h2 {
  font-size: 1.35rem;
}

.work-surface h3 {
  margin-top: 22px;
  font-size: 1.04rem;
}

.list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 12px;
}

.facility-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facility-mode-tabs button {
  min-height: 48px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.facility-mode-tabs button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent-dark);
}

.day-summary-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--blue-soft);
  border: 1px solid #bfd9ef;
  border-radius: var(--radius);
}

.day-summary-banner strong,
.day-summary-banner span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
}

.day-summary-banner span {
  padding: 4px 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 900;
}

.day-summary-banner span.is-good {
  color: var(--accent-dark);
  background: var(--good-soft);
  border-color: rgba(47, 125, 90, 0.45);
}

.day-summary-banner span.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e9a19b;
}

.toggle-field,
.confirm-check,
.check-row,
.meal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  cursor: pointer;
  font-weight: 800;
}

.toggle-field input,
.confirm-check input,
.check-row input,
.meal-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.resident-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.resident-list.is-table-list {
  gap: 10px;
  overflow: visible;
  padding: 8px;
  background: var(--surface);
}

.resident-list.is-order-input-list {
  display: block;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.resident-list.is-simple-order-list {
  gap: 10px;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
}

.simple-order-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.simple-order-section h3 {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.25;
}

.simple-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.add-option-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.additional-settings {
  padding: 8px;
  background: var(--blue-soft);
  border: 1px solid #bfd9ef;
  border-radius: var(--radius);
}

.option-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
}

.option-switch input {
  width: 28px;
  height: 28px;
  margin: 0;
  accent-color: var(--accent);
}

.simple-product-list {
  display: grid;
  gap: 6px;
}

.simple-product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, auto);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.simple-product-row > span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.simple-product-row b {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.2;
}

.simple-product-row em {
  display: inline-flex;
  padding: 1px 6px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.simple-product-row .count-stepper {
  grid-template-columns: 32px 1fr;
  grid-template-rows: 31px 31px;
  width: 88px;
  justify-self: end;
}

.simple-product-row .count-stepper output {
  justify-content: flex-end;
  font-size: 2rem;
}

.facility-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facility-summary-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 900;
  line-height: 1.25;
}

.facility-summary-strip span.is-good {
  color: var(--accent-dark);
  background: var(--good-soft);
  border-color: rgba(47, 125, 90, 0.45);
}

.facility-summary-strip span.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e9a19b;
}

.weekday-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.weekday-selector button {
  min-height: 44px;
  color: var(--accent-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.weekday-selector button[aria-pressed="true"] {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.table-guidance {
  margin: 0;
  padding: 9px 10px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
  line-height: 1.45;
}

.table-guidance.is-warning {
  color: #744600;
  background: var(--warn-soft);
  border-color: #e4bd73;
}

.weekly-register-panel {
  display: grid;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekly-register-panel.has-pending {
  border-color: #e4bd73;
  background: #fffaf0;
}

.weekly-register-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.weekly-register-buttons {
  display: grid;
  gap: 8px;
}

.weekly-register-status {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.weekly-register-status strong {
  color: var(--accent-dark);
  font-size: 1.08rem;
  line-height: 1.25;
}

.weekly-register-panel.has-pending .weekly-register-status strong {
  color: var(--warn);
}

.weekly-register-status span {
  color: var(--muted);
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.weekly-history-block {
  display: grid;
  gap: 6px;
}

.weekly-history-block h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.weekly-history-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.weekly-history-list li {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekly-history-list time,
.weekly-history-list b,
.weekly-history-list em {
  line-height: 1.3;
}

.weekly-history-list time {
  color: var(--muted);
  font-weight: 900;
}

.weekly-history-list span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.weekly-history-list b {
  overflow-wrap: anywhere;
}

.weekly-history-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.reset-count-button {
  color: var(--danger);
  border-color: #e9a19b;
}

.reflect-dialog-message {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.45;
}

.reflect-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meal-count-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.meal-count-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--surface);
}

.meal-count-table th,
.meal-count-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.meal-count-table thead th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.86rem;
  font-weight: 900;
}

.meal-count-table th:first-child,
.meal-count-table td:first-child {
  width: 54px;
}

.meal-count-table th:last-child,
.meal-count-table td:last-child {
  width: 88px;
}

.meal-count-table tbody tr:last-child td {
  border-bottom: 0;
}

.order-input-table-wrap {
  border-radius: 0;
}

.order-input-table {
  min-width: 342px;
}

.order-input-table + .order-input-table {
  border-top: 1px solid var(--line);
}

.order-confirmed-notice {
  margin: 0 0 8px;
  padding: 12px 10px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #e9a19b;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.order-input-table th,
.order-input-table td {
  border-right: 1px solid rgba(105, 119, 135, 0.18);
}

.order-input-table th:last-child,
.order-input-table td:last-child {
  border-right: 0;
}

.order-input-table th:first-child,
.order-input-table td:first-child,
.order-input-table .meal-count-name {
  width: auto;
}

.order-input-table th:nth-child(2),
.order-input-table td:nth-child(2) {
  width: 108px;
}

.order-input-table th:last-child,
.order-input-table td:last-child {
  width: 52px;
  text-align: center;
}

.order-input-table--rice {
  min-width: 280px;
}

.order-input-table--rice th:last-child,
.order-input-table--rice td:last-child {
  width: 108px;
  text-align: left;
}

.order-input-table--rice .count-stepper {
  margin-right: auto;
  margin-left: 0;
}

.order-input-table--rice .count-stepper output {
  justify-content: center;
}

.order-input-table .meal-count-name span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.order-input-table .meal-count-name em {
  margin-top: 3px;
}

.order-input-table .meal-count-number {
  padding: 6px;
}

.order-input-table .count-stepper {
  grid-template-columns: 30px minmax(34px, 1fr);
  grid-template-rows: 30px 30px;
  width: 92px;
  margin-left: auto;
}

.order-input-table .count-stepper button {
  min-width: 30px;
  min-height: 30px;
}

.order-input-table .count-stepper button:disabled,
.order-input-table .add-option-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.order-input-table .count-stepper output {
  justify-content: flex-end;
  font-size: 1.85rem;
}

.order-input-table .add-option-button {
  width: 38px;
  height: 38px;
  margin: 0 auto;
}

.order-input-table .add-option-button[aria-expanded="true"] {
  background: var(--ink);
}

.order-input-table tr.tile-normal > th,
.order-input-table tr.tile-normal > td {
  background-color: #e4f2ff;
}

.order-input-table tr.tile-soft > th,
.order-input-table tr.tile-soft > td {
  background-color: #fff2d6;
}

.order-input-table tr.tile-chopped > th,
.order-input-table tr.tile-chopped > td {
  background-color: #eee8ff;
}

.order-input-table tr.tile-porridge > th,
.order-input-table tr.tile-porridge > td {
  background-color: #e2f3e8;
}

.order-input-table tr.tile-mixer > th,
.order-input-table tr.tile-mixer > td,
.order-input-table .salt-extra-row > th,
.order-input-table .salt-extra-row > td {
  background-color: #fde5df;
}

.salt-extra-row .meal-count-name b {
  color: var(--danger);
}

.salt-extra-row .meal-count-name span {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 3px;
  padding: 1px 6px;
  color: #744600;
  background: var(--warn-soft);
  border: 1px solid #e4bd73;
  font-size: 0.72rem;
  font-weight: 900;
}

.monthly-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.monthly-total-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.monthly-total-line span,
.monthly-metrics span {
  color: var(--muted);
  font-weight: 900;
}

.monthly-total-line strong {
  font-size: 2rem;
  line-height: 1;
}

.monthly-breakdown {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.35;
}

.monthly-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  border: 1px solid var(--line);
  border-right: 0;
}

.monthly-metrics div {
  display: grid;
  gap: 2px;
  min-height: 66px;
  padding: 8px;
  background: var(--surface-strong);
  border-right: 1px solid var(--line);
}

.monthly-metrics strong {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 1.45rem;
  line-height: 1.1;
}

.monthly-metrics small {
  font-size: 0.78rem;
}

.monthly-summary p {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.monthly-table-wrap {
  border-radius: 0;
}

.monthly-table {
  min-width: 0;
}

.monthly-table th,
.monthly-table td {
  padding: 8px;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
  width: 72px;
}

.monthly-table th:nth-child(2),
.monthly-table td:nth-child(2) {
  width: 50px;
  text-align: right;
}

.monthly-table th:nth-child(3),
.monthly-table td:nth-child(3) {
  width: 74px;
  text-align: left;
}

.monthly-table th:last-child,
.monthly-table td:last-child {
  width: auto;
  padding-left: 10px;
  text-align: left;
}

.monthly-table tbody th b,
.monthly-table tbody th span,
.monthly-table tbody td span {
  display: block;
}

.monthly-table tbody th b {
  font-size: 1rem;
}

.monthly-table tbody th span,
.monthly-table tbody td span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.monthly-table tbody td {
  font-size: 1.08rem;
  font-weight: 900;
}

.monthly-table tbody td strong {
  display: block;
  font-size: 1.12rem;
}

.monthly-empty {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.table-section-row th {
  padding: 7px 10px;
  color: #fff;
  background: var(--ink);
  border-bottom: 0;
  font-size: 0.92rem;
}

.meal-count-table .section-total-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.meal-count-table .section-total-head b {
  font-size: 0.98rem;
}

.meal-count-table .section-total-head strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  color: var(--ink);
  background: #fff;
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1.1;
}

.meal-count-table .section-total-head em {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #e9a19b;
  border-radius: 999px;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.1;
}

.order-input-table .order-section-total-row.is-unbalanced .section-total-head strong,
.vendor-order-table .vendor-section-row.is-unbalanced .section-total-head strong {
  color: var(--danger);
}

.meal-count-category {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.meal-count-name {
  min-width: 0;
}

.meal-count-name b,
.meal-count-name em {
  display: inline-flex;
  align-items: center;
}

.meal-count-name b {
  margin-right: 5px;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
  line-height: 1.25;
}

.meal-count-name em {
  padding: 1px 6px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.meal-count-number {
  text-align: right;
}

.count-stepper {
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: 31px 31px;
  gap: 3px;
  align-items: stretch;
}

.count-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 31px;
  padding: 0;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
}

.count-stepper button:last-child {
  background: var(--muted);
}

.count-stepper output {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-items: center;
  justify-content: flex-end;
  min-width: 34px;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.matrix-table--today {
  min-width: 344px;
}

.matrix-table--weekly {
  min-width: 620px;
}

.matrix-table th:first-child,
.matrix-table td:first-child,
.matrix-table .matrix-item-head,
.matrix-table .meal-count-name {
  width: 132px;
}

.matrix-table thead th {
  padding: 10px 8px;
  color: #fff;
  background: #202020;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
  font-size: 0.95rem;
}

.matrix-table thead .matrix-item-head {
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.matrix-table thead th.is-active-column {
  background: #147fc9;
}

.matrix-table .meal-count-name {
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 8px 9px;
  background: #f2f3f5;
  border-right: 1px solid var(--line);
}

.matrix-table .meal-count-name span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
}

.matrix-table .matrix-count-cell {
  padding: 6px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.matrix-table .matrix-count-cell.is-active-column {
  background: #dff0ff;
}

.matrix-table tr.tile-normal .matrix-count-cell,
.matrix-table tr.tile-normal .meal-count-name {
  background-color: #e4f2ff;
}

.matrix-table tr.tile-soft .matrix-count-cell,
.matrix-table tr.tile-soft .meal-count-name {
  background-color: #fff2d6;
}

.matrix-table tr.tile-chopped .matrix-count-cell,
.matrix-table tr.tile-chopped .meal-count-name {
  background-color: #eee8ff;
}

.matrix-table tr.tile-porridge .matrix-count-cell,
.matrix-table tr.tile-porridge .meal-count-name {
  background-color: #e2f3e8;
}

.matrix-table tr.tile-mixer .matrix-count-cell,
.matrix-table tr.tile-mixer .meal-count-name {
  background-color: #fde5df;
}

.matrix-table tr .matrix-count-cell.is-active-column {
  background-color: #dbeeff;
}

.matrix-table .matrix-count-cell > output {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.9;
  text-align: center;
}

.matrix-table .count-stepper {
  grid-template-columns: 28px minmax(28px, 1fr);
  grid-template-rows: 28px 28px;
  max-width: 76px;
  margin: 0 auto;
}

.matrix-table .count-stepper button {
  min-width: 28px;
  min-height: 28px;
  border-radius: 6px;
}

.matrix-table .count-stepper output {
  justify-content: center;
  font-size: 1.75rem;
}

.resident-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(0, 1.55fr);
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.resident-row:last-child {
  border-bottom: 0;
}

.resident-row.is-paused {
  background: #f2f4f6;
}

.resident-row.is-changed {
  border-left: 6px solid var(--warn);
}

.resident-id {
  display: grid;
  gap: 8px;
  align-content: start;
}

.resident-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.resident-name-line strong {
  font-size: 1.16rem;
  line-height: 1.35;
}

.room-badge,
.status-badge,
.diet-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.86rem;
  line-height: 1.2;
}

.room-badge {
  color: var(--accent-dark);
  background: var(--blue-soft);
}

.status-badge {
  color: var(--danger);
  background: var(--danger-soft);
}

.diet-badge {
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.change-message,
.usual-message {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.change-message {
  color: #744600;
  font-weight: 800;
}

.resident-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.resident-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-weight: 800;
  min-width: 0;
}

.resident-controls .note-control {
  grid-column: span 2;
}

.daily-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  gap: 10px;
  align-items: stretch;
}

.meal-display {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meal-display span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.meal-display small {
  color: var(--muted);
  font-weight: 900;
  line-height: 1.2;
}

.meal-display b {
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.meal-display em {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}

.absence-button {
  min-height: 100%;
  padding: 12px;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.absence-button.is-absent {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e9a19b;
}

.weekday-checks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.weekday-checks label {
  display: grid;
  place-items: center;
  min-height: 42px;
  color: var(--accent-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.weekday-checks input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-checks label:has(input:checked) {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c4ceda;
  border-radius: var(--radius);
  font-weight: 900;
}

.inline-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.difference-list,
.note-list,
.checklist,
.vendor-counts,
.delivery-cards {
  display: grid;
  gap: 10px;
}

.diff-item,
.note-item,
.check-row,
.vendor-count-row,
.delivery-card {
  padding: 13px 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.diff-item.is-warning {
  background: var(--warn-soft);
  border-color: #e4bd73;
}

.diff-item.is-good {
  background: var(--good-soft);
  border-color: rgba(47, 125, 90, 0.45);
}

.diff-item.is-danger {
  background: var(--danger-soft);
  border-color: #e9a19b;
}

.diff-item strong,
.note-item strong {
  display: block;
}

.notes-field {
  margin-top: 18px;
}

.facility-bottom-notes {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facility-bottom-notes > span {
  font-weight: 900;
}

.facility-bottom-notes textarea:disabled {
  color: var(--muted);
  background: #eef2f6;
  cursor: not-allowed;
}

.notes-field textarea {
  resize: vertical;
}

.vendor-table-board {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.vendor-table-status {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 12px;
  color: #fff;
  background: var(--accent-dark);
  border-radius: var(--radius);
}

.vendor-table-status span,
.vendor-table-status em {
  font-weight: 900;
}

.vendor-table-status strong {
  display: inline-flex;
  grid-row: 1 / span 2;
  grid-column: 2;
  align-items: baseline;
  gap: 4px;
  font-size: 2.6rem;
  line-height: 0.95;
}

.vendor-table-status small,
.vendor-table-status em {
  font-size: 0.86rem;
}

.vendor-table-status em {
  color: rgba(255, 255, 255, 0.88);
  font-style: normal;
}

.vendor-order-table-wrap {
  border-radius: 0;
}

.vendor-order-table {
  min-width: 342px;
}

.vendor-order-table th,
.vendor-order-table td {
  border-right: 1px solid rgba(105, 119, 135, 0.18);
}

.vendor-order-table th:last-child,
.vendor-order-table td:last-child {
  border-right: 0;
}

.vendor-order-table th:first-child,
.vendor-order-table td:first-child {
  width: 42%;
}

.vendor-order-table th:nth-child(2),
.vendor-order-table td:nth-child(2) {
  width: 26%;
}

.vendor-order-table th:nth-child(3),
.vendor-order-table td:nth-child(3) {
  width: 17%;
  text-align: right;
}

.vendor-order-table th:nth-child(4),
.vendor-order-table td:nth-child(4) {
  width: 15%;
  text-align: center;
}

.vendor-order-table tbody th {
  font-size: 0.96rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.vendor-row-detail {
  display: inline-flex;
  padding: 2px 7px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}

.vendor-row-count {
  white-space: nowrap;
}

.vendor-row-count strong {
  font-size: 1.9rem;
  line-height: 1;
}

.vendor-row-count small {
  margin-left: 2px;
  font-weight: 900;
}

.vendor-row-check input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}

.vendor-complete-bar {
  display: grid;
  gap: 8px;
}

.vendor-complete-actions {
  display: grid;
  gap: 8px;
}

.vendor-complete-bar p {
  margin: 0;
  padding: 10px 12px;
  color: var(--good);
  background: var(--good-soft);
  border: 1px solid rgba(47, 125, 90, 0.35);
  border-radius: var(--radius);
  font-weight: 900;
  text-align: center;
}

.vendor-complete-bar .primary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.vendor-cancel-button {
  color: var(--danger);
  border-color: #e9a19b;
}

.vendor-note-row th,
.vendor-note-row td,
.vendor-empty-row td {
  background: #fff;
}

.vendor-note-row td {
  text-align: left !important;
}

.vendor-note-row span {
  display: block;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.45;
  white-space: pre-wrap;
}

.vendor-empty-row td {
  color: var(--muted);
  font-weight: 900;
  text-align: center !important;
}

.vendor-count-row,
.delivery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.vendor-count-row strong,
.delivery-card strong {
  font-size: 1.1rem;
}

.vendor-count-row output,
.delivery-card output {
  font-weight: 900;
  font-size: 2rem;
  line-height: 1;
}

.delivery-card {
  min-height: 84px;
}

.vendor-counts .count-group,
.delivery-cards .count-group {
  box-shadow: none;
}

.vendor-lock {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  min-height: 170px;
  align-content: center;
  padding: 20px;
  color: var(--ink);
  background: var(--warn-soft);
  border: 2px solid #e4bd73;
  border-radius: var(--radius);
}

.vendor-lock strong {
  font-size: clamp(1.45rem, 6vw, 2.2rem);
  line-height: 1.15;
}

.vendor-lock span,
.vendor-lock em {
  font-style: normal;
  font-weight: 900;
}

.vendor-lock em {
  color: var(--danger);
}

.combined-delivery-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.handoff-list {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.handoff-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.handoff-list div:last-child {
  border-bottom: 0;
}

.handoff-list dt {
  color: var(--muted);
  font-weight: 900;
}

.handoff-list dd {
  margin: 0;
}

.history-section {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-log {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.history-log li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.history-log time {
  color: var(--muted);
  font-weight: 800;
}

.app-dialog {
  width: min(720px, calc(100% - 24px));
  max-height: min(86vh, 780px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(21, 32, 51, 0.54);
}

.app-dialog form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.prompt-dialog {
  width: min(420px, calc(100% - 28px));
}

.prompt-dialog-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.prompt-dialog-message {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.45;
}

.prompt-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.prompt-dialog-actions .primary-button:only-child {
  grid-column: 1 / -1;
}

.prompt-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(21, 32, 51, 0.54);
}

.prompt-dialog-panel {
  width: min(420px, 100%);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.confirm-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.confirm-summary div {
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.confirm-summary strong {
  display: block;
  font-size: 1.4rem;
}

.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 1040px) {
  .control-band {
    grid-template-columns: 1fr;
  }

  .storage-pill {
    width: fit-content;
  }

  .facility-layout,
  .vendor-layout,
  .driver-layout {
    grid-template-columns: 1fr;
  }

  .count-tiles {
    grid-template-columns: 1fr;
  }

  .order-board.is-compact,
  .order-sections,
  .combined-roles .vendor-layout {
    grid-template-columns: 1fr;
  }

  .order-hero {
    min-height: 148px;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
    line-height: 1.45;
  }

  .app-header {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 58px;
    padding: 8px 10px;
  }

  .header-actions {
    display: none;
  }

  .header-actions .icon-button {
    display: none;
  }

  .app-brand {
    gap: 8px;
  }

  .app-brand img {
    width: 36px;
    height: 36px;
  }

  .app-brand strong {
    font-size: 1rem;
  }

  .app-brand small {
    font-size: 0.74rem;
    line-height: 1.25;
  }

  .icon-text-button,
  .primary-button,
  .ghost-button {
    width: 100%;
    white-space: normal;
  }

  .app-main {
    width: min(100% - 10px, 1280px);
    padding: 8px 0 16px;
  }

  .control-band,
  .today-strip,
  .workflow-strip,
  .role-panel,
  .history-section {
    margin-top: 8px;
  }

  .control-band {
    gap: 6px;
  }

  .date-field {
    gap: 3px;
  }

  .date-field input,
  .search-field input,
  .month-field input,
  .notes-field textarea,
  .handoff-list input,
  .resident-row input,
  .resident-row select {
    min-height: 40px;
    padding: 8px 10px;
  }

  .date-input-row strong {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 1rem;
  }

  .date-input-row input {
    min-height: 0;
    padding: 0;
  }

  .storage-pill {
    display: none;
  }

  .role-switch {
    position: sticky;
    top: 0;
    z-index: 8;
    gap: 5px;
    padding: 4px;
  }

  .role-switch button {
    min-height: 42px;
    gap: 5px;
    font-size: 0.9rem;
  }

  .today-strip {
    grid-template-columns: 1fr;
  }

  .count-tiles {
    grid-template-columns: 1fr;
  }

  .order-board.is-compact,
  .order-sections,
  .combined-delivery-actions {
    grid-template-columns: 1fr;
  }

  .order-hero {
    min-height: auto;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 10px 12px;
  }

  .order-hero span {
    grid-column: 1;
  }

  .order-hero strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 3.25rem;
  }

  .order-hero em {
    grid-column: 1;
    margin-top: 2px;
    font-size: 0.82rem;
  }

  .order-board {
    gap: 7px;
  }

  .order-sections {
    gap: 7px;
  }

  .order-section {
    padding: 8px;
  }

  .order-section h2 {
    margin-bottom: 6px;
    font-size: 0.95rem;
  }

  .order-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .order-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 40px;
    padding: 6px 7px;
    gap: 6px;
  }

  .order-line strong {
    font-size: 1.48rem;
    align-self: center;
  }

  .order-line span {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 5px;
  }

  .order-line b {
    font-size: 0.9rem;
    line-height: 1.12;
  }

  .order-line em {
    padding: 1px 5px;
    font-size: 0.72rem;
  }

  .monthly-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-list {
    grid-template-columns: 1fr 1fr;
  }

  .panel-heading {
    display: grid;
  }

  .panel-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .list-tools {
    grid-template-columns: 1fr;
  }

  .resident-row {
    grid-template-columns: 1fr;
  }

  .resident-controls {
    grid-template-columns: 1fr 1fr;
  }

  .daily-controls,
  .meal-display {
    grid-template-columns: 1fr;
  }

  .absence-button {
    min-height: 56px;
  }

  .resident-controls .note-control {
    grid-column: 1 / -1;
  }

  .weekly-register-action,
  .weekly-history-list li {
    grid-template-columns: 1fr;
  }

  .history-log li,
  .handoff-list div {
    grid-template-columns: 1fr;
  }

  .confirm-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .app-brand img {
    width: 34px;
    height: 34px;
  }

  .count-tiles {
    grid-template-columns: 1fr;
  }

  .order-section {
    padding: 7px;
  }

  .order-line {
    min-height: 38px;
    padding: 5px 6px;
  }

  .workflow-list {
    grid-template-columns: 1fr;
  }

  .resident-controls {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .control-band,
  .panel-actions,
  .list-tools,
  .history-section,
  .app-dialog {
    display: none !important;
  }

  .app-main {
    width: 100%;
    padding: 0;
  }

  .role-panel {
    display: block;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .role-panel:not([data-panel="vendor"]) {
    display: none;
  }

  .today-strip,
  .workflow-strip {
    margin: 0 0 12px;
  }
}
