:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #dbe4ef;
  --text: #101828;
  --muted: #667085;
  --sidebar: #111c2d;
  --sidebar-2: #0b1423;
  --teal: #0f8b8d;
  --green: #1f8a43;
  --blue: #1769d2;
  --orange: #d86613;
  --red: #cf2e3f;
  --slate: #34495e;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.3;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 18px 14px;
  color: #eef7ff;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--teal);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.status-box small,
.page-heading p,
.tenant-card small,
.data-table small {
  color: var(--muted);
}

.sidebar .brand small,
.sidebar .status-box small {
  color: #a9b8ca;
}

.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-stack a {
  padding: 10px 12px;
  border-radius: 7px;
  color: #d8e4ef;
}

.nav-stack a:hover,
.nav-stack a:focus {
  background: rgba(15, 139, 141, .25);
  color: #fff;
}

.nav-label {
  margin: 12px 10px 4px;
  color: #7e93aa;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
}

.main-shell {
  min-width: 0;
}

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

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

.icon-button,
.user-pill,
.search-box,
input,
select,
textarea,
button,
.action-tile,
.panel,
.tenant-card {
  border-radius: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
}

.topbar-title {
  margin-left: 8px;
  font-weight: 700;
}

.search-box {
  width: min(38vw, 380px);
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.user-pill {
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-weight: 700;
}

.content {
  padding: 20px 22px 32px;
}

.page-heading {
  margin-bottom: 16px;
}

.page-heading.dense {
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--teal);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 1.85rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 800;
}

.quick-grid,
.metric-grid,
.two-column,
.dashboard-grid,
.core-grid,
.builder-grid,
.tenant-grid,
.business-type-grid,
.tenant-context-bar,
.module-tile-grid,
.report-grid {
  display: grid;
  gap: 14px;
}

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

.metric-grid-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.metric-grid-six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
}

.two-column {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  margin-bottom: 14px;
}

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

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

.builder-grid {
  grid-template-columns: 300px minmax(0, 1.5fr) 360px;
  margin-bottom: 14px;
}

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

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

.tenant-context-bar {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tenant-context-bar dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.tenant-context-bar dl div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.business-type-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.panel,
.action-tile,
.tenant-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}

.panel {
  padding: 14px;
}

.panel[id] {
  scroll-margin-top: 74px;
}

.action-tile {
  display: block;
  padding: 18px;
}

.action-tile strong,
.action-tile span {
  display: block;
}

.action-tile span {
  margin-top: 6px;
  color: var(--muted);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-heading a {
  color: var(--blue);
  font-weight: 700;
}

.alert-box {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 800;
}

.alert-box.success {
  border: 1px solid #abefc6;
  background: #ecfdf3;
  color: #067647;
}

.alert-box.error {
  border: 1px solid #fecdca;
  background: #fef3f2;
  color: #b42318;
}

.metric-card {
  min-height: 96px;
  padding: 16px;
  color: #fff;
  overflow: hidden;
  position: relative;
  border-radius: 7px;
  box-shadow: 0 10px 22px rgba(16, 24, 40, .08);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -28px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  position: relative;
  z-index: 1;
  display: block;
}

.metric-card strong {
  margin: 8px 0 2px;
  font-size: 1.85rem;
  line-height: 1;
}

.metric-card small {
  color: rgba(255, 255, 255, .86);
}

.tone-teal { background: var(--teal); }
.tone-green { background: var(--green); }
.tone-blue { background: var(--blue); }
.tone-orange { background: var(--orange); }
.tone-red { background: var(--red); }
.tone-slate { background: var(--slate); }

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

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

label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #cfd8e3;
  background: #fff;
  color: var(--text);
  font-weight: 400;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  grid-column: 1 / -1;
}

button,
.tenant-card footer a,
.btn-link {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  border-color: #c7d7fe;
  color: var(--blue);
}

.btn-primary,
.builder-actions .primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.btn-light {
  background: #f8fafc;
}

.builder-actions .danger {
  border-color: #f4b8c0;
  color: var(--red);
}

.badge-soft,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e6f6f3;
  color: var(--teal);
  font-weight: 800;
}

.badge-soft.warning {
  background: #fff3e8;
  color: var(--orange);
}

.progress-line {
  height: 9px;
  border-radius: 999px;
  background: #e6edf5;
  overflow: hidden;
}

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

.provision-meter {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e6edf5;
}

.provision-meter::-webkit-progress-bar {
  border-radius: 999px;
  background: #e6edf5;
}

.provision-meter::-webkit-progress-value {
  border-radius: 999px;
  background: var(--teal);
}

.provision-meter::-moz-progress-bar {
  border-radius: 999px;
  background: var(--teal);
}

.provision-meter.compact {
  height: 8px;
  min-width: 120px;
}

.provision-meter.large {
  height: 16px;
}

.w-42 { width: 42%; }
.w-68 { width: 68%; }
.w-72 { width: 72%; }

.step-list,
.provision-row {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.step-list li,
.provision-row li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.compact-step-list {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}

.compact-step-list li {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.compact-step-list span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.compact-step-list em {
  font-style: normal;
  font-weight: 800;
  color: var(--teal);
}

.completed strong,
.completed span:last-child {
  color: var(--green);
}

.in-progress strong,
.in-progress span:last-child {
  color: var(--teal);
}

.pending strong,
.pending span:last-child {
  color: var(--muted);
}

.tenant-card,
.business-type-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  transition: transform .16s ease, box-shadow .16s ease;
}

.tenant-card:hover,
.business-type-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(16, 24, 40, .12);
}

.tenant-card header,
.tenant-card footer,
.tenant-card dl,
.business-type-card header,
.business-type-card footer,
.definition-grid,
.quick-actions,
.builder-actions {
  display: flex;
  gap: 8px;
}

.tenant-card footer form {
  margin: 0;
}

.tenant-card header,
.business-type-card header {
  justify-content: space-between;
}

.tenant-card dl,
.definition-grid {
  margin: 0;
}

.tenant-card dt,
.definition-grid dt,
.tenant-context-bar dt {
  color: var(--muted);
  font-size: .8rem;
}

.tenant-card dd,
.definition-grid dd,
.tenant-context-bar dd {
  margin: 0;
  font-weight: 800;
}

.tenant-provision-strip {
  display: grid;
  grid-template-columns: 160px minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #c7ece8;
  border-radius: 7px;
  background: #f0fdfa;
}

.tenant-provision-strip span {
  color: var(--muted);
  font-size: .84rem;
}

.business-type-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}

.business-type-card p {
  min-height: 72px;
  margin-bottom: 0;
  color: var(--muted);
}

.business-type-card footer {
  flex-wrap: wrap;
  margin-top: auto;
}

.chip-group,
.module-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-group span,
.module-strip span,
.matrix-dot {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.chip-group span {
  background: #eef4ff;
  color: #174ea6;
}

.module-strip span {
  background: #effaf8;
  color: var(--teal);
}

.matrix-dot.on {
  background: #eaf8ef;
  color: var(--green);
}

.matrix-dot.off {
  background: #f2f4f7;
  color: var(--muted);
}

.setup-matrix th,
.setup-matrix td {
  white-space: nowrap;
}

.mt-14 {
  margin-top: 14px;
}

.dashboard-grid .span-2 {
  grid-column: span 2;
}

.dashboard-grid .span-3 {
  grid-column: span 3;
}

.builder-grid .span-2 {
  grid-column: span 1;
}

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

.bed-room {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.bed-room span {
  color: var(--muted);
}

.legend {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

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

.legend i:nth-of-type(2) { background: var(--blue); }
.legend i:nth-of-type(3) { background: var(--orange); }
.legend i:nth-of-type(4) { background: var(--slate); }

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

.data-table th,
.data-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table th {
  color: #344054;
  font-size: .84rem;
  text-transform: uppercase;
}

.compact td {
  padding: 8px;
}

.quick-actions {
  flex-wrap: wrap;
}

.quick-actions button,
.quick-actions a {
  flex: 1 1 45%;
  min-height: 70px;
  background: #f8fafc;
}

.quick-actions a {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.builder-actions {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.custom-builder-grid {
  grid-template-columns: 320px minmax(0, 1.4fr) 360px;
}

.module-list,
.module-work-grid {
  display: grid;
  gap: 10px;
}

.module-list-item {
  display: block;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.module-list-item.active,
.module-list-item:hover {
  border-color: #8bd8cf;
  background: #effaf8;
}

.module-list-item strong,
.module-list-item small {
  display: block;
}

.module-list-item small {
  margin-top: 3px;
  color: var(--muted);
}

.module-work-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.compact-checks {
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.compact-checks strong {
  margin-bottom: 2px;
}

.inline-check {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.provision-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(10, 20, 35, .38);
}

.provision-overlay.is-open {
  display: grid;
}

.provision-dialog {
  width: min(720px, 100%);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .24);
}

.provision-dialog .panel-heading {
  margin-bottom: 14px;
}

.provision-dialog .panel-heading span {
  color: var(--teal);
  font-size: 1.25rem;
  font-weight: 900;
}

.check-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.check-list label,
.module-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-list input,
.module-picker input {
  width: auto;
  min-height: auto;
}

.module-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.module-picker > strong {
  grid-column: 1 / -1;
}

.compact-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  border: 0;
  background: transparent;
}

.tenant-control-card {
  align-content: start;
}

.tenant-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tenant-profile-grid div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.tenant-profile-grid dd {
  overflow-wrap: anywhere;
}

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

.mini-form {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.module-form {
  grid-column: 1 / -1;
}

.inline-form {
  display: inline;
}

.inline-form button {
  padding: 6px 9px;
}

.module-tile-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.module-index {
  position: sticky;
  top: 58px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 18px rgba(16, 24, 40, .06);
}

.module-index a {
  padding: 7px 10px;
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  color: var(--blue);
  font-weight: 800;
}

.module-tile {
  min-width: 0;
  padding: 10px;
  border: 1px solid #b8e3da;
  border-radius: 8px;
  background: #effaf8;
}

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

.module-tile strong,
.module-tile small {
  display: block;
}

.module-tile small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.database-preview {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #b8e3da;
  border-radius: 7px;
  background: #effaf8;
}

.provision-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.provision-row li {
  display: grid;
}

@media (max-width: 1200px) {
  .metric-grid-five,
  .metric-grid-six,
  .tenant-grid,
  .tenant-control-grid,
  .business-type-grid,
  .module-tile-grid,
  .report-grid,
  .bed-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tenant-control-grid,
  .tenant-operations,
  .tenant-provision-strip,
  .compact-step-list li,
  .tenant-context-bar,
  .tenant-context-bar dl {
    grid-template-columns: 1fr;
  }

  .builder-grid,
  .custom-builder-grid,
  .module-work-grid,
  .two-column,
  .dashboard-grid,
  .core-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid .span-2,
  .dashboard-grid .span-3,
  .core-grid .span-2,
  .core-grid .span-3 {
    grid-column: auto;
  }
}

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

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

  .topbar,
  .topbar-actions,
  .form-grid,
  .quick-grid,
  .metric-grid-five,
  .metric-grid-six,
  .tenant-grid,
  .tenant-control-grid,
  .tenant-profile-grid,
  .tenant-operations,
  .tenant-context-bar,
  .tenant-context-bar dl,
  .module-tile-grid,
  .report-grid,
  .module-picker,
  .compact-picker,
  .business-type-grid,
  .bed-grid,
  .provision-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .search-box {
    width: 100%;
  }
}
