:root {
  --ink: #17212b;
  --muted: #66727f;
  --line: #dfe5ea;
  --soft-line: #edf1f4;
  --surface: #ffffff;
  --canvas: #f5f7f8;
  --sidebar: #071a24;
  --sidebar-2: #0b2b38;
  --teal: #0b7d78;
  --teal-2: #0f9b91;
  --blue: #247aa6;
  --green: #1f8c5a;
  --red: #de4f4f;
  --amber: #d98515;
  --violet: #7665d8;
  --orange: #d96f19;
  --gold: #c99b18;
  --shadow: 0 10px 30px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: #edf7f7;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 22px 24px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #b8d6d7;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.brand strong {
  display: block;
  font-size: 23px;
  line-height: 1;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #a8bdc4;
  font-size: 12px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 4px;
  padding: 0 12px;
}

.nav-item {
  width: 100%;
  min-height: 47px;
  padding: 0 18px;
  color: #d8e6e8;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, var(--teal), var(--teal-2));
}

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

.quiet-button {
  min-height: 40px;
  color: #d8e6e8;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
}

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

.workspace {
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: auto auto minmax(280px, 1fr) auto auto auto;
  align-items: center;
  gap: 22px;
  min-height: 78px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.logout-button {
  min-height: 38px;
  padding: 0 12px;
  color: #33414e;
  background: #fff;
  border: 1px solid #cfd8df;
  border-radius: 6px;
  font-weight: 800;
}

.house-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

select,
input {
  height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd8df;
  border-radius: 6px;
  padding: 0 12px;
}

textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd8df;
  border-radius: 6px;
  padding: 11px 12px;
  resize: vertical;
  font: inherit;
}

.date-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #33414e;
  white-space: nowrap;
}

.calendar-dot {
  width: 14px;
  height: 14px;
  border: 2px solid #415360;
  border-radius: 3px;
}

.search {
  position: relative;
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search input {
  width: 100%;
  padding-left: 18px;
}

.notification {
  width: 39px;
  height: 39px;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 50%;
  font-weight: 800;
}

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

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: #8b5e3c;
  border-radius: 50%;
  font-weight: 800;
}

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

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

.page-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 8px;
}

.page-title > button:first-of-type {
  margin-left: auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.page-title p {
  margin-top: 5px;
  color: var(--muted);
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 8px;
  color: #1f6f49;
  background: #e6f6ed;
  border: 1px solid #bde4ce;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.primary-action {
  min-height: 42px;
  padding: 0 18px;
  color: #fff;
  background: var(--teal);
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.danger-action {
  background: #b63d3d;
}

.secondary-action {
  min-height: 42px;
  padding: 0 18px;
  color: #263541;
  background: #fff;
  border: 1px solid #cfd8df;
  border-radius: 6px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  padding: 18px 28px;
}

.metric-grid.simplified {
  padding-bottom: 12px;
}

.metric-grid.simplified .secondary-metric {
  display: none;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  display: flex;
  gap: 15px;
  min-height: 126px;
  padding: 20px;
}

.metric-card p {
  color: #34424f;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.metric-card small {
  display: block;
  margin-top: 18px;
  color: var(--muted);
}

.metric-icon {
  display: grid;
  flex: 0 0 auto;
  width: 47px;
  height: 47px;
  place-items: center;
  color: #fff;
  border-radius: 6px;
  font-weight: 900;
}

.teal { background: var(--teal); }
.blue { background: var(--blue); }
.green { background: var(--green); }
.red { background: var(--red); }
.amber { background: var(--amber); }
.violet { background: var(--violet); }
.orange { background: var(--orange); }
.gold { background: var(--gold); }

.progress {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 82px;
  height: 8px;
  overflow: hidden;
  background: #e6ebef;
  border-radius: 99px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(430px, 1.1fr) minmax(420px, 1.2fr) 360px;
  gap: 16px;
  padding: 0 28px 28px;
}

.command-center {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.15fr);
  gap: 16px;
  padding: 0 28px 18px;
}

.priority-panel,
.workflow-panel {
  box-shadow: var(--shadow);
}

.priority-list {
  display: grid;
  padding: 0 18px 18px;
}

.priority-item {
  display: grid;
  grid-template-columns: 14px minmax(120px, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  min-height: 56px;
  color: inherit;
  text-align: left;
  background: #fff;
  border: 0;
  border-top: 1px solid var(--soft-line);
  padding: 10px 0;
}

.priority-item:hover {
  background: #f7faf9;
}

.priority-item span:not(.priority-dot) {
  color: var(--muted);
}

.priority-item em {
  grid-column: 2 / -1;
  color: #34424f;
  font-style: normal;
  font-size: 12px;
}

.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
}

.priority-dot.overdue,
.priority-dot.incident {
  background: var(--red);
}

.priority-dot.warning,
.priority-dot.chores {
  background: var(--amber);
}

.priority-dot.test {
  background: var(--violet);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 18px;
}

.workflow-grid button {
  min-height: 58px;
  color: #263541;
  background: #f6f8f9;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
  font-weight: 900;
}

.workflow-grid button:hover {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.detail-drawer {
  margin: 0 28px 28px;
}

.detail-drawer summary {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 14px;
  padding: 0 14px;
  color: var(--teal);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.detail-drawer .dashboard-grid {
  padding: 0;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 16px;
  text-transform: uppercase;
}

.panel-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel-header.tight {
  padding-bottom: 10px;
}

.link-button {
  color: var(--teal);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.bed-table,
.resident-table {
  padding: 0 14px 14px;
}

.bed-row,
.resident-row,
.table-head {
  display: grid;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--soft-line);
}

.resident-button {
  width: 100%;
  color: inherit;
  text-align: left;
  background: #fff;
  border-right: 0;
  border-left: 0;
  border-top: 0;
}

.resident-button:hover {
  background: #f5f8f8;
}

.bed-row,
.table-head.bed {
  grid-template-columns: 86px 1fr 88px;
}

.resident-row,
.table-head.resident {
  grid-template-columns: 1fr 108px 92px 140px;
}

.table-head {
  min-height: 42px;
  padding: 0 10px;
  color: #33414e;
  background: #f3f5f7;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.bed-row,
.resident-row {
  padding: 10px;
}

.room-title strong,
.room-title span,
.next-action strong,
.next-action span {
  display: block;
}

.room-title span,
.next-action span {
  color: var(--muted);
  font-size: 12px;
}

.bed-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bed {
  min-width: 70px;
  padding: 9px 8px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #cfe4d8;
  background: #ecf8f1;
  font-size: 12px;
  font-weight: 800;
}

.bed span {
  display: block;
  margin-top: 4px;
  color: #16654d;
  font-weight: 700;
}

.bed.available {
  color: #51606d;
  background: #fff;
  border-style: dashed;
  border-color: #c8d0d6;
}

.bed.reserved {
  background: #fff8e5;
  border-color: #ead18b;
}

.bed.out {
  background: #fde7e7;
  border-color: #f1b5b5;
}

.occupancy {
  font-weight: 900;
}

.occupancy.warn { color: var(--amber); }
.occupancy.full { color: #c92f2f; }
.occupancy.ok { color: var(--teal); }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.status.overdue,
.status.incident {
  color: #b42020;
  background: #fde7e7;
}

.status.warning,
.status.chores {
  color: #a75900;
  background: #fff0dd;
}

.status.payment {
  color: #226394;
  background: #e2f0fb;
}

.status.test {
  color: #5946b7;
  background: #ebe7ff;
}

.balance {
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 0 18px 18px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid;
}

.legend .occupied { background: #ecf8f1; border-color: #cfe4d8; }
.legend .available { background: #fff; border-color: #c8d0d6; border-style: dashed; }
.legend .reserved { background: #fff8e5; border-color: #ead18b; }
.legend .out { background: #fde7e7; border-color: #f1b5b5; }

.ops-column {
  display: grid;
  gap: 16px;
  align-content: start;
}

.compact-panel {
  box-shadow: none;
}

.task-list,
.simple-list,
.notes-list {
  display: grid;
  padding: 0 12px 12px;
}

.task,
.simple-item,
.note {
  display: grid;
  gap: 3px;
  padding: 12px 8px;
  border-top: 1px solid var(--soft-line);
  font-size: 13px;
}

.task {
  grid-template-columns: 24px 1fr auto auto;
  align-items: start;
}

.chore-check {
  display: grid;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  place-items: center;
  color: #fff;
  background: #fff;
  border: 1px solid #aebbc5;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 900;
}

.task.complete .chore-check {
  background: var(--green);
  border-color: var(--green);
}

.chore-status {
  min-height: 25px;
  padding: 0 8px;
  color: #4d5b67;
  background: #f4f6f8;
  border: 1px solid #d8e0e6;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.task.missed .chore-status {
  color: #a75900;
  background: #fff0dd;
  border-color: #f0c992;
}

.task.complete .chore-status {
  color: #1f6f49;
  background: #e6f6ed;
  border-color: #bde4ce;
}

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

.task span,
.simple-item span,
.note span {
  color: var(--muted);
  font-size: 12px;
}

.simple-item {
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
}

.note p {
  color: #53616d;
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  opacity: 0;
  max-width: 340px;
  padding: 13px 16px;
  color: #fff;
  background: #17212b;
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 26, 36, 0.54);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid #dbe3e8;
  border-radius: 7px;
  box-shadow: 0 24px 70px rgba(7, 26, 36, 0.26);
}

.compact-modal {
  width: min(620px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 20px;
}

.modal-header p {
  margin-top: 5px;
  color: var(--muted);
}

.icon-button {
  width: 36px;
  height: 36px;
  color: #5c6874;
  background: #f4f6f8;
  border: 1px solid #d8e0e6;
  border-radius: 6px;
  font-weight: 900;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 24px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.form-grid label span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-grid input,
.form-grid select {
  width: 100%;
}

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

.full-span {
  grid-column: 1 / -1;
}

.modal-summary {
  display: flex;
  gap: 8px;
  margin: 0 24px;
  padding: 13px 14px;
  color: #30404c;
  background: #f5f8f8;
  border: 1px solid #dce8e7;
  border-radius: 6px;
}

.modal-summary span {
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px 24px;
}

.hidden {
  display: none !important;
}

.role-hidden {
  display: none !important;
}

.profile-panel {
  margin: 0 28px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.profile-header h2 {
  font-size: 21px;
}

.profile-header p {
  margin-top: 5px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 10px;
}

.profile-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.profile-tabs button {
  min-height: 42px;
  padding: 0 13px;
  color: #4d5b67;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-weight: 800;
}

.profile-tabs button.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.profile-content {
  padding: 18px 22px 22px;
}

.profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.profile-stat {
  padding: 14px;
  background: #f6f8f9;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
}

.profile-stat span,
.profile-detail-grid dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 14px;
}

.profile-detail-grid dl {
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--soft-line);
}

.profile-detail-grid dd {
  margin: 7px 0 0;
  color: #263541;
  font-weight: 700;
}

.profile-list-row,
.document-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 0.8fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 54px;
  padding: 0 12px;
  border-bottom: 1px solid var(--soft-line);
}

.profile-list-row span {
  color: var(--muted);
}

.profile-list-row em {
  justify-self: end;
  color: #33414e;
  font-style: normal;
  font-weight: 800;
}

.profile-empty {
  padding: 18px;
  color: var(--muted);
  background: #f6f8f9;
  border: 1px dashed #cfd8df;
  border-radius: 6px;
}

.profile-note {
  padding: 14px 0;
  border-bottom: 1px solid var(--soft-line);
}

.profile-note p {
  margin-top: 6px;
  color: #53616d;
  line-height: 1.5;
}

.document-row {
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
}

.reports-view {
  margin: 0 28px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-view {
  margin: 0 28px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.onboarding-view {
  margin: 18px 28px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.onboarding-header h2 {
  font-size: 24px;
}

.onboarding-header p,
.onboarding-room-tools p {
  margin-top: 6px;
  color: var(--muted);
}

.onboarding-steps {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.onboarding-form {
  display: grid;
  gap: 18px;
  padding: 20px 24px 24px;
}

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

.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.section-header h2 {
  font-size: 21px;
}

.section-header p {
  margin-top: 5px;
  color: var(--muted);
}

.section-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 14px;
  padding: 16px 22px;
  background: #f6f8f9;
  border-bottom: 1px solid var(--line);
}

.section-toolbar label {
  display: grid;
  gap: 7px;
}

.section-toolbar span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-toolbar input,
.section-toolbar select {
  width: 100%;
}

.directory-table {
  display: grid;
  padding: 0 14px 14px;
}

.directory-head,
.directory-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 130px 110px 130px 160px auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 0 10px;
}

.directory-head {
  min-height: 42px;
  margin-top: 14px;
  color: #33414e;
  background: #f3f5f7;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.directory-row {
  border-bottom: 1px solid var(--soft-line);
}

.directory-row span {
  color: var(--muted);
}

.bed-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  padding: 18px 22px 0;
}

.bed-summary-card {
  padding: 14px;
  background: #f6f8f9;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
}

.bed-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.bed-summary-card strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.bed-directory {
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
}

.room-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.room-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #f6f8f9;
  border-bottom: 1px solid var(--line);
}

.room-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.room-card-header span {
  color: var(--muted);
  font-weight: 800;
}

.room-bed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
}

.room-bed {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 12px;
  text-align: left;
  background: #ecf8f1;
  border: 1px solid #cfe4d8;
  border-radius: 6px;
}

.room-bed.available {
  background: #fff;
  border-style: dashed;
  border-color: #c8d0d6;
}

.room-bed.reserved {
  background: #fff8e5;
  border-color: #ead18b;
}

.room-bed.out {
  background: #fde7e7;
  border-color: #f1b5b5;
}

.room-bed strong {
  color: #263541;
}

.room-bed span {
  color: var(--muted);
  font-size: 13px;
}

.admin-tools {
  margin: 0 28px 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.reports-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.reports-header h2 {
  font-size: 21px;
}

.reports-header p {
  margin-top: 5px;
  color: var(--muted);
}

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

.report-card {
  min-height: 190px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.report-card.wide {
  grid-column: 1 / -1;
}

.report-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
}

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

.report-kpis div {
  padding: 14px;
  background: #f6f8f9;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
}

.report-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-kpis strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.report-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--soft-line);
}

.report-row span {
  color: #33414e;
  font-weight: 800;
}

.report-row em {
  grid-column: 1 / -1;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.report-empty {
  padding: 14px;
  color: var(--muted);
  background: #f6f8f9;
  border: 1px dashed #cfd8df;
  border-radius: 6px;
}

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

.admin-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 190px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.user-admin-card {
  grid-column: 1 / -1;
}

.audit-card {
  grid-column: 1 / -1;
}

.backup-card {
  grid-column: 1 / -1;
}

.setup-card {
  grid-column: 1 / -1;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.setup-form {
  display: grid;
  gap: 14px;
}

.setup-step-panel[data-setup-panel="defaults"] {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 160px 160px;
  gap: 12px;
  align-items: end;
}

.setup-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.setup-steps button {
  min-height: 38px;
  padding: 0 12px;
  color: #33414e;
  background: #f6f8f9;
  border: 1px solid #dfe7ec;
  border-radius: 6px;
  font-weight: 900;
}

.setup-steps button.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.setup-form label {
  display: grid;
  gap: 7px;
}

.setup-form label span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.room-builder {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.room-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.setup-room-list {
  display: grid;
  gap: 10px;
}

.setup-room-row {
  display: grid;
  grid-template-columns: 90px minmax(180px, 1fr) 100px auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.setup-room-row input {
  width: 100%;
}

.config-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

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

.setup-review-card {
  padding: 14px;
  background: #f6f8f9;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.setup-review-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
}

.setup-review-card p {
  color: var(--muted);
  line-height: 1.45;
}

.config-lists label {
  display: grid;
  gap: 7px;
}

.config-lists label span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-form label {
  display: grid;
  gap: 7px;
}

.user-form label span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-list {
  display: grid;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 110px 100px 150px auto auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border-top: 1px solid var(--soft-line);
}

.user-row:first-child {
  border-top: 0;
}

.user-row span,
.user-row em {
  color: var(--muted);
  font-style: normal;
}

.mini-action {
  min-height: 34px;
  padding: 0 10px;
  color: #33414e;
  background: #fff;
  border: 1px solid #cfd8df;
  border-radius: 6px;
  font-weight: 800;
}

.mini-action.danger {
  color: #b63d3d;
}

.audit-list {
  display: grid;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.audit-row {
  display: grid;
  grid-template-columns: 170px minmax(130px, 0.8fr) minmax(130px, 0.8fr) 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border-top: 1px solid var(--soft-line);
}

.audit-row:first-child {
  border-top: 0;
}

.audit-row strong {
  color: #263541;
}

.audit-row span,
.audit-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.audit-meta {
  overflow-wrap: anywhere;
}

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

.backup-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 110px auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--soft-line);
}

.backup-row:first-child {
  border-top: 0;
}

.backup-row span,
.backup-row em {
  color: var(--muted);
  font-style: normal;
}

.incident-table {
  display: grid;
  padding: 0 14px 14px;
}

.incident-head,
.incident-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 120px 100px 100px 120px minmax(180px, 1.3fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 0 10px;
}

.incident-head {
  min-height: 42px;
  margin-top: 14px;
  color: #33414e;
  background: #f3f5f7;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.incident-row {
  border-bottom: 1px solid var(--soft-line);
}

.incident-row span,
.incident-row em {
  color: var(--muted);
  font-style: normal;
}

.notes-directory {
  display: grid;
  padding: 0 22px 22px;
}

.note-directory-row {
  display: grid;
  grid-template-columns: 150px 160px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--soft-line);
}

.note-directory-row span {
  color: var(--muted);
}

.note-directory-row p {
  color: #3f4d58;
  line-height: 1.45;
}

.admin-card h3 {
  margin: 0;
  font-size: 15px;
  text-transform: uppercase;
}

.admin-card p {
  color: var(--muted);
  line-height: 1.45;
}

.file-control {
  display: grid;
  gap: 9px;
}

.file-control span {
  color: #33414e;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.file-control input {
  height: auto;
  padding: 10px;
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

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

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: 12px;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar,
  .metric-grid,
  .ops-column,
  .command-center {
    grid-template-columns: 1fr;
  }

  .page-title {
    align-items: start;
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-title > button:first-of-type {
    margin-left: 0;
  }

  .dashboard-grid {
    padding: 0 16px 20px;
  }

  .command-center {
    padding: 0 16px 16px;
  }

  .detail-drawer {
    margin: 0 16px 20px;
  }

  .profile-panel {
    margin: 0 16px 20px;
  }

  .onboarding-view {
    margin: 16px;
  }

  .section-view {
    margin: 0 16px 20px;
  }

  .section-toolbar,
  .directory-head,
  .directory-row,
  .bed-summary-grid {
    grid-template-columns: 1fr;
  }

  .reports-view {
    margin: 0 16px 20px;
  }

  .admin-tools {
    margin: 0 16px 20px;
  }

  .reports-grid,
  .report-kpis,
  .admin-grid,
  .user-form,
  .setup-form,
  .setup-step-panel[data-setup-panel="defaults"],
  .setup-room-row,
  .config-lists,
  .setup-review,
  .user-row,
  .audit-row,
  .backup-row {
    grid-template-columns: 1fr;
  }

  .incident-head,
  .incident-row {
    grid-template-columns: 1fr;
  }

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

  .metric-grid {
    padding: 16px;
  }

  .topbar,
  .page-title {
    padding-right: 16px;
    padding-left: 16px;
  }

  .resident-row,
  .table-head.resident {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .modal-actions,
  .modal-summary {
    flex-direction: column;
  }

  .profile-header,
  .profile-actions {
    flex-direction: column;
  }

  .profile-overview-grid,
  .profile-detail-grid,
  .profile-list-row {
    grid-template-columns: 1fr;
  }

  .profile-list-row em {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .nav-list {
    grid-template-columns: 1fr;
  }

  .brand {
    min-height: auto;
  }

  .bed-row,
  .table-head.bed {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .metric-card {
    min-height: 116px;
  }
}
