:root {
  --red: #ad2d2d;
  --ink: #1e293b;
  --muted: #7b8494;
  --line: #edf0f4;
  --bg: #f7f5f2;
  --card: #ffffff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
  color: var(--ink);
  background: radial-gradient(circle at 60% 8%, #f7e8e2 0, transparent 30%), var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.admin-login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f4f3f1;
}
.admin-login-panel {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid #e7e3df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(31,41,55,.12);
}
.admin-login-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.admin-login-heading h1 { font-size: 28px; }
.admin-login-heading p { margin-top: 8px; font-size: 14px; }
.admin-login-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}
.admin-login-form label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
}
.admin-login-form input,
.admin-login-form select,
.admin-demo-login select {
  width: 100%;
  height: 48px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  outline: none;
}
.admin-login-form input:focus,
.admin-login-form select:focus,
.admin-demo-login select:focus {
  border-color: #c98282;
  box-shadow: 0 0 0 3px rgba(173,45,45,.08);
}
.admin-login-form button { min-height: 48px; }
.admin-test-account-picker {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.admin-test-account-picker select {
  border-color: #ead1d1;
  background: #fff8f6;
  color: #8f2424;
  font-weight: 900;
}
.admin-test-account-picker small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.admin-login-status {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.admin-demo-login {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.admin-demo-login > span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.admin-demo-login > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.admin-demo-login button { white-space: nowrap; }
.sidebar {
  min-height: 100vh;
  padding: 28px 22px;
  background: rgba(255,255,255,.82);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.brand strong { display: block; font-size: 24px; }
.brand span, .admin-card span, p, small { color: var(--muted); }
nav { display: grid; gap: 16px; padding-top: 28px; }
nav a {
  position: relative; padding: 14px 16px; border-radius: 8px; color: #4b5563;
  font-weight: 700;
  cursor: pointer;
}
nav a.has-release-tag { padding-right: 62px; }
nav a.active { color: var(--red); background: #fff7f5; box-shadow: inset 4px 0 0 var(--red); }
nav b { float: right; background: #e95757; color: white; border-radius: 8px; padding: 2px 8px; }
nav .release-phase-tag {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}
nav small { margin-top: 10px; font-weight: 800; }
.admin-card {
  margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 14px;
  background: white; border-radius: 8px; box-shadow: 0 18px 48px rgba(31,41,55,.08);
}
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #e6edf8; display: grid; place-items: center; font-weight: 800; }
main { padding: 30px 34px 56px; }
.topbar {
  height: 88px; padding: 20px 28px; border-radius: 8px; background: rgba(255,255,255,.88);
  display: flex; align-items: center; justify-content: space-between; box-shadow: 0 20px 60px rgba(31,41,55,.07);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.environment-badge {
  padding: 4px 8px;
  border: 1px solid #e7b8b3;
  border-radius: 6px;
  background: #fff4f2;
  color: #9e2f2f;
  font-size: 12px;
  font-weight: 800;
}
.admin-logout { white-space: nowrap; }
.admin-switch {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.admin-switch select {
  min-width: 180px;
  height: 42px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.toast {
  position: fixed;
  right: 34px;
  top: 30px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 68px));
  padding: 14px 18px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 18px 44px rgba(31,41,55,.2);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.success { background: #1f7a4d; }
.toast.error { background: #ad2d2d; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { margin: 0 0 18px; font-size: 17px; }
.global-search {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 10px;
  align-items: center;
}
.global-search input {
  height: 46px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  outline: none;
}
.global-search input:focus {
  border-color: #d9a5a5;
  box-shadow: 0 0 0 3px rgba(173,45,45,.08);
}
.global-search button {
  height: 46px;
}
.global-search-results {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 18;
  width: min(620px, calc(100vw - 360px));
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 22px 60px rgba(31,41,55,.16);
}
.global-search-results section + section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.global-search-results h3 {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 13px;
}
.global-result {
  display: grid;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid #f1f3f6;
  border-radius: 8px;
  background: #fbfaf8;
  color: var(--ink);
  text-align: left;
}
.global-result strong {
  margin-bottom: 4px;
  font-size: 15px;
}
.global-result span,
.global-result small {
  color: var(--muted);
  line-height: 1.45;
}
.global-search-empty {
  padding: 12px;
  color: var(--muted);
  font-weight: 800;
}
.dashboard-workspace {
  margin-top: 18px;
  padding: 22px;
}
.dashboard-workspace .section-title {
  margin-bottom: 12px;
}
.dashboard-workspace h2,
.dashboard-workspace p {
  margin: 0;
}
.dashboard-workspace p {
  margin-top: 6px;
}
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 0; }
.metrics article, .metric-card, .chart-card, .approval-card, .table-card {
  background: var(--card); border-radius: 8px; box-shadow: 0 18px 50px rgba(31,41,55,.06);
}
.metrics article, .metric-card {
  min-height: 64px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  text-align: left;
}
.metric-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label note"
    "value note";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: transform .16s ease, box-shadow .16s ease;
}
.metric-card:hover, .metric-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 56px rgba(31,41,55,.1);
  outline: none;
}
.metrics span { grid-area: label; color: var(--muted); font-weight: 800; display: block; font-size: 12px; }
.metrics strong { grid-area: value; font-size: 20px; display: block; line-height: 1.1; }
.metrics em { grid-area: note; display: inline-flex; align-items: center; max-width: 100%; color: #4ca967; background: #eef9f1; border-radius: 8px; padding: 4px 7px; font-style: normal; font-weight: 800; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.dashboard-grid .approval-card {
  padding: 18px;
}
.dashboard-grid .section-title {
  margin-bottom: 12px;
}
.dashboard-grid .section-title h2 {
  font-size: 18px;
}
.dashboard-grid .approval {
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  padding: 10px 0;
}
.dashboard-grid .badge {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.dashboard-grid .approval strong {
  margin-bottom: 3px;
}
.dashboard-grid .approval span {
  line-height: 1.4;
  font-size: 13px;
}
.dashboard-grid button {
  padding: 8px 12px;
}
.dashboard-grid .dashboard-report-form {
  grid-template-columns: minmax(100px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}
.dashboard-grid .dashboard-report-form input,
.dashboard-grid .dashboard-report-form select {
  height: 38px;
}
.dashboard-grid .dashboard-report-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dashboard-grid .dashboard-report-summary div {
  display: grid;
  gap: 4px;
  padding: 8px 0;
}
.dashboard-grid .dashboard-report-range {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.dashboard-work-orders-card {
  margin-top: 16px;
}
.dashboard-work-orders-card .section-title {
  margin-bottom: 14px;
}
.dashboard-work-order-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-work-order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.dashboard-work-order-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.dashboard-work-order-title strong {
  font-size: 14px;
}
.dashboard-work-order-main p {
  margin: 6px 0 4px;
  color: var(--ink);
  font-weight: 900;
}
.dashboard-work-order-main small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}
.dashboard-work-order-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 132px;
}
.dashboard-work-order-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.dashboard-work-order-actions button {
  padding: 7px 10px;
}
.grid { display: grid; grid-template-columns: 1fr; gap: 28px; margin-top: 28px; }
.chart-card, .approval-card, .table-card { padding: 28px; }
.work-order-chart { margin-bottom: 26px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
button { border: 0; border-radius: 8px; background: #f6f7f9; color: #596273; padding: 10px 16px; font-weight: 800; }
button.primary { margin-left: 12px; background: var(--red); color: white; box-shadow: 0 10px 24px rgba(173,45,45,.22); }
button.danger-button { background: #fff3f3; color: #a82b2b; border: 1px solid #f1c7c7; }
.chart { height: 300px; }
.approval { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 18px 0; }
.approval + .approval { border-top: 1px solid var(--line); }
.badge { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #fff0f0; color: var(--red); font-weight: 900; }
.approval strong { display: block; margin-bottom: 6px; }
.approval span { color: var(--muted); line-height: 1.55; }
.exception-alert.high .badge { background: #fff3e6; color: #b45309; }
.dashboard-report-form {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.dashboard-report-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.dashboard-report-form select,
.dashboard-report-form input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
}
.dashboard-report-summary {
  display: grid;
  gap: 10px;
}
.dashboard-report-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: #475569;
  font-weight: 800;
}
.dashboard-report-summary strong {
  color: var(--ink);
}
#management-report-card .dashboard-report-form {
  grid-template-columns: minmax(86px, 1fr) minmax(118px, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}
#management-report-card .dashboard-report-form label {
  gap: 4px;
}
#management-report-card .dashboard-report-form select,
#management-report-card .dashboard-report-form input {
  height: 34px;
}
#management-report-card .dashboard-report-form button {
  height: 34px;
  padding: 7px 10px;
}
#management-report-card .dashboard-report-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 14px;
}
#management-report-card .dashboard-report-summary div {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
#management-report-card .dashboard-report-summary span {
  color: var(--muted);
  font-size: 12px;
}
#management-report-card .dashboard-report-summary strong {
  font-size: 16px;
}
#management-report-card .dashboard-report-range {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.muted-text { color: var(--muted); font-weight: 700; }
.record-note { color: #475569; line-height: 1.55; font-size: 13px; }
.empty-line {
  padding: 18px 0;
  color: var(--muted);
  font-weight: 800;
}
.table-card { margin-top: 28px; }
.sub-panel {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.sub-panel .section-title {
  margin-bottom: 16px;
}
.view { display: none; }
.view.active-view { display: block; }
section.view.active-view { display: block; }
#dashboard-view.active-view { display: block; }
.placeholder-panel { min-height: 240px; }
.placeholder-panel p { margin-top: 12px; line-height: 1.7; max-width: 680px; }
.module-workspace-hub {
  margin: 0 0 24px;
}
.module-workspace-groups {
  display: grid;
  gap: 18px;
}
.module-workspace-group {
  display: grid;
  gap: 10px;
}
.module-workspace-group h3 {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  letter-spacing: 0;
}
.module-workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.module-workspace-card {
  position: relative;
  min-height: 96px;
  padding: 16px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 14px 36px rgba(31,41,55,.05);
  cursor: pointer;
}
.module-workspace-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 900;
}
.module-workspace-card.has-badge span {
  padding-right: 84px;
}
.module-workspace-card small {
  display: block;
  color: #7b8494;
  line-height: 1.45;
  font-weight: 700;
}
.release-phase-tag,
.release-phase-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 8px;
  background: #eef2ff;
  color: #475569;
  padding: 3px 7px;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}
.release-phase-tag.active,
.release-phase-note.active {
  background: #eef9f1;
  color: #258653;
}
.release-phase-tag.implementation,
.release-phase-note.implementation {
  background: #f1f5f9;
  color: #64748b;
}
.release-phase-tag.future,
.release-phase-note.future {
  background: #fff7ed;
  color: #c2410c;
}
.release-phase-tag.internal,
.release-phase-note.internal {
  background: #f5f3ff;
  color: #6d28d9;
}
.module-workspace-card .release-phase-note {
  margin-top: 10px;
}
.module-workspace-card.active {
  border-color: rgba(173,45,45,.34);
  background: #fff7f5;
  box-shadow: inset 4px 0 0 var(--red), 0 16px 42px rgba(173,45,45,.08);
}
.module-workspace-card:disabled {
  opacity: .48;
  cursor: not-allowed;
}
.module-workspace-panel {
  scroll-margin-top: 20px;
}
.module-workspace-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 8px;
  background: #eef2ff;
  color: #475569;
  padding: 4px 7px;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.module-workspace-badge.pending {
  background: #fff7ed;
  color: #c2410c;
}
.module-workspace-badge.danger {
  background: #fff1f2;
  color: #be123c;
}
.module-workspace-badge.done {
  background: #eef9f1;
  color: #258653;
}
.module-panel-hidden,
.module-panel-hidden + .table-pagination {
  display: none !important;
}
.finance-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
.finance-grid article {
  min-width: 0;
  overflow-x: auto;
  scrollbar-gutter: stable;
}
.finance-grid table { min-width: 860px; }
.finance-action-table th:last-child,
.finance-action-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: #fff;
  box-shadow: -10px 0 14px -14px rgba(31, 41, 55, 0.45);
}
.finance-action-table th:last-child { z-index: 2; }
.modal-table-wrap {
  max-height: 420px;
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.modal-table-wrap table { min-width: 760px; }
.note-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
  color: #475569;
  line-height: 1.6;
}
.note-box p { margin: 0 0 6px; }
.note-box p:last-child { margin-bottom: 0; }
.onboarding-readiness {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: #fff;
}
.onboarding-readiness[hidden] { display: none; }
.onboarding-readiness > div { min-width: 0; }
.onboarding-readiness strong,
.onboarding-readiness span { display: block; }
.onboarding-readiness span {
  margin-top: 3px;
  color: #6b7280;
  font-size: 13px;
}
.onboarding-readiness button { flex: 0 0 auto; }
.onboarding-check-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.onboarding-check-item {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(180px, 1fr) minmax(240px, 1.4fr);
  gap: 14px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.onboarding-check-item:last-child { border-bottom: 0; }
.onboarding-check-item b,
.onboarding-check-item span,
.onboarding-check-item small { display: block; }
.onboarding-check-item small {
  margin-top: 4px;
  color: #6b7280;
  line-height: 1.5;
}
.onboarding-check-state {
  color: #b42318;
  font-weight: 900;
}
.onboarding-check-state.ready { color: #258653; }
.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}
.inline-form label {
  display: grid;
  gap: 8px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}
.inline-form input,
.inline-form select,
.inline-form textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.inline-form textarea {
  min-height: 86px;
  resize: vertical;
}
.inline-form select[multiple] {
  min-height: 92px;
  padding: 8px;
}
.inline-form input:focus,
.inline-form select:focus,
.inline-form textarea:focus {
  border-color: #d9a5a5;
  box-shadow: 0 0 0 3px rgba(173,45,45,.08);
}
.inline-form .span-2 { grid-column: span 2; }
.inline-form .span-3 { grid-column: span 3; }
.inline-form .form-hint {
  align-self: end;
  min-height: 42px;
  display: flex;
  align-items: center;
  color: #8b95a5;
  font-size: 13px;
  font-weight: 800;
}
.inline-form .property-lifecycle-hint {
  align-self: center;
  padding: 10px 12px;
  border: 1px solid #dbe6dc;
  border-radius: 8px;
  background: #f4faf5;
  color: #2f6b45;
}
.inline-form .property-lifecycle-hint.lifecycle-warning {
  border-color: #f2dfb6;
  background: #fff9ed;
  color: #8a5a12;
}
.inline-form .property-lifecycle-hint.lifecycle-error {
  border-color: #efc4c4;
  background: #fff4f4;
  color: #a92c2c;
}
.inline-form .advanced-field {
  display: none;
}
.inline-form .scene-hint {
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #f0ded7;
  border-radius: 8px;
  background: #fff7f2;
  color: #8a4b3f;
  line-height: 1.5;
}
.advanced-panel, .ops-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.advanced-panel {
  align-self: stretch;
  padding: 0;
}
.advanced-panel summary, .ops-panel summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 900;
}
.advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  padding: 0 16px 16px;
}
.advanced-grid .span-3 { grid-column: span 3; }
.ops-panel {
  padding: 0;
  background: #fbfaf8;
}
.ops-panel > .inline-form {
  margin: 0 16px 16px;
}
.ops-panel > table, .ops-panel > .mini-stats {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
}
.ops-panel > h3 {
  margin: 0 16px 10px;
}
.compact-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  padding: 14px;
}
.compact-filter {
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
  padding: 12px;
}
.inline-form .checkbox-line {
  align-items: end;
  grid-template-columns: 18px 1fr;
  min-height: 62px;
}
.inline-form .checkbox-line input {
  min-height: auto;
  align-self: center;
}
.inline-form button {
  align-self: end;
  min-height: 42px;
}
.modal-media-uploader {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 2fr);
  gap: 10px 14px;
  padding: 14px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: #fff;
}
.modal-media-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}
.modal-media-actions button {
  flex: 0 0 auto;
}
.modal-media-status {
  color: #7b8493;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.modal-media-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}
.modal-media-list > small {
  color: #98a1af;
}
.modal-media-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 42px 54px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f6f7f9;
}
.modal-media-item span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}
.modal-media-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-media-item a {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}
.modal-media-item button {
  min-height: 32px;
  padding: 4px 8px;
}
.actions-cell {
  min-width: 132px;
  white-space: nowrap;
}
.source-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f7;
  color: #4b5563;
}
.source-pill.owner-message {
  background: #fff4e6;
  color: #b45309;
}
.source-pill.owner-work-order {
  background: #eff6ff;
  color: #2563eb;
}
.source-pill.internal {
  background: #ecfdf5;
  color: #15803d;
}
.source-pill.butler-proxy {
  background: #f5f3ff;
  color: #7c3aed;
}
.source-pill.leader-assigned {
  background: #fef2f2;
  color: #b91c1c;
}
.owner-message-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #f3d3b3;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  background: #fffaf3;
}
.owner-message-panel strong {
  display: block;
  margin-bottom: 4px;
  color: #7c2d12;
}
.owner-message-panel p {
  margin: 0;
  color: #7b8494;
}
.owner-message-panel button {
  flex: 0 0 auto;
  background: #ad2d2d;
  color: white;
}
.fold-panel {
  margin: -10px 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.fold-panel summary {
  cursor: pointer;
  padding: 14px 18px;
  color: var(--ink);
  font-weight: 900;
}
.stack-form {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}
.stack-form label {
  display: grid;
  gap: 8px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}
.stack-form textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: #fbfaf8;
  color: var(--ink);
  padding: 12px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
}
.data-import-file-control {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, auto);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}
.data-import-file-label {
  display: block;
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}
.data-import-file-button {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #d9dde5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
#data-import-file-status {
  min-width: 0;
  padding-bottom: 8px;
  color: #7b8494;
  font-size: 13px;
  overflow-wrap: anywhere;
}
#data-import-file-status.ready { color: #2f7a4d; }
#data-import-file-status.duplicate { color: #a92e2e; }

.data-import-duplicate-alert {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #efc5c5;
  border-left: 3px solid #a92e2e;
  background: #fff7f7;
  color: #842525;
  line-height: 1.6;
}
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 18px 14px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: #7b8494; font-size: 14px; }
.table-card { overflow-x: auto; }
.permission-cell {
  min-width: 360px;
  max-width: 760px;
  white-space: normal;
}
.permission-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 3px 5px 3px 0;
  padding: 4px 10px;
  border: 1px solid #ead9d5;
  border-radius: 8px;
  background: #fff7f5;
  color: #8f2424;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.permission-chip.all {
  border-color: #d7e7dc;
  background: #f0faf3;
  color: #2d7c4f;
}
.permission-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: #fff;
}
.permission-editor label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}
.permission-editor input {
  width: 15px;
  height: 15px;
  accent-color: var(--red);
}
.role-permission-form {
  grid-template-columns: minmax(180px, 240px) minmax(150px, 190px) 1fr auto;
}
.muted-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfaf8;
}
.table-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.table-pagination button {
  min-height: 34px;
  padding: 7px 12px;
}
.table-pagination button[disabled] {
  cursor: not-allowed;
  opacity: .45;
}
.status { font-weight: 900; }
.status.pending { color: #e95656; }
.status.processing { color: #326ce5; }
.status.done { color: #48a766; }
.status.danger { color: #a82b2b; }
.message-page-title p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.message-category-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
}
.message-category-tab {
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--dark);
  text-align: left;
}
.message-category-tab strong,
.message-category-tab span {
  display: block;
}
.message-category-tab strong { margin-bottom: 5px; font-size: 14px; }
.message-category-tab span { color: var(--muted); font-size: 12px; font-weight: 700; }
.message-category-tab.active {
  border-color: #d89191;
  background: #fff7f7;
  box-shadow: inset 4px 0 0 var(--red);
}
.message-ledger-table .message-focus-cell { min-width: 260px; }
.message-focus-cell strong,
.message-focus-cell p,
.message-route-cell strong,
.message-route-cell span,
.message-read-count {
  display: block;
}
.message-focus-cell strong { color: var(--dark); font-size: 14px; }
.message-focus-cell p {
  max-width: 420px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.message-category-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}
.message-category-tag.feedback { background: #fff0f0; color: #b42323; }
.message-category-tag.work-order { background: #edf4ff; color: #2459a9; }
.message-category-tag.billing { background: #fff8e6; color: #946200; }
.message-category-tag.community { background: #eef9f2; color: #287a45; }
.message-ledger-table td > small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}
.message-ledger-row-feedback { background: #fffafa; }
.message-ledger-row-feedback .message-focus-cell { box-shadow: inset 3px 0 0 #c63c3c; }
.message-route-cell strong { color: var(--dark); }
.message-route-cell span,
.message-read-count { margin-top: 5px; color: var(--muted); font-size: 12px; }
.message-time-cell { min-width: 120px; color: #475569; }
.message-row-actions { min-width: 210px; }
.message-detail-panel { width: min(900px, 100%); }
.message-detail-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.message-detail-panel > .message-detail-kicker > span { margin: 0; }
.message-detail-status {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.message-detail-status.active { background: #eef9f2; color: #287a45; }
.message-detail-status.hidden { background: #f1f3f6; color: #64748b; }
.message-content-highlight {
  margin: 18px 0;
  padding: 18px 20px;
  border-left: 4px solid #60728a;
  border-radius: 8px;
  background: #f7f9fc;
}
.message-content-highlight.feedback { border-left-color: var(--red); background: #fff7f7; }
.message-content-highlight b { color: var(--dark); }
.message-content-highlight p {
  margin: 8px 0 0;
  color: #243247;
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
}
.message-feedback-source,
.message-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.message-feedback-source > div,
.message-detail-summary > div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.message-feedback-source b,
.message-feedback-source strong,
.message-detail-summary b,
.message-detail-summary strong { display: block; }
.message-feedback-source b,
.message-detail-summary b { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.message-feedback-source strong,
.message-detail-summary strong { color: var(--dark); overflow-wrap: anywhere; }
.message-maintenance {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}
.message-maintenance summary { cursor: pointer; color: var(--dark); font-weight: 900; }
.message-maintenance > p { margin: 10px 0; color: var(--muted); }
.message-maintenance .message-detail-form { margin-bottom: 0; }
.mini-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.mini-stats div,
.mini-stats article,
.mini-stats .mini-stat-button {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.mini-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}
.mini-stats strong {
  display: block;
  font-size: 22px;
}
.mini-stat-button {
  text-align: left;
  cursor: pointer;
  min-height: 86px;
  color: var(--ink);
  box-shadow: none;
}
.mini-stat-button:hover {
  border-color: #e7b4b4;
  background: #fff8f8;
}
.mini-stat-button.pending strong { color: #e95656; }
.mini-stat-button.done strong { color: #16a34a; }
.metric-grid .mini-stat-button small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}
.mini-stats .wide-stat {
  grid-column: 1 / -1;
}
.mini-stats .wide-stat strong {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
}
.customer-action-panel strong {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.customer-action-panel button {
  border: 1px solid #f0d1d1;
  background: #fff7f7;
  color: var(--red);
  padding: 8px 12px;
  box-shadow: none;
}
.customer-action-list strong {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.customer-action-list button {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
  padding: 12px;
}
.customer-action-list b {
  color: var(--red);
  font-size: 12px;
}
.customer-action-list span {
  color: var(--ink);
  font-size: 14px;
}
.customer-action-list small {
  color: var(--muted);
  font-size: 12px;
}
.work-order-stats {
  grid-template-columns: repeat(8, minmax(104px, 1fr));
  margin: 18px 0;
}
.work-order-stat-button {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
}
.work-order-stat-button:hover {
  border-color: #e6b5b5;
  color: var(--red);
}
.work-order-stat-button.active {
  border-color: var(--red);
  color: var(--red);
  background: #fff7f7;
}
.dispatch-candidate-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin: 4px 0 18px;
}
.dispatch-candidate-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.dispatch-candidate-list article.recommended {
  border-color: #e5b4b4;
  background: #fffafa;
}
.dispatch-candidate-list strong {
  display: block;
  color: var(--dark);
}
.dispatch-candidate-list b {
  display: inline-block;
  margin: 8px 0;
  color: var(--red);
}
.dispatch-candidate-list p,
.dispatch-candidate-list span {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.slim-title {
  margin: 4px 0 10px;
}
.compact-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, .42);
}
.preview-panel {
  width: min(760px, 100%);
  max-height: 86vh;
  overflow: auto;
  position: relative;
  padding: 28px;
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
}
.preview-close {
  position: absolute;
  right: 20px;
  top: 20px;
}
.preview-panel > span {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff0f0;
  color: var(--red);
  font-weight: 900;
}
.preview-panel h2 {
  font-size: 26px;
  margin-bottom: 12px;
}
.preview-panel p {
  margin-bottom: 18px;
  line-height: 1.7;
}
.modal-status {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-weight: 800;
}
.modal-status.error {
  background: #fff1f2;
  color: #be123c;
}
.inline-notice {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid #fde2b8;
  border-radius: 8px;
  background: #fff8ed;
}
.inline-notice strong {
  display: block;
  margin-bottom: 4px;
  color: #9a3412;
}
.inline-notice p {
  margin: 0;
}
.audit-panel {
  width: min(1120px, 100%);
}
.audit-panel h3 {
  margin-bottom: 16px;
  font-size: 22px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}
.detail-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.detail-grid b,
.detail-grid strong {
  display: block;
}
.detail-grid b {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}
.audit-diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.audit-diff-grid section {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}
.audit-diff-grid h4 {
  margin-bottom: 10px;
}
.audit-diff-grid pre {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
}
.customer-panel {
  width: min(980px, 100%);
}
.customer-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.customer-summary-grid div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}
.customer-summary-grid .span-2 {
  grid-column: span 2;
}
.customer-summary-grid b,
.customer-summary-grid strong {
  display: block;
}
.customer-summary-grid b {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}
.customer-timeline {
  display: grid;
  gap: 12px;
}
.customer-timeline article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  white-space: normal;
}
.customer-timeline strong,
.customer-timeline small {
  display: block;
}
.customer-timeline p {
  margin: 8px 0;
}
.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.inline-actions button {
  padding: 8px 12px;
}
.preview-panel article {
  margin-top: 18px;
  color: var(--ink);
  line-height: 1.85;
  white-space: pre-wrap;
}
.preview-panel .customer-timeline article {
  white-space: normal;
}
.preview-panel small {
  display: block;
  margin-top: 18px;
}
.preview-media {
  display: grid;
  gap: 14px;
}
.preview-media figure {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}
.preview-media img,
.preview-media video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
}
.preview-media audio {
  width: 100%;
}
.preview-media figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  word-break: break-all;
}
.preview-empty,
.preview-text-media {
  padding: 16px;
  border-radius: 8px;
  background: #f6f7f9;
  color: var(--muted);
  font-weight: 800;
}
.dictionary-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 0;
  background: transparent;
}
.dictionary-edit-form > span,
.dictionary-edit-form > h2,
.dictionary-edit-form > p,
.dictionary-edit-form > button {
  grid-column: 1 / -1;
}
.dictionary-edit-form > span {
  color: var(--red);
  font-weight: 900;
}
.dictionary-edit-form > h2,
.dictionary-edit-form > p {
  margin: 0;
}
.dictionary-edit-form > button {
  justify-self: start;
  min-width: 140px;
}
@media (max-width: 1100px) {
  body { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-work-order-list { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .dashboard-report-form { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .onboarding-readiness { align-items: flex-start; }
  .data-import-file-control { grid-template-columns: 1fr; }
  .onboarding-check-item { grid-template-columns: 1fr; gap: 5px; }
  .sales-ranking article { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-ranking article > strong { grid-column: 1 / -1; }
  .inline-form .span-2, .inline-form .span-3 { grid-column: auto; }
  .topbar { height: auto; gap: 18px; align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .global-search { grid-template-columns: 1fr auto; width: 100%; }
  .global-search-results { left: 0; right: auto; width: 100%; }
}
@media (min-width: 1101px) and (max-width: 1500px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-ranking article { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sales-ranking article > strong { grid-column: 1 / -1; }
  main { overflow-x: hidden; }
}
@media (max-width: 700px) {
  .metrics { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-work-order-item { grid-template-columns: 1fr; }
  .dashboard-work-order-meta { justify-items: start; }
  .dashboard-work-order-actions { justify-content: flex-start; }
  .modal-media-uploader { grid-template-columns: 1fr; }
  .modal-media-actions { align-items: stretch; flex-direction: column; }
  .modal-media-list { grid-column: auto; }
  .message-feedback-source,
  .message-detail-summary { grid-template-columns: 1fr; }
}
