/* ════════════════════════════════════════════════════════════════
   Dormer UI theme — the dashboard's look, for every screen.

   1. Tokens (--ui-*), available everywhere.
   2. The ui-* component kit: use these classes when (re)building a page.
   3. Legacy bridge: restyles the old shared classes (.button, .pms-table,
      .premium-card, .ds-field, dialogs, …) so untouched markup already
      matches. Scoped under .app-shell so it beats design-system.css.

   Reference implementations: core/templates/core/home.html +
   core/static/core/css/dashboard.css (dashboard), shell.css (nav/top bar).
   ════════════════════════════════════════════════════════════════ */

/* ───────────── 1. Tokens ───────────── */
:root {
  --ui-bg: #f7f8fc;
  --ui-surface: #ffffff;
  --ui-sunken: #f6f7fb;
  --ui-border: #e7e9f0;
  --ui-border-strong: #cfd4e0;
  --ui-hairline: #eff1f6;
  --ui-text: #0f172a;
  --ui-text-2: #475569;
  --ui-muted: #8a94a6;
  --ui-primary: #0b0f8a;
  --ui-primary-soft: #eef0ff;
  --ui-focus-ring: 0 0 0 3px #eef0ff;
  --ui-good: #15803d;
  --ui-good-bg: #e9f7ef;
  --ui-warn: #b45309;
  --ui-warn-bg: #fff5e6;
  --ui-bad: #b91c1c;
  --ui-bad-bg: #fdecec;
  --ui-info: #1d4ed8;
  --ui-info-bg: #eaf1ff;
  /* chart / categorical colours — same validated order as the dashboard */
  --ui-series-1: #2a78d6;
  --ui-series-2: #eb6834;
  --ui-series-3: #1baf7a;
  --ui-series-4: #eda100;
  --ui-series-5: #e87ba4;
  --ui-radius: 14px;
  --ui-radius-sm: 10px;
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --ui-shadow-pop: 0 20px 48px rgba(15, 23, 42, .18);
}

/* ───────────── 2. Component kit (ui-*) ───────────── */
.ui-page { display: grid; gap: 20px; color: var(--ui-text); font-variant-numeric: tabular-nums; }
.ui-page :where(h1, h2, h3, h4, p) { margin: 0; }

/* Page header */
.ui-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.ui-eyebrow { margin-bottom: 6px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ui-page-head h1 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.ui-page-head p.ui-sub, .ui-sub { margin-top: 4px; color: var(--ui-text-2); font-size: 14px; }
.ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ui-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--ui-muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.ui-back:hover { color: var(--ui-text); }

/* Buttons */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; margin: 0;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-text);
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, filter .15s;
}
.ui-btn:hover { border-color: var(--ui-border-strong); background: var(--ui-sunken); }
.ui-btn:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); border-color: var(--ui-primary); }
.ui-btn:disabled, .ui-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.ui-btn .lucide { width: 16px; height: 16px; }
.ui-btn.primary { border-color: var(--ui-primary); background: var(--ui-primary); color: #fff; }
.ui-btn.primary:hover { filter: brightness(1.15); background: var(--ui-primary); }
.ui-btn.danger { border-color: #f3c4c4; background: var(--ui-surface); color: var(--ui-bad); }
.ui-btn.danger:hover { background: var(--ui-bad-bg); }
.ui-btn.danger.solid { border-color: var(--ui-bad); background: var(--ui-bad); color: #fff; }
.ui-btn.subtle { border-color: transparent; background: transparent; color: var(--ui-text-2); }
.ui-btn.subtle:hover { background: var(--ui-sunken); color: var(--ui-text); }
.ui-btn.sm { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.ui-btn.lg { height: 44px; padding: 0 18px; font-size: 14px; }
.ui-btn.block { width: 100%; }
.ui-icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-surface); color: var(--ui-text-2); cursor: pointer;
}
.ui-icon-btn:hover { background: var(--ui-sunken); color: var(--ui-text); }
.ui-icon-btn .lucide { width: 16px; height: 16px; }

/* Cards */
.ui-card {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 18px 20px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  background: var(--ui-surface); box-shadow: var(--ui-shadow);
}
.ui-card.flush { padding: 0; gap: 0; overflow: hidden; }
.ui-card.flush > .ui-card-head { padding: 16px 20px; border-bottom: 1px solid var(--ui-hairline); }
.ui-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ui-card-head h2, .ui-card-head h3 { color: var(--ui-text); font-size: 15px; font-weight: 700; }
.ui-card-head p { margin-top: 2px; color: var(--ui-muted); font-size: 12px; }
.ui-card-head a:not(.ui-btn) { display: inline-flex; align-items: center; gap: 4px; color: var(--ui-primary); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.ui-section-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }

/* Layout helpers */
.ui-grid { display: grid; gap: 16px; }
.ui-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ui-grid.main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.ui-span-2 { grid-column: span 2; }
.ui-span-all { grid-column: 1 / -1; }
.ui-stack { display: grid; gap: 12px; }
.ui-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ui-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui-divider { height: 1px; margin: 4px 0; border: 0; background: var(--ui-hairline); }

/* KPI strip (joined tiles, like the dashboard) and standalone stat tiles */
.ui-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  background: var(--ui-surface); box-shadow: var(--ui-shadow); overflow: hidden;
}
.ui-kpi { display: grid; gap: 6px; min-width: 0; padding: 16px 18px; border-left: 1px solid var(--ui-hairline); color: inherit; text-decoration: none; }
.ui-kpi:first-child { border-left: 0; }
a.ui-kpi:hover { background: #fafbfe; }
.ui-kpi-label { display: flex; align-items: center; gap: 6px; color: var(--ui-text-2); font-size: 12px; font-weight: 700; }
.ui-kpi-label .lucide { width: 14px; height: 14px; color: var(--ui-muted); }
.ui-kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.ui-kpi-value small { margin-left: 4px; color: var(--ui-muted); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.ui-kpi-sub { color: var(--ui-muted); font-size: 12px; font-weight: 600; }

/* Tags / status pills (always pair colour with text) */
.ui-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  background: var(--ui-sunken); color: var(--ui-text-2); font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.ui-tag .lucide { width: 12px; height: 12px; }
.ui-tag.good { background: var(--ui-good-bg); color: var(--ui-good); }
.ui-tag.warn { background: var(--ui-warn-bg); color: var(--ui-warn); }
.ui-tag.bad { background: var(--ui-bad-bg); color: var(--ui-bad); }
.ui-tag.info { background: var(--ui-info-bg); color: var(--ui-info); }
.ui-tag.primary { background: var(--ui-primary-soft); color: var(--ui-primary); }
.ui-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }

/* Alerts / callouts */
.ui-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-sunken); color: var(--ui-text-2); font-size: 13px; }
.ui-alert .lucide { width: 16px; height: 16px; margin-top: 1px; }
.ui-alert.good { border-color: #c8ecd6; background: var(--ui-good-bg); color: #14532d; }
.ui-alert.warn { border-color: #fde3b5; background: var(--ui-warn-bg); color: #7c3f05; }
.ui-alert.bad { border-color: #f8caca; background: var(--ui-bad-bg); color: #8f1515; }
.ui-alert.info { border-color: #cddcff; background: var(--ui-info-bg); color: #1e3a8a; }

/* Tables */
.ui-table-wrap { overflow-x: auto; }
.ui-card > .ui-table-wrap { margin: 0 -20px; }
.ui-card.flush > .ui-table-wrap { margin: 0; }
.ui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ui-table th {
  padding: 10px 12px; border-bottom: 1px solid var(--ui-border); background: #fafbfd;
  color: var(--ui-muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-align: left; text-transform: uppercase; white-space: nowrap;
}
.ui-table td { padding: 12px; border-bottom: 1px solid var(--ui-hairline); color: var(--ui-text); vertical-align: middle; }
.ui-table th:first-child, .ui-table td:first-child { padding-left: 20px; }
.ui-table th:last-child, .ui-table td:last-child { padding-right: 20px; }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover { background: #fafbfe; }
.ui-table .num { text-align: right; font-weight: 700; }
.ui-table .muted, .ui-muted { color: var(--ui-muted); }
.ui-table .row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.ui-cell-title { display: block; font-weight: 700; }
.ui-cell-sub { display: block; margin-top: 2px; color: var(--ui-muted); font-size: 12px; }

/* Forms */
.ui-form { display: grid; gap: 16px; }
.ui-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.ui-form-grid .full { grid-column: 1 / -1; }
.ui-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.ui-field > label, .ui-label { color: var(--ui-text-2); font-size: 12.5px; font-weight: 700; }
.ui-help { color: var(--ui-muted); font-size: 12px; }
.ui-error { color: var(--ui-bad); font-size: 12px; font-weight: 600; }
.ui-input,
.ui-field :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea) {
  width: 100%; min-height: 40px; padding: 8px 12px; margin: 0;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 14px;
  box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.ui-field :where(textarea) { min-height: 90px; resize: vertical; }
.ui-input:hover, .ui-field :where(input, select, textarea):hover { border-color: var(--ui-border-strong); }
.ui-input:focus, .ui-field :where(input, select, textarea):focus { outline: none; border-color: var(--ui-primary); box-shadow: var(--ui-focus-ring); }
.ui-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.ui-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ui-check input { width: 16px; height: 16px; accent-color: var(--ui-primary); }

/* Search / filter bar (one row, above the content it filters) */
.ui-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ui-search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 200px; }
.ui-search .lucide { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--ui-muted); pointer-events: none; }
.ui-search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); font: inherit; font-size: 13.5px; }
.ui-search input:focus { outline: none; border-color: var(--ui-primary); box-shadow: var(--ui-focus-ring); }
.ui-toolbar select, .ui-toolbar input[type="date"] { height: 38px; padding: 0 10px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 13px; }

/* Tabs (segmented) */
.ui-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--ui-radius-sm); background: #eceef4; }
.ui-tabs a, .ui-tabs button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ui-text-2); font: inherit; font-size: 12.5px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.ui-tabs a:hover, .ui-tabs button:hover { color: var(--ui-text); }
.ui-tabs .active, .ui-tabs [aria-current="page"], .ui-tabs [aria-selected="true"], .ui-tabs [aria-pressed="true"] { background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* Lists */
.ui-list { display: grid; }
.ui-list-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ui-hairline); color: inherit; text-decoration: none; }
.ui-list-row:last-child { border-bottom: 0; }
a.ui-list-row:hover { background: #fafbfe; }
.ui-avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 800; object-fit: cover; }
.ui-avatar.round { border-radius: 50%; }
.ui-avatar.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 20px; }

/* Key/value detail list */
.ui-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 20px; margin: 0; }
.ui-dl dt { color: var(--ui-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ui-dl dd { margin: 3px 0 0; color: var(--ui-text); font-size: 14px; font-weight: 600; }

/* Empty state */
.ui-empty { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; color: var(--ui-muted); font-size: 13px; text-align: center; }
.ui-empty .lucide { width: 28px; height: 28px; color: #c3c9d6; }
.ui-empty strong { color: var(--ui-text); font-size: 14px; }

/* Modals: native <dialog class="ui-modal"> with .ui-modal-head / -body / -foot */
dialog.ui-modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--ui-border); border-radius: 16px; background: var(--ui-surface); color: var(--ui-text);
  box-shadow: var(--ui-shadow-pop); overflow: auto;
}
dialog.ui-modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.ui-modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.ui-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.ui-modal-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.ui-modal-head p { margin: 4px 0 0; color: var(--ui-muted); font-size: 13px; }
.ui-modal-body { display: grid; gap: 14px; padding: 4px 20px 16px; }
.ui-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--ui-hairline); background: #fafbfd; }

@media (max-width: 1100px) {
  .ui-grid.cols-3, .ui-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-grid.main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .ui-grid.cols-2, .ui-grid.cols-3, .ui-grid.cols-4, .ui-form-grid { grid-template-columns: minmax(0, 1fr); }
  .ui-span-2 { grid-column: auto; }
  .ui-card { padding: 16px; }
  .ui-card > .ui-table-wrap { margin: 0 -16px; }
  .ui-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-kpi:nth-child(odd) { border-left: 0; }
  .ui-kpi:nth-child(n + 3) { border-top: 1px solid var(--ui-hairline); }
}

/* ───────────── 3. Legacy bridge ───────────── */
.app-shell { background: var(--ui-bg); }
.app-shell .content { color: var(--ui-text); }

/* Page headers */
.app-shell .screen-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; padding: 0; border: 0; background: none; box-shadow: none; }
.app-shell .screen-header h1 { margin: 0; color: var(--ui-text); font-size: clamp(22px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.02em; }
.app-shell .screen-header p { margin: 4px 0 0; color: var(--ui-text-2); font-size: 14px; }
.app-shell .section-kicker { margin: 0 0 6px; color: var(--ui-muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.app-shell .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Buttons */
.app-shell .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; height: auto;
  padding: 0 14px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-text); box-shadow: none;
  font-size: 13px; font-weight: 700; text-decoration: none; transition: background .15s, border-color .15s, filter .15s;
}
.app-shell .button:hover { border-color: var(--ui-border-strong); background: var(--ui-sunken); transform: none; }
.app-shell .button:focus-visible { outline: none; box-shadow: var(--ui-focus-ring); border-color: var(--ui-primary); }
.app-shell .button .lucide { width: 16px; height: 16px; }
.app-shell .button.primary { border-color: var(--ui-primary); background: var(--ui-primary); color: #fff; }
.app-shell .button.primary:hover { filter: brightness(1.15); background: var(--ui-primary); }
.app-shell .button.ghost { background: var(--ui-surface); color: var(--ui-text); }
.app-shell .button.compact { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.app-shell .button.danger, .app-shell .danger-button { border-color: #f3c4c4; background: var(--ui-surface); color: var(--ui-bad); }
.app-shell .button.danger:hover, .app-shell .danger-button:hover { background: var(--ui-bad-bg); }
.app-shell .review-button, .app-shell .action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 0 10px;
  border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface); color: var(--ui-text);
  font-size: 12px; font-weight: 700; text-decoration: none; box-shadow: none;
}
.app-shell .review-button:hover, .app-shell .action-btn:hover { border-color: var(--ui-primary); color: var(--ui-primary); background: var(--ui-surface); }

/* Cards / panels */
.app-shell :is(.premium-card, .panel, .ops-card, .form-section-card, .form-card-narrow, .guest-ledger-card) {
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow);
}
.app-shell :is(.panel-head, .card-head, .ops-card-head) h2,
.app-shell :is(.panel-head, .card-head, .ops-card-head) h3 { color: var(--ui-text); font-size: 15px; font-weight: 700; }
.app-shell :is(.kpi-card, .stat-tile) { border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow); }
.app-shell .stat-label { color: var(--ui-text-2); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.app-shell .stat-value { color: var(--ui-text); font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.app-shell .stat-sub { color: var(--ui-muted); font-size: 12px; font-weight: 600; }

/* Tables */
.app-shell .pms-table-wrap { border: 0; border-radius: 0; box-shadow: none; overflow-x: auto; }
.app-shell .pms-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.app-shell .pms-table th {
  padding: 10px 12px; border-bottom: 1px solid var(--ui-border); background: #fafbfd;
  color: var(--ui-muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.app-shell .pms-table td { padding: 12px; border-bottom: 1px solid var(--ui-hairline); color: var(--ui-text); }
.app-shell .pms-table tbody tr:hover { background: #fafbfe; }
.app-shell .pms-table tbody tr:last-child td { border-bottom: 0; }
.app-shell .number-cell { text-align: right; font-weight: 700; }

/* Status pills */
.app-shell :is(.status-badge, .pill) {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 0; border-radius: 999px;
  background: var(--ui-sunken); color: var(--ui-text-2); font-size: 11px; font-weight: 700; white-space: nowrap;
}
.app-shell :is(.status-badge, .pill):is(.good, .good-status, .tone-success) { background: var(--ui-good-bg); color: var(--ui-good); }
.app-shell :is(.status-badge, .pill):is(.warn, .warning, .tone-warning) { background: var(--ui-warn-bg); color: var(--ui-warn); }
.app-shell :is(.status-badge, .pill):is(.danger, .danger-status, .bad, .tone-danger) { background: var(--ui-bad-bg); color: var(--ui-bad); }

/* Forms */
.app-shell .ds-form { display: grid; gap: 16px; }
.app-shell .ds-field { display: grid; gap: 6px; }
.app-shell .ds-field > label { color: var(--ui-text-2); font-size: 12.5px; font-weight: 700; }
.app-shell .content :where(.ds-field, .ds-form) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="color"]), select, textarea) {
  min-height: 40px; padding: 8px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-text); font-size: 14px; box-shadow: none;
}
.app-shell .content :where(.ds-field, .ds-form) :where(input, select, textarea):focus { outline: none; border-color: var(--ui-primary); box-shadow: var(--ui-focus-ring); }
.app-shell .ds-field-help { color: var(--ui-muted); font-size: 12px; }
.app-shell .ds-field-error { color: var(--ui-bad); font-size: 12px; font-weight: 600; }

/* Empty states */
.app-shell :is(.empty, .ops-empty, .command-empty) { color: var(--ui-muted); font-size: 13px; }

/* Pagination */
.app-shell .pagination a, .app-shell .pagination span { border-radius: 8px; }

/* Dialogs: every pop-up, including the shared confirm dialog from app.js */
.app-shell dialog:not(.ui-modal),
dialog.ds-confirm-modal,
.app-shell .pms-modal {
  border: 1px solid var(--ui-border); border-radius: 16px; background: var(--ui-surface); color: var(--ui-text); box-shadow: var(--ui-shadow-pop);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
dialog.ds-confirm-modal { width: min(420px, calc(100vw - 32px)); padding: 20px; }
dialog.ds-confirm-modal p { margin: 0 0 16px; color: var(--ui-text); font-size: 14px; line-height: 1.5; }
dialog.ds-confirm-modal .ds-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
dialog.ds-confirm-modal .button {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--ui-border);
  border-radius: 10px; background: #fff; color: var(--ui-text); font-size: 13px; font-weight: 700; cursor: pointer;
}
dialog.ds-confirm-modal .button.primary { border-color: var(--ui-primary); background: var(--ui-primary); color: #fff; }

/* Toasts */
.ds-toast { border-radius: 12px; box-shadow: var(--ui-shadow-pop); }

/* ───────────── 4. Shared additions (from the page redesigns) ───────────── */

/* Dropdown menu: .ui-menu for new markup; also restyles the legacy
   .action-dropdown-menu (its open/fixed-position JS is unchanged). */
.ui-menu,
.app-shell .action-dropdown-menu {
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
}
.ui-menu :is(a, button),
.app-shell .action-dropdown-menu :is(a, form button) {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ui-menu :is(a, button):hover,
.app-shell .action-dropdown-menu :is(a, form button):hover { background: var(--ui-sunken); }
.ui-menu .lucide,
.app-shell .action-dropdown-menu .lucide { width: 16px; height: 16px; color: var(--ui-muted); }
.ui-menu .danger { color: var(--ui-bad); }

/* Tabs stay on one line and scroll sideways on narrow screens. */
@media (max-width: 720px) {
  .ui-tabs { display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ui-tabs::-webkit-scrollbar { display: none; }
}

/* app.css sets a global heavy label weight; keep kit labels consistent everywhere. */
body .ui-field > label,
body .ui-label { font-weight: 700; color: var(--ui-text-2); }

/* Print: show content, not controls. */
@media print {
  .ui-btn, .ui-icon-btn, .ui-actions, .ui-toolbar, .ui-tabs, .ui-menu, .ui-back,
  .app-shell .sn, .app-shell .tb { display: none !important; }
  .ui-card, .ui-kpis { box-shadow: none; }
}

/* Single-form pages (add/edit forms): centre the header and the form card as
   one column instead of leaving a narrow card pinned to the left. Pages that
   also show a full-width table card (e.g. the import preview) are excluded. */
.ui-page:has(> :is(.pg-form-card, .fin-form-card, .ca-form-card, .pg-att-narrow, .pg-inv-narrow)):not(:has(> .ui-card.flush, > section > .ui-card.flush)) {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
}
.ui-page:has(> :is(.pg-form-card, .fin-form-card, .ca-form-card, .pg-att-narrow, .pg-inv-narrow)):not(:has(> .ui-card.flush, > section > .ui-card.flush))
  > :is(.pg-form-card, .fin-form-card, .ca-form-card, .pg-att-narrow, .pg-inv-narrow, .pg-danger-zone, .ui-card) {
  width: 100%;
  max-width: none;
}

/* The legacy .ds-form caps forms at 480px; redesigned forms (.ui-form) fill their card. */
.app-shell .ds-form.ui-form { max-width: none; width: 100%; }

/* Legacy .ds-field labels were uppercase/tracked; kit labels are sentence case. */
.app-shell .ds-field label,
.app-shell .ui-field > label { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 700; color: var(--ui-text-2); }
.app-shell .ds-field label.ui-check { color: var(--ui-text); font-size: 13px; }

/* National / International switch on the check-in details forms */
.guest-type { display: grid; gap: 10px; }
.guest-type-switch { display: inline-flex; justify-self: start; padding: 4px; gap: 4px; border: 1px solid var(--ui-border); border-radius: 999px; background: var(--ui-surface); }
.guest-type-option { position: relative; cursor: pointer; }
.guest-type-option input { position: absolute; opacity: 0; pointer-events: none; }
.guest-type-option span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; border-radius: 999px; color: var(--ui-muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.guest-type-option span svg { width: 15px; height: 15px; }
.guest-type-option input:checked + span { background: var(--ui-primary); color: #fff; }
.guest-type-option input:focus-visible + span { box-shadow: var(--ui-focus-ring); }
.guest-type-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 13px; font-weight: 600; }
.guest-type-note[hidden] { display: none; }
.guest-type-note svg { flex: none; width: 16px; height: 16px; }
.ui-field[hidden], .ci-label[hidden] { display: none; }
