:root {
  --bg: #f4f8f6;
  --surface: #ffffff;
  --surface-soft: #edf5f1;
  --text: #17231e;
  --muted: #5b6b63;
  --border: #cfdcd5;
  --primary: #156b4f;
  --primary-dark: #0d4c38;
  --success: #177245;
  --success-soft: #e2f4e9;
  --warning: #8a5b00;
  --warning-soft: #fff2cc;
  --danger: #a62c2c;
  --danger-dark: #7d1e1e;
  --danger-soft: #fde7e7;
  --info: #155f8a;
  --info-soft: #e3f2fb;
  --purple: #6a3d86;
  --purple-soft: #f0e8f5;
  --shadow: 0 8px 30px rgb(18 55 41 / 9%);
  --radius: 18px;
  --tap: 52px;
  --safe-top: env(safe-area-inset-top, 0px);
  --header-height: calc(72px + var(--safe-top));
  --header-height-compact: calc(64px + var(--safe-top));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 16px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary-dark); text-underline-offset: 3px; }

:focus-visible {
  outline: 4px solid #f5b63f;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 12px 18px;
  transform: translateY(-150%);
  border-radius: 10px;
  background: var(--text);
  color: #fff;
}
.skip-link:focus { transform: translateY(0); }

.app-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: var(--header-height);
  padding: calc(10px + var(--safe-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.brand { display: flex; min-width: 0; flex: 0 1 auto; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand__mark, .login-brand {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  letter-spacing: .04em;
}
.brand__copy { min-width: 0; }
.brand strong, .brand small { display: block; }
.brand strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { color: var(--muted); }
.primary-nav {
  position: sticky;
  z-index: 39;
  top: var(--header-height);
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 18px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.primary-nav__item {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 12px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 850;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.primary-nav__item svg, .icon-link svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.primary-nav__item[aria-current="page"] { background: var(--surface-soft); color: var(--primary-dark); }
.header-status { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.status-pill { padding: 6px 10px; border-radius: 999px; font-size: .72rem; font-weight: 900; }
.status-pill--ok { background: var(--success-soft); color: var(--success); }
.status-pill--neutral { background: #edf0ee; color: var(--muted); }
.icon-link { position: relative; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; background: var(--surface-soft); text-decoration: none; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; padding: 2px 5px; border: 2px solid #fff; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; text-align: center; }

.page-shell { width: min(1180px, 100%); margin: 0 auto; padding: 26px 18px 48px; }
.page-shell--centered { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding-bottom: 30px; }
.narrow-page { width: min(720px, 100%); margin-inline: auto; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-heading > :first-child { min-width: 0; }
.page-heading h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.1; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: .8rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.lead { color: var(--muted); font-size: 1.08rem; }
.help-text { color: var(--muted); font-size: .9rem; }

.button {
  display: inline-flex;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: 14px;
  font-weight: 900;
  letter-spacing: .01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.button:active { transform: translateY(1px) scale(.99); }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button--primary { background: var(--primary); color: #fff; }
.button--primary:hover { background: var(--primary-dark); }
.button--success { background: var(--success); color: #fff; box-shadow: 0 10px 24px rgb(23 114 69 / 24%); }
.button--danger { background: var(--danger); color: #fff; }
.button--danger:hover { background: var(--danger-dark); }
.button--outline { border-color: var(--border); background: var(--surface); color: var(--text); }
.button--xl { min-height: 60px; padding-inline: 28px; font-size: 1.05rem; }
.button--xxl { width: min(520px, 100%); min-height: 78px; font-size: clamp(1.25rem, 5vw, 1.65rem); }

.login-card, .offline-card {
  width: min(460px, 100%);
  padding: clamp(24px, 6vw, 44px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-brand { width: 66px; height: 66px; margin: 0 auto 20px; font-size: 1.3rem; }
.login-card h1 { margin-bottom: 6px; }
.stack-form { display: grid; gap: 9px; margin-top: 26px; text-align: left; }
.stack-form label { margin-top: 8px; font-weight: 800; }
.stack-form input, .stack-form select, .stack-form textarea,
.field-control {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus { border-color: var(--primary); }
.password-field { position: relative; }
.password-field input { padding-right: 82px; }
.password-toggle { position: absolute; top: 5px; right: 5px; min-height: 44px; border: 0; border-radius: 9px; background: var(--surface-soft); font-weight: 800; cursor: pointer; }

.message-stack { position: fixed; z-index: 80; top: calc(80px + var(--safe-top)); right: 16px; display: grid; width: min(440px, calc(100% - 32px)); gap: 8px; }
.message { padding: 14px 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; }
.message--success { border-color: #93caaa; background: var(--success-soft); color: #0d5632; }
.message--warning { border-color: #ebc66d; background: var(--warning-soft); color: #6a4500; }
.message--error { border-color: #e5a2a2; background: var(--danger-soft); color: var(--danger-dark); }
.realtime-notification { display: grid; gap: 7px; }
.realtime-notification .button { justify-self: start; }

.network-banner { position: fixed; z-index: 100; top: 0; left: 0; right: 0; display: flex; min-height: calc(58px + var(--safe-top)); align-items: center; justify-content: center; gap: 10px; padding: calc(8px + var(--safe-top)) 16px 8px; text-align: center; }
.network-banner--offline { background: var(--danger); color: #fff; }
.critical-alert { position: fixed; z-index: 90; top: calc(80px + var(--safe-top)); left: 50%; display: grid; width: min(680px, calc(100% - 24px)); gap: 6px; padding: 18px; transform: translateX(-50%); border: 3px solid #6b1010; border-radius: 16px; background: var(--danger-soft); box-shadow: 0 18px 50px rgb(80 5 5 / 25%); color: var(--danger-dark); }

.dominant-action { padding: clamp(24px, 6vw, 48px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.dominant-action p { font-size: 1.1rem; }
.health-warning { margin-bottom: 24px; padding: 22px; border: 3px solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); text-align: center; }
.health-warning h2 { margin-top: 0; color: var(--danger-dark); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-heading h2 { margin: 0; font-size: 1.25rem; }

.metric-grid, .summary-grid, .action-grid { display: grid; gap: 14px; }
.metric-grid--four { grid-template-columns: repeat(4, 1fr); }
.metric-card { display: grid; min-height: 108px; place-items: center; padding: 12px; border: 2px solid transparent; border-radius: 16px; background: var(--surface); color: var(--text); text-align: center; text-decoration: none; box-shadow: var(--shadow); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.metric-card strong { font-size: 2rem; line-height: 1; }
.metric-card span { font-size: .77rem; font-weight: 900; }
.metric-card--new { border-color: #8ac3a6; background: var(--success-soft); }
.metric-card--progress { border-color: #88bedb; background: var(--info-soft); }
.metric-card--waiting { border-color: #c6a5da; background: var(--purple-soft); }
.metric-card--returned { border-color: #e2a2a2; background: var(--danger-soft); }

.summary-grid { grid-template-columns: repeat(4, 1fr); }
.summary-card { display: flex; min-height: 130px; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.summary-card span { color: var(--muted); font-weight: 800; }
.summary-card strong { font-size: 2.5rem; }
.summary-card--important { border-color: #d5b264; background: var(--warning-soft); }
.summary-card--danger { border-color: #df9696; background: var(--danger-soft); }

.action-grid { grid-template-columns: repeat(3, 1fr); }
.action-tile { display: grid; min-height: 180px; align-content: center; gap: 6px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.action-tile__icon { display: block; color: var(--primary); }
.action-tile__icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.action-tile strong { font-size: 1.1rem; }
.action-tile small { color: var(--muted); }

.task-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.task-card { display: flex; min-height: 170px; flex-direction: column; gap: 5px; padding: 18px; border: 2px solid var(--border); border-left-width: 8px; border-radius: 16px; background: var(--surface); color: var(--text); text-decoration: none; transition: box-shadow 160ms ease, transform 160ms ease; }
.task-card--critical { border-color: var(--danger); background: var(--danger-soft); }
.task-card--high { border-left-color: #d7861a; }
.task-card--important { border-left-color: var(--warning); }
.task-card__topline { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .76rem; font-weight: 900; }
.task-card > strong { margin-top: auto; font-size: 1.6rem; }
.priority-label { color: var(--danger-dark); }
.empty-state { display: grid; min-height: 190px; place-items: center; align-content: center; margin-top: 18px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-state span { font-size: 2.5rem; color: var(--success); }
.shift-end-panel { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }

.filter-strip {
  display: flex;
  gap: 9px;
  margin: 0 0 20px;
  padding: 4px 2px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.filter-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 9px 15px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}
.filter-chip.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.room-legend { display: flex; flex-wrap: wrap; gap: 9px 15px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.room-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; background: #c7cec9; }
.legend-dot--ready { background: #70bd8f; }
.legend-dot--occupied { background: #6aacd0; }
.legend-dot--departure { background: #e7b842; }
.legend-dot--dirty { background: #d96a6a; }
.legend-dot--cleaning { background: #e6923f; }
.legend-dot--waiting { background: #9872b0; }
.floor-section { margin-top: 30px; }
.floor-section h2 { margin: 0 0 12px; font-size: 1.2rem; }
.room-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.room-card {
  display: grid;
  min-height: 132px;
  align-content: center;
  gap: 2px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  text-decoration: none;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.room-card > strong { font-size: 1.8rem; line-height: 1.1; }
.room-card > span:not(.room-card__flags), .room-card small { font-size: .76rem; font-weight: 850; }
.room-card__flags { display: flex; min-height: 22px; align-items: center; justify-content: space-between; gap: 3px; color: var(--danger-dark); font-size: .72rem; }
.room-card--ready { border-color: #70bd8f; background: var(--success-soft); }
.room-card--occupied { border-color: #6aacd0; background: var(--info-soft); }
.room-card--departure { border-color: #e7b842; background: var(--warning-soft); }
.room-card--dirty { border-color: #d96a6a; background: var(--danger-soft); }
.room-card--cleaning { border-color: #dd8a3a; background: #fff0df; }
.room-card--waiting { border-color: #9872b0; background: var(--purple-soft); }
.room-card--dnd { border-color: #d04444; background: repeating-linear-gradient(135deg, #fde7e7, #fde7e7 10px, #fff 10px, #fff 20px); }
.room-card--closed, .room-card--unknown { border-color: #adb6b1; background: #ecefed; color: #53615a; }
.room-hero { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; margin-bottom: 18px; border: 2px solid var(--border); border-radius: var(--radius); }
.room-hero div { display: grid; min-height: 120px; place-items: center; align-content: center; padding: 12px; background: rgb(255 255 255 / 72%); text-align: center; }
.room-hero span { color: var(--muted); font-size: .75rem; font-weight: 900; }
.room-hero strong { font-size: 1.25rem; }
.flag-line { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.flag-line span { padding: 8px 12px; border-radius: 999px; background: var(--purple-soft); color: var(--purple); font-weight: 900; }
.operation-panel, .surface-form, .task-focus, .history-panel, .privacy-notice {
  margin-block: 20px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.operation-panel h2, .surface-form h2 { margin-top: 0; }
.operation-accordion { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.operation-accordion > form, .operation-accordion > details { min-width: 0; }
.operation-accordion > form .button { width: 100%; }
details { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
details > summary { min-height: 54px; padding: 15px; font-weight: 900; cursor: pointer; }
details > form { margin: 0 15px 15px; }
.choice-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.form-page { width: min(720px, 100%); margin-inline: auto; }
.surface-form .errorlist { margin: 0; padding: 8px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger-dark); list-style: none; }
.surface-form p { display: grid; gap: 5px; }
.surface-form input:not([type="checkbox"]):not([type="radio"]), .surface-form select, .surface-form textarea {
  width: 100%; min-height: 54px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px; background: #fff;
}
.surface-form input[type="file"] { padding: 10px; }
.privacy-notice { border: 2px solid var(--info); background: var(--info-soft); }
.privacy-notice p { margin-bottom: 0; }
.task-focus { border-left: 9px solid var(--primary); }
.task-focus--critical { border-color: var(--danger); background: var(--danger-soft); }
.task-focus--important { border-color: var(--warning); background: var(--warning-soft); }
.task-focus > strong { display: block; font-size: clamp(1.5rem, 5vw, 2.4rem); }
.due-time { font-size: 1.1rem; font-weight: 900; }
.compact-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.compact-facts div { padding: 12px; border-radius: 12px; background: var(--surface-soft); }
.compact-facts dt { color: var(--muted); font-size: .75rem; font-weight: 900; }
.compact-facts dd { margin: 3px 0 0; font-weight: 900; }
.dominant-actions { display: grid; gap: 14px; margin-block: 22px; }
.dominant-actions > form > .button { width: 100%; }
.task-complete-form { margin: 0; text-align: center; }
.task-complete-form label { display: grid; gap: 7px; }
.check-list { display: grid; gap: 8px; }
.check-list form { margin: 0; }
.check-row { width: 100%; min-height: 58px; padding: 12px 16px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 850; text-align: left; cursor: pointer; }
.check-row.is-complete { border-color: #8ac3a6; background: var(--success-soft); color: var(--success); }
.history-panel { box-shadow: none; }
.timeline { display: grid; gap: 0; padding-left: 20px; }
.timeline li { display: grid; grid-template-columns: 135px 1fr auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.timeline time, .timeline span { color: var(--muted); font-size: .82rem; }
.two-column, .profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.selector-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-block: 16px 22px; }
.selector-room { position: relative; min-width: 0; cursor: pointer; }
.selector-room input { position: absolute; opacity: 0; pointer-events: none; }
.selector-room span { display: grid; min-height: 54px; place-items: center; border: 2px solid var(--border); border-radius: 11px; background: #fff; font-size: 1.05rem; font-weight: 900; }
.selector-room small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: .72rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.selector-room input:checked + span { border-color: var(--primary); background: var(--primary); color: #fff; }
.selector-room input:focus-visible + span { outline: 4px solid #f5b63f; outline-offset: 2px; }
.staff-strip { display: flex; gap: 10px; overflow-x: auto; }
.staff-strip article { flex: 0 0 180px; padding: 15px; border: 1px solid #8ac3a6; border-radius: 13px; background: var(--success-soft); }
.staff-strip strong, .staff-strip span { display: block; }
.staff-strip span { color: var(--success); font-size: .76rem; font-weight: 900; }
.management-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.management-grid article { display: grid; min-height: 155px; align-content: center; gap: 4px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.management-grid span, .management-grid small { color: var(--muted); font-weight: 800; }
.management-grid strong { font-size: clamp(1.9rem, 4vw, 3rem); }
.management-grid .metric-danger { border: 2px solid var(--danger); background: var(--danger-soft); }
.handover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.handover-grid .task-list { grid-template-columns: 1fr; }
.record-list, .notification-list { display: grid; gap: 10px; }
.record-list article, .notification-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.record-list article > * { margin: 0; }
.notification-item { border-left-width: 8px; }
.notification-item--critical { border-color: var(--danger); background: var(--danger-soft); }
.notification-item--important { border-left-color: var(--warning); }
.notification-item.is-closed { opacity: .65; }
.notification-item strong, .notification-item span { display: block; }
.notification-item p { margin: 5px 0 0; }
.notification-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.profile-grid form { margin-top: 12px; }

.kitchen-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.kitchen-board div { display: grid; min-height: 210px; place-items: center; align-content: center; border: 3px solid var(--primary); border-radius: 22px; background: var(--surface); text-align: center; }
.kitchen-board span { font-size: 1.1rem; font-weight: 900; }
.kitchen-board strong { font-size: clamp(3rem, 9vw, 6rem); color: var(--primary-dark); }

.setup-steps { display: grid; gap: 16px; padding: 0; list-style: none; counter-reset: none; }
.setup-steps li { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.setup-steps li > span { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.2rem; font-weight: 900; }
.setup-steps strong { font-size: 1.1rem; }
.offline-card strong { display: block; margin-block: 14px 22px; color: var(--danger); }
.offline-icon { display: grid; width: 70px; height: 70px; margin: 0 auto 20px; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-size: 2.2rem; font-weight: 900; }

@media (hover: hover) {
  .primary-nav__item:hover { background: var(--surface-soft); color: var(--primary-dark); }
  .metric-card:hover, .summary-card:hover, .action-tile:hover, .task-card:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgb(18 55 41 / 14%); }
}

.metric-card:active, .summary-card:active, .action-tile:active, .task-card:active { transform: translateY(1px) scale(.995); }

@media (max-width: 900px) {
  .page-shell { padding-bottom: 110px; }
  .page-shell--centered { padding-bottom: 24px; }
  .primary-nav {
    position: fixed;
    z-index: 50;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: 72px;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    margin: 0;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 -8px 30px rgb(18 55 41 / 8%);
    backdrop-filter: blur(12px);
  }
  .primary-nav__item { display: grid; min-width: 0; min-height: 58px; place-items: center; align-content: center; gap: 2px; padding: 5px 3px; font-size: .78rem; }
  .primary-nav__item svg { width: 23px; height: 23px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .action-grid, .task-list { grid-template-columns: repeat(2, 1fr); }
  .kitchen-board { grid-template-columns: 1fr; }
  .room-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .management-grid { grid-template-columns: repeat(2, 1fr); }
  .handover-grid { grid-template-columns: 1fr; }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --radius: 15px; }
  .app-header { min-height: var(--header-height-compact); }
  .brand__mark { width: 40px; height: 40px; }
  .brand small { display: none; }
  .status-pill { display: none; }
  .page-shell { padding: 20px 14px 104px; }
  .page-shell--centered { padding-bottom: 20px; }
  .page-heading { align-items: flex-start; }
  .metric-grid--four { grid-template-columns: repeat(2, 1fr); }
  .metric-card { min-height: 94px; }
  .action-grid, .task-list { grid-template-columns: 1fr; }
  .action-tile { min-height: 130px; }
  .task-card { min-height: 156px; }
  .critical-alert { top: calc(70px + var(--safe-top)); }
  .room-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .room-card { min-height: 116px; padding: 8px 5px; }
  .room-card > strong { font-size: 1.55rem; }
  .room-hero { grid-template-columns: repeat(2, 1fr); }
  .room-hero div { min-height: 94px; }
  .operation-accordion, .two-column, .profile-grid { grid-template-columns: 1fr; }
  .choice-buttons { grid-template-columns: 1fr; }
  .selector-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .management-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .management-grid article { min-height: 125px; padding: 14px; }
  .management-grid strong { font-size: 1.8rem; }
  .compact-facts { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .notification-item, .record-list article { align-items: stretch; flex-direction: column; }
  .notification-actions { width: 100%; }
  .notification-actions > * { flex: 1; }
}

@media (max-width: 520px) {
  .page-heading > .button { width: 100%; }
  .brand strong { max-width: 155px; }
}

@media (max-width: 380px) {
  .brand strong { max-width: 125px; }
  .primary-nav__item { font-size: .72rem; }
}

@media (max-height: 700px) {
  .page-shell--centered { place-items: start center; }
  .login-card { margin-block: 8px; }
}

@media (max-width: 390px) {
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .summary-card { min-height: 112px; padding: 14px; }
  .summary-card strong { font-size: 2rem; }
  .setup-steps li { grid-template-columns: 40px 1fr; padding: 16px 13px; }
  .setup-steps li > span { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .app-header, .primary-nav, .button, .network-banner { display: none !important; }
  .page-shell { width: 100%; padding: 0; }
}
