:root {
  --navy-950: #102b3d;
  --navy-900: #173b54;
  --navy-800: #24536f;
  --navy-100: #e7eef2;
  --gold-600: #a87e2e;
  --gold-500: #c4a159;
  --gold-100: #f4ecda;
  --ink: #172832;
  --muted: #60717b;
  --line: #d7dee1;
  --line-strong: #b9c5ca;
  --surface: #ffffff;
  --surface-alt: #f4f6f6;
  --canvas: #eef1f2;
  --green: #26735f;
  --green-bg: #e5f2ed;
  --amber: #99641d;
  --amber-bg: #f8ecd7;
  --red: #a63f39;
  --red-bg: #fae9e7;
  --blue: #2e6d91;
  --blue-bg: #e4f0f6;
  --purple: #715786;
  --purple-bg: #f0eaf4;
  --shadow: 0 1px 2px rgba(16, 43, 61, 0.08), 0 8px 24px rgba(16, 43, 61, 0.06);
  --sidebar-width: 236px;
  --topbar-height: 64px;
  --mobile-nav-height: 72px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.45;
}

button, input, select, textarea {
  font: inherit;
  letter-spacing: 0;
}

button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: var(--navy-800);
}

img {
  max-width: 100%;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 740;
}

h2 {
  margin-bottom: 12px;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 720;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy-900);
  border-radius: 4px;
  transform: translateY(-140%);
}

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

:focus-visible {
  outline: 3px solid #2b86b6;
  outline-offset: 2px;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  color: var(--gold-500);
  border: 2px solid var(--gold-500);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-style: italic;
  line-height: 1;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  white-space: nowrap;
}

.brand-lockup strong {
  color: #fff;
  font-size: 16px;
  line-height: 1.1;
}

.brand-lockup small {
  margin-top: 4px;
  color: var(--gold-500);
  font-size: 11px;
  font-weight: 720;
  text-transform: uppercase;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--navy-900);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
  min-height: 88px;
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 18px 12px;
}

.nav-section-label {
  margin: 12px 12px 3px;
  color: #9fb5c0;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: #dbe6eb;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 620;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.08);
}

.nav-link[aria-current="page"] {
  color: #fff;
  background: rgba(196,161,89,0.18);
  box-shadow: inset 3px 0 var(--gold-500);
}

.nav-link svg,
.mobile-nav-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.sidebar-action {
  padding: 0 12px 18px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.user-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.user-button:hover {
  background: rgba(255,255,255,0.08);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  color: var(--navy-950);
  background: var(--gold-500);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.user-copy {
  min-width: 0;
  flex: 1;
}

.user-copy strong,
.user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 14px;
}

.user-copy small {
  margin-top: 1px;
  color: #bcd0da;
  font-size: 11px;
}

.main-column {
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  min-width: 0;
}

.topbar-title strong,
.topbar-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title strong {
  color: var(--navy-900);
  font-size: 16px;
}

.topbar-title small {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.online-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
}

.online-state.is-offline {
  color: var(--red);
}

.online-state.is-offline .online-dot {
  background: var(--red);
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.portal-shell,
.planner-shell {
  min-height: 100vh;
  background: var(--canvas);
}

.portal-topbar,
.planner-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px max(24px, calc((100vw - 1280px) / 2));
  color: #fff;
  background: var(--navy-900);
  border-bottom: 3px solid var(--gold-500);
}

.portal-brand {
  color: inherit;
  text-decoration: none;
}

.portal-brand .brand-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  font-size: 26px;
}

.portal-brand strong {
  font-size: 15px;
}

.portal-account {
  display: flex;
  align-items: center;
  gap: 18px;
}

.portal-account .online-state {
  color: #dbe6eb;
}

.portal-account .user-button,
.planner-topbar .user-button {
  width: auto;
}

.portal-user-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 680;
}

.portal-main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 34px 28px 52px;
}

.portal-intro {
  min-height: 128px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line-strong);
}

.portal-intro h1 {
  margin-bottom: 7px;
  color: var(--navy-950);
}

.portal-intro p {
  margin-bottom: 0;
  color: var(--muted);
}

.portal-intro time {
  padding-top: 25px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.portal-eyebrow {
  margin-bottom: 8px !important;
  color: var(--gold-600) !important;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-main > section + section {
  margin-top: 30px;
}

.portal-section-head {
  min-height: 36px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.portal-section-head h2 {
  margin: 0;
}

.portal-section-head > span {
  color: var(--muted);
  font-size: 12px;
}

.module-grid {
  display: grid;
  gap: 14px;
}

.active-modules {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.planned-modules {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-card {
  position: relative;
  min-width: 0;
  min-height: 176px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: start;
  gap: 14px 16px;
  padding: 22px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--module-color, var(--navy-800));
  border-radius: 7px;
  box-shadow: var(--shadow);
  text-decoration: none;
}

a.module-card:hover {
  border-color: var(--module-color, var(--navy-800));
  transform: translateY(-1px);
}

.module-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--module-color, var(--navy-800));
  background: var(--module-bg, var(--navy-100));
  border-radius: 7px;
}

.module-icon svg {
  width: 24px;
  height: 24px;
}

.module-copy {
  min-width: 0;
}

.module-copy small,
.module-copy strong,
.module-copy > span {
  display: block;
}

.module-copy small {
  margin-bottom: 4px;
  color: var(--module-color, var(--navy-800));
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-copy strong {
  margin-bottom: 5px;
  color: var(--navy-950);
  font-size: 19px;
}

.module-copy > span {
  color: var(--muted);
  font-size: 13px;
}

.module-meta {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
}

.module-meta > svg {
  width: 18px;
  height: 18px;
  color: var(--module-color, var(--navy-800));
  flex: 0 0 auto;
}

.module-card.is-planned {
  min-height: 158px;
  box-shadow: none;
}

.tone-green { --module-color: #26735f; --module-bg: #e5f2ed; }
.tone-gold { --module-color: #946d23; --module-bg: #f4ecda; }
.tone-blue { --module-color: #2e6d91; --module-bg: #e4f0f6; }
.tone-purple { --module-color: #715786; --module-bg: #f0eaf4; }
.tone-red { --module-color: #a63f39; --module-bg: #fae9e7; }
.tone-gray { --module-color: #52636c; --module-bg: #edf0f1; }

.planner-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  overflow: hidden;
}

.planner-topbar {
  position: relative;
  min-height: 64px;
  padding: 8px 18px;
  border-bottom-width: 2px;
}

.planner-topbar .btn {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.28);
}

.planner-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.planner-title strong,
.planner-title small {
  display: block;
  white-space: nowrap;
}

.planner-title small {
  margin-top: 1px;
  color: var(--gold-500);
  font-size: 10px;
  font-weight: 720;
  text-transform: uppercase;
}

.planner-frame-wrap,
.planner-frame {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
}

.weekly-reports-main {
  width: min(1380px, 100%);
}

.workspace-breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
}

.workspace-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  text-decoration: none;
}

.workspace-breadcrumb svg {
  width: 15px;
  height: 15px;
}

.report-date-control {
  display: grid;
  gap: 3px;
}

.report-date-control span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.report-date-control input {
  min-height: 40px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.service-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.service-metrics > div {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.service-metrics > div:last-child {
  border-right: 0;
}

.service-metrics span,
.service-metrics strong {
  display: block;
}

.service-metrics span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.service-metrics strong {
  color: var(--navy-900);
  font-size: 24px;
}

.service-sync-note {
  margin-bottom: 22px;
}

.service-section + .service-section {
  margin-top: 30px;
}

.service-trend-section {
  padding: 14px 18px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.service-trend-section .portal-section-head {
  min-height: 30px;
  margin-bottom: 4px;
}

.service-trend-section .portal-section-head > div {
  min-width: 0;
}

.service-trend-section .portal-section-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.score-scale-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.score-scale-legend i,
.score-scale-legend b {
  width: 14px;
  height: 8px;
  display: inline-block;
  border-radius: 2px;
}

.score-scale-legend i { background: #f44e45; }
.score-scale-legend b { margin-left: 3px; background: #2fa958; }

.service-trend-chart {
  height: 92px;
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-strong);
}

.trend-point {
  height: 84px;
  display: grid;
  grid-template-rows: 18px 1fr 18px;
  align-items: end;
  text-align: center;
}

.trend-point strong {
  color: var(--navy-900);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trend-point small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  text-transform: uppercase;
}

.trend-track {
  width: min(46px, 72%);
  height: 46px;
  display: flex;
  align-items: flex-end;
  justify-self: center;
  overflow: hidden;
  background: #edf1f2;
  border-radius: 4px 4px 0 0;
}

.trend-track span {
  width: 100%;
  height: var(--trend-height);
  min-height: 0;
  background: var(--trend-color);
  border-radius: 3px 3px 0 0;
}

.service-table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 24px;
}

.service-table-grid .service-section + .service-section {
  margin-top: 0;
}

.score-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.score-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  table-layout: fixed;
}

.score-table th,
.score-table td {
  height: 48px;
  padding: 8px 5px;
  border-right: 1px solid rgba(23, 40, 50, 0.18);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.score-table th:first-child {
  width: 92px;
  text-align: left;
}

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

.score-table tbody tr:last-child th,
.score-table tbody tr:last-child td {
  border-bottom: 0;
}

.score-table thead th {
  height: 46px;
  color: var(--muted);
  background: var(--surface-alt);
  font-size: 9.5px;
  line-height: 1.2;
  font-weight: 760;
}

.score-table tbody th {
  background: #fff;
  font-size: 13px;
}

.score-table tbody th small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
}

.score-table td {
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.score-cell {
  color: var(--score-fg) !important;
  background: var(--score-bg) !important;
}

.score-table tr.is-week th,
.score-table tr.is-week td {
  border-top: 2px solid var(--navy-900);
  font-weight: 800;
}

.score-one { color: #7e1f1b !important; background: #f64a40 !important; }
.score-two { color: #5a2d00 !important; background: #fa7d19 !important; }
.score-three { color: #4d3800 !important; background: #ffc01d !important; }
.score-four { color: #25330b !important; background: #a9bc29 !important; }
.score-five { color: #073d20 !important; background: #32a955 !important; }
.score-empty { color: var(--muted) !important; background: #eef1f2 !important; }

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

.comment-list article {
  min-width: 0;
  padding: 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.comment-list article header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
}

.comment-list article > div {
  margin-top: 12px;
}

.comment-list small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.comment-list p {
  margin: 0;
  overflow-wrap: anywhere;
}

.management-notes textarea {
  width: 100%;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  line-height: 1.5;
}

.page-header {
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-weight: 690;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
  text-align: center;
}

.btn:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: #95a7af;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn-primary {
  color: #fff;
  background: var(--navy-900);
  border-color: var(--navy-900);
}

.btn-primary:hover:not(:disabled) {
  color: #fff;
  background: var(--navy-800);
  border-color: var(--navy-800);
}

.btn-gold {
  color: var(--navy-950);
  background: var(--gold-500);
  border-color: var(--gold-500);
}

.btn-gold:hover:not(:disabled) {
  background: #d1b16c;
  border-color: #d1b16c;
}

.btn-danger {
  color: var(--red);
  background: var(--surface);
  border-color: #d9a7a3;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn-wide {
  width: 100%;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-alt);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3,
.panel-header p {
  margin: 0;
}

.panel-header p {
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.weekly-panel {
  grid-column: span 7;
  overflow: hidden;
}

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

.weekly-score {
  margin-bottom: 4px;
  color: var(--navy-900);
  font-size: 40px;
  line-height: 1;
  font-weight: 780;
}

.weekly-score span {
  color: var(--muted);
  font-size: 20px;
  font-weight: 650;
}

.weekly-copy p {
  margin: 0;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  margin: 18px 0 8px;
  overflow: hidden;
  background: #dfe5e8;
  border-radius: 5px;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: inherit;
  transition: width 220ms ease;
}

.progress-bar.is-complete {
  background: var(--gold-600);
}

.week-dates {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.weekly-action {
  min-width: 170px;
}

.metric-strip {
  grid-column: span 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.metric {
  min-width: 0;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.metric:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.metric:nth-last-child(-n+2) {
  border-bottom: 0;
}

.metric-value {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1;
  font-weight: 760;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.queue-panel {
  grid-column: span 8;
}

.recent-panel {
  grid-column: span 4;
}

.status-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 760;
  white-space: normal;
  text-align: left;
}

.status-badge svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.badge-red { color: var(--red); background: var(--red-bg); border-color: #efc5c1; }
.badge-amber { color: var(--amber); background: var(--amber-bg); border-color: #eed2a4; }
.badge-green { color: var(--green); background: var(--green-bg); border-color: #bfdfd4; }
.badge-blue { color: var(--blue); background: var(--blue-bg); border-color: #c0dae7; }
.badge-gray { color: #53636d; background: #edf0f1; border-color: #d8dfe2; }
.badge-purple { color: var(--purple); background: var(--purple-bg); border-color: #d9cbe3; }

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

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

.data-table th {
  color: var(--muted);
  background: #fafbfb;
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.data-table tbody tr[data-href] {
  cursor: pointer;
}

.data-table tbody tr[data-href]:hover {
  background: #f7f9f9;
}

.table-primary {
  display: block;
  color: var(--navy-900);
  font-weight: 760;
}

.table-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.mobile-list {
  display: none;
}

.compact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.compact-item {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.compact-item:last-child {
  border-bottom: 0;
}

.compact-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  color: var(--navy-800);
  background: var(--navy-100);
  border-radius: 6px;
}

.compact-icon svg {
  width: 18px;
  height: 18px;
}

.compact-copy {
  min-width: 0;
  flex: 1;
}

.compact-copy strong,
.compact-copy span {
  display: block;
}

.compact-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state,
.error-state,
.loading-state {
  min-height: 220px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg,
.error-state svg {
  width: 30px;
  height: 30px;
  color: #7a8b94;
}

.error-state svg {
  color: var(--red);
}

.empty-state h2,
.empty-state h3,
.error-state h2,
.error-state h3 {
  margin: 0;
  color: var(--ink);
}

.empty-state p,
.error-state p {
  max-width: 440px;
  margin: 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--navy-800);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-field {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field input {
  width: 100%;
  height: 40px;
  padding: 8px 12px 8px 38px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.field,
.field-row {
  min-width: 0;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label {
  color: #40535e;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.select-control {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  color: #657680;
  background: #eef1f2;
}

.field-help,
.field-error {
  margin: 0;
  font-size: 12px;
}

.field-help { color: var(--muted); }
.field-error { color: var(--red); }

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

.segmented {
  display: inline-flex;
  padding: 3px;
  background: #e8edef;
  border-radius: 7px;
}

.segmented button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  color: #53656f;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 690;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  color: var(--navy-900);
  background: #fff;
  box-shadow: 0 1px 3px rgba(16,43,61,0.14);
}

.segmented svg {
  width: 16px;
  height: 16px;
}

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

.room-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(16,43,61,0.06);
  text-decoration: none;
}

.room-card:hover {
  border-color: #a3b2b9;
  box-shadow: var(--shadow);
}

.room-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.room-number {
  color: var(--navy-900);
  font-size: 22px;
  line-height: 1;
  font-weight: 780;
}

.room-type {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.room-meta {
  display: grid;
  gap: 7px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.meta-row strong {
  color: var(--ink);
  text-align: right;
}

.map-viewer {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background: #dde3e5;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.map-toolbar {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 5px;
  padding: 5px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 18px;
}

.map-image {
  display: block;
  width: 100%;
  min-width: 760px;
  max-width: none;
  transform-origin: top center;
  transition: width 180ms ease;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 18px;
}

.room-identity {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.room-key {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  color: var(--navy-900);
  background: var(--navy-100);
  border-radius: 7px;
  font-size: 20px;
  font-weight: 800;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-cell {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.status-cell:last-child {
  border-right: 0;
}

.status-cell span,
.status-cell strong {
  display: block;
}

.status-cell span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-cell strong {
  overflow-wrap: anywhere;
}

.facts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.fact {
  min-width: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.fact:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.fact dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.fact dd {
  margin: 4px 0 0;
  font-weight: 680;
  overflow-wrap: anywhere;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
  background: var(--surface);
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 44px;
  overflow: hidden;
  color: #fff;
  background: var(--navy-900);
  border-right: 6px solid var(--gold-500);
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: auto 0;
}

.auth-brand-copy h1 {
  max-width: 460px;
  margin-bottom: 16px;
  color: #fff;
  font-size: 42px;
}

.auth-brand-copy p {
  max-width: 430px;
  margin: 0;
  color: #ccdae1;
  font-size: 17px;
}

.auth-version {
  position: relative;
  z-index: 1;
  color: #9fb6c2;
  font-size: 12px;
}

.auth-main {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 36px;
  background: #f7f8f8;
}

.auth-form {
  width: min(420px, 100%);
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-form-header {
  margin-bottom: 24px;
}

.auth-form-header p {
  margin: 0;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.pin-input {
  font-variant-numeric: tabular-nums;
}

.known-users {
  display: grid;
  gap: 8px;
}

.known-user {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.known-user[aria-pressed="true"] {
  border-color: var(--navy-800);
  box-shadow: inset 0 0 0 1px var(--navy-800);
}

.known-user .avatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.notice-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 13px;
  color: #6d4d18;
  background: var(--amber-bg);
  border: 1px solid #e5c68f;
  border-radius: 6px;
}

.notice-bar.is-error {
  color: var(--red);
  background: var(--red-bg);
  border-color: #edbbb7;
}

.notice-bar.is-info {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: #bad6e4;
}

.notice-bar svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.mobile-nav {
  display: none;
}

.inspection-page {
  padding-bottom: 96px;
}

.inspection-header {
  position: sticky;
  z-index: 15;
  top: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -28px -28px 22px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.inspection-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.inspection-title h1 {
  margin: 0;
  font-size: 20px;
}

.inspection-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sync-state {
  min-width: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.sync-state svg {
  width: 15px;
  height: 15px;
}

.inspection-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.section-rail {
  position: sticky;
  top: 148px;
  overflow: hidden;
}

.section-rail-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-rail-header strong,
.section-rail-header span {
  display: block;
}

.section-rail-header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-nav {
  display: grid;
  padding: 8px;
}

.section-nav button {
  min-height: 44px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
}

.section-nav button[aria-current="step"] {
  color: var(--navy-900);
  background: var(--navy-100);
}

.section-index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #7e8e96;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 760;
}

.section-nav button.is-complete .section-index {
  background: var(--green);
}

.section-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.inspection-content {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

#section-title,
.inspection-item {
  scroll-margin-top: calc(var(--topbar-height) + 88px);
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.inspection-items {
  display: grid;
  gap: 10px;
}

.inspection-item {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.inspection-item.has-exception {
  border-color: #ddba84;
}

.inspection-item.has-error {
  border-color: #d77c75;
  box-shadow: inset 3px 0 var(--red);
}

.item-main {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(410px, 1.5fr);
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.item-label {
  min-width: 0;
}

.item-label strong {
  display: block;
  overflow-wrap: anywhere;
}

.item-label p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.item-code {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.result-options {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
}

.result-option {
  position: relative;
  min-width: 0;
}

.result-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.result-option label {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: #4f616b;
  background: #f7f9f9;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.result-option input:focus-visible + label {
  outline: 3px solid #2b86b6;
  outline-offset: 1px;
}

.result-option input:checked + label {
  color: #fff;
  background: var(--navy-900);
  border-color: var(--navy-900);
}

.result-option[data-result="NEEDS_REPAIR"] input:checked + label,
.result-option[data-result="UNABLE"] input:checked + label {
  background: var(--red);
  border-color: var(--red);
}

.result-option[data-result="REPAIRED"] input:checked + label {
  background: var(--amber);
  border-color: var(--amber);
}

.result-option[data-result="NA"] input:checked + label {
  background: #63747d;
  border-color: #63747d;
}

.item-details {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(170px, 0.65fr) minmax(220px, 1.4fr);
  gap: 12px;
  padding: 14px 16px 16px;
  background: #fbfaf7;
  border-top: 1px solid #ead8b8;
}

.item-details.no-temperature {
  grid-template-columns: minmax(170px, 0.6fr) minmax(220px, 1.4fr);
}

.temperature-wrap {
  position: relative;
}

.temperature-wrap input {
  padding-right: 34px;
}

.temperature-unit {
  position: absolute;
  right: 11px;
  bottom: 11px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.inspection-footer {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: var(--sidebar-width);
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(16,43,61,0.06);
}

.inspection-footer-progress {
  min-width: 180px;
}

.inspection-footer-progress strong,
.inspection-footer-progress span {
  display: block;
}

.inspection-footer-progress span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 18px;
}

.review-stat {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.review-stat:last-child {
  border-right: 0;
}

.review-stat strong,
.review-stat span {
  display: block;
}

.review-stat strong {
  font-size: 24px;
}

.review-stat span {
  color: var(--muted);
  font-size: 12px;
}

.review-section {
  margin-bottom: 12px;
  overflow: hidden;
}

.review-section summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 720;
  list-style: none;
}

.review-section summary::-webkit-details-marker { display: none; }

.review-section-list {
  border-top: 1px solid var(--line);
}

.review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

.review-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.report-action {
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.report-action .panel-body {
  display: grid;
  align-content: start;
  gap: 16px;
  flex: 1;
}

.report-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--navy-900);
  background: var(--navy-100);
  border-radius: 7px;
}

.report-icon svg {
  width: 22px;
  height: 22px;
}

.report-description {
  margin: 0;
  color: var(--muted);
}

.integration-facts {
  display: grid;
  margin: 0;
}

.integration-fact {
  display: grid;
  grid-template-columns: minmax(110px, 0.5fr) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.integration-fact:last-child {
  border-bottom: 0;
}

.integration-fact dt {
  color: var(--muted);
}

.integration-fact dd {
  margin: 0;
  font-weight: 680;
  overflow-wrap: anywhere;
}

.user-list {
  display: grid;
}

.user-row {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 0.8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

.user-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name strong,
.user-name span {
  display: block;
}

.user-name span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: #9ba8ae;
  border-radius: 12px;
  cursor: pointer;
  transition: background 150ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 150ms ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid #2b86b6;
  outline-offset: 2px;
}

.inspection-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 20px;
}

.detail-metadata {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.detail-metadata span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.detail-metadata svg {
  width: 14px;
  height: 14px;
}

.response-section {
  margin-top: 14px;
  overflow: hidden;
}

.response-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.25fr);
  gap: 18px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.response-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.response-result {
  text-align: right;
}

.overall-notes {
  padding: 16px;
  color: var(--ink);
  background: #fbfaf7;
  border-top: 1px solid var(--line);
}

.overall-notes strong {
  display: block;
  margin-bottom: 6px;
}

.overall-notes p {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 28, 40, 0.56);
}

.modal {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(9,28,40,0.28);
}

.modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-wide {
  width: min(880px, 100%);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.toast-region {
  position: fixed;
  z-index: 1500;
  right: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));
  display: grid;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  color: #fff;
  background: var(--navy-950);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(9,28,40,0.24);
}

.toast.is-error {
  background: #82322e;
}

.toast.is-success {
  background: #235e4f;
}

.toast svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.toast p {
  margin: 0;
}

.menu-popover {
  position: fixed;
  z-index: 110;
  width: 220px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 16px 44px rgba(16,43,61,0.2);
}

.menu-popover a,
.menu-popover button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-popover a:hover,
.menu-popover button:hover {
  background: var(--surface-alt);
}

.menu-popover svg {
  width: 17px;
  height: 17px;
}

@media (max-width: 1180px) {
  .service-table-grid {
    grid-template-columns: 1fr;
  }

  .weekly-panel,
  .metric-strip,
  .queue-panel,
  .recent-panel {
    grid-column: span 12;
  }

  .metric-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .metric:last-child {
    border-right: 0;
  }

  .room-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .item-main {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 900px) {
  .active-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  :root {
    --topbar-height: 58px;
  }

  h1 { font-size: 24px; }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-column {
    min-height: 100vh;
  }

  .topbar {
    min-height: var(--topbar-height);
    padding: 0 16px;
  }

  .topbar-actions .online-state span:last-child {
    display: none;
  }

  .page {
    padding: 20px 16px calc(var(--mobile-nav-height) + 24px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.98);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(16,43,61,0.09);
  }

  .mobile-nav-link {
    min-width: 0;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 2px;
    color: #657780;
    text-decoration: none;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 690;
  }

  .mobile-nav-link[aria-current="page"] {
    color: var(--navy-900);
    background: var(--navy-100);
  }

  .mobile-nav-link.is-primary {
    color: #fff;
    background: var(--navy-900);
  }

  .mobile-nav-link span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-header {
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-header p {
    font-size: 13px;
  }

  .page-actions .btn span.hide-mobile {
    display: none;
  }

  .dashboard-grid,
  .detail-layout,
  .reports-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .weekly-summary {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .weekly-action {
    min-width: 0;
  }

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

  .filters-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filters-group {
    width: 100%;
  }

  .search-field {
    min-width: 0;
  }

  .inspection-page {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .inspection-header {
    top: var(--topbar-height);
    margin: -20px -16px 16px;
    padding: 10px 16px;
  }

  .inspection-layout {
    grid-template-columns: 1fr;
  }

  .section-rail {
    position: static;
    overflow-x: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .section-rail-header {
    display: none;
  }

  .section-nav {
    display: flex;
    gap: 6px;
    padding: 2px 0 8px;
  }

  .section-nav button {
    min-width: 150px;
    background: #fff;
    border: 1px solid var(--line);
  }

  .section-heading {
    align-items: flex-start;
  }

  .result-options {
    grid-template-columns: repeat(5, minmax(78px, 1fr));
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .inspection-footer {
    left: 0;
    bottom: 0;
    min-height: calc(72px + env(safe-area-inset-bottom));
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }

  .inspection-footer-progress {
    min-width: 0;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    background: #f7f8f8;
  }

  .auth-brand {
    min-height: auto;
    padding: 22px 24px;
    border-right: 0;
    border-bottom: 4px solid var(--gold-500);
  }

  .auth-brand-copy,
  .auth-version {
    display: none;
  }

  .auth-main {
    place-items: start center;
    padding: 28px 16px;
  }

  .auth-form {
    padding: 22px;
  }

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

  .service-metrics > div:nth-child(2) {
    border-right: 0;
  }

  .service-metrics > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 640px) {
  body { font-size: 14px; }
  h1 { font-size: 22px; }
  h2 { font-size: 17px; }

  .topbar-title small {
    display: none;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .page-actions {
    justify-content: flex-start;
  }

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

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .desktop-table {
    display: none;
  }

  .mobile-list {
    display: grid;
  }

  .queue-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  .queue-card:last-child {
    border-bottom: 0;
  }

  .queue-card-copy {
    min-width: 0;
    color: inherit;
    text-decoration: none;
  }

  .queue-card-copy strong,
  .queue-card-copy span {
    display: block;
  }

  .queue-card-copy strong {
    color: var(--navy-900);
    font-size: 17px;
  }

  .queue-card-copy span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
  }

  .queue-card-actions {
    display: grid;
    align-content: center;
    gap: 6px;
  }

  .filters-group {
    flex-wrap: wrap;
  }

  .filters-group .select-control {
    flex: 1 1 130px;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    min-width: 0;
    flex: 1;
  }

  .room-grid {
    grid-template-columns: 1fr;
  }

  .map-viewer,
  .map-canvas {
    min-height: 410px;
  }

  .map-image {
    min-width: 680px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-cell:last-child {
    border-bottom: 0;
  }

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

  .fact:nth-child(odd) {
    border-right: 0;
  }

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

  .inspection-title .room-key {
    display: none;
  }

  .sync-state {
    min-width: 0;
  }

  .sync-state span {
    display: none;
  }

  .section-heading {
    display: grid;
  }

  .section-heading .btn {
    justify-self: start;
  }

  .item-main {
    padding: 14px;
  }

  .result-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .result-option:last-child {
    grid-column: span 2;
  }

  .result-option label {
    min-height: 44px;
  }

  .item-details,
  .item-details.no-temperature {
    grid-template-columns: 1fr;
  }

  .inspection-footer {
    gap: 10px;
  }

  .inspection-footer .btn {
    padding-right: 11px;
    padding-left: 11px;
  }

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

  .review-stat:nth-child(2) {
    border-right: 0;
  }

  .review-stat:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .inspection-detail-head,
  .response-row {
    grid-template-columns: 1fr;
  }

  .response-result {
    text-align: left;
  }

  .user-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .user-row .user-role-control {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .integration-fact {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: calc(94vh - env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .modal-footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .toast-region {
    right: 12px;
    bottom: calc(var(--mobile-nav-height) + 14px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .portal-topbar {
    min-height: 64px;
    padding: 8px 14px;
  }

  .portal-account {
    gap: 8px;
  }

  .portal-account .online-state,
  .portal-user-name,
  .portal-account .user-button > svg {
    display: none;
  }

  .portal-main {
    padding: 24px 16px 36px;
  }

  .portal-intro {
    min-height: 0;
    display: block;
    padding-bottom: 22px;
  }

  .portal-intro time {
    display: block;
    padding-top: 14px;
  }

  .active-modules,
  .planned-modules {
    grid-template-columns: 1fr;
  }

  .module-card,
  .module-card.is-planned {
    min-height: 150px;
    padding: 17px;
  }

  .service-metrics > div {
    padding: 14px;
  }

  .service-metrics strong {
    font-size: 20px;
  }

  .service-trend-section {
    padding: 12px;
  }

  .service-trend-chart {
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 4px;
    padding: 0;
  }

  .trend-track {
    width: min(34px, 74%);
  }

  .score-scale-legend {
    display: none;
  }

  .planner-topbar {
    padding: 8px 10px;
  }

  .planner-topbar .btn span,
  .planner-topbar .user-button {
    display: none;
  }

  .planner-title {
    position: static;
    transform: none;
  }
}

@media (max-width: 340px) {
  .inspection-page {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .inspection-footer {
    min-height: 72px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .inspection-footer-progress {
    display: none;
  }

  .inspection-footer .page-actions {
    width: 100%;
    flex-wrap: nowrap;
  }

  .inspection-footer .btn {
    min-width: 0;
    flex: 1 1 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .page-actions,
  .filters-bar,
  .inspection-footer,
  .toast-region {
    display: none !important;
  }

  .app-shell,
  .main-column {
    display: block;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .panel {
    break-inside: avoid;
    box-shadow: none;
  }
}
