/* Bayt AlKhaleej Stitch V1 — local-only RTL design layer. */
:root {
  --canvas: #fdf9f3;
  --surface: #ffffff;
  --surface-low: #f7f3ed;
  --surface-mid: #f1ede7;
  --surface-high: #ebe8e2;
  --ink: #1e1e22;
  --ink-soft: #54535a;
  --stone: #e2d9cc;
  --gold: #c2a268;
  --gold-deep: #745a28;
  --emerald: #1f5944;
  --emerald-soft: #edf5f1;
  --blue: #2b4c7e;
  --blue-soft: #eef4fc;
  --terracotta: #a84d38;
  --terracotta-soft: #faf0ed;
  --bronze: #8c6b1f;
  --bronze-soft: #fdf8eb;
  --muted: #73737c;
  --shadow-1: 0 2px 8px -2px rgba(30, 30, 34, .06);
  --shadow-2: 0 12px 32px -16px rgba(30, 30, 34, .2);
  --rail: 280px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); }
body { margin: 0; overflow-x: hidden; background: var(--canvas); color: var(--ink); font-family: "Segoe UI", Tahoma, Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { min-height: 40px; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 0;
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(194, 162, 104, .18) !important;
}
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.demo-banner {
  display: none !important;
}
#app { min-height: 100vh; }
.topbar {
  position: fixed; z-index: 100; top: 0; right: 0; left: 0; width: 100%; height: 80px;
  display: flex; align-items: center; gap: 18px; padding: 0 0 0 24px;
  background: rgba(253, 249, 243, .96); border-bottom: 1px solid rgba(226, 217, 204, .85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-1);
}
.topbar .brand {
  position: relative; width: var(--rail); height: 80px; z-index: 105; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: var(--surface-low); border-left: 1px solid var(--stone); border-bottom: 0;
}
.brand img {
  width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: var(--ink); padding: 5px;
  border: 1px solid var(--stone); box-shadow: 0 1px 3px rgba(30, 30, 34, .08); flex-shrink: 0;
}
.brand strong { display: block; color: var(--ink) !important; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.25; }
.brand span { display: block; margin-top: 2px; color: var(--ink-soft) !important; font-size: 11px; }
.global-search { flex: 0 1 420px; position: relative; }
.global-search > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.global-search input { width: 100%; height: 44px; padding: 0 56px 0 14px; border: 1px solid var(--stone); border-radius: 9px; background: var(--surface-low); color: var(--ink) !important; }
.global-search input::placeholder { color: var(--muted); opacity: 1; }
.local-runtime { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; padding: 7px 12px; background: var(--surface); border: 1px solid var(--stone); border-radius: 8px; }
.local-runtime b, .local-runtime span { display: block; }
.local-runtime b { font-size: 12px; }
.local-runtime span { color: var(--ink-soft); font-size: 10px; }
.runtime-dot { width: 8px; height: 8px; flex: 0 0 auto; display: inline-block; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 4px rgba(31, 89, 68, .1); }
.session { position: relative; display: flex; align-items: center; gap: 8px; }
.session > div:first-child { min-width: 110px; }
.session > div:first-child > b { display: block; color: var(--ink) !important; font-size: 13px; }
.session .tag { display: inline-block; margin-top: 3px; color: var(--gold-deep); font-size: 10px; }
.header-actions-popover { position: absolute; top: calc(100% + 10px); left: 0; min-width: 210px; padding: 8px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-2); }
.header-actions-popover button { display: block; width: 100%; text-align: right; }
.mobile-nav-toggle { display: none; }

.tabs {
  position: fixed; z-index: 80; top: 80px; right: 0; bottom: 0; width: var(--rail); overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px; padding: 14px 12px 40px;
  background: var(--surface-low); border-left: 1px solid var(--stone);
}
.nav-section-title {
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--gold-deep);
  border-top: 1px solid rgba(226, 217, 204, .65);
  margin-top: 6px;
  user-select: none;
}
.nav-section-title:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 2px;
}
.tabs .tab {
  width: 100%; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-soft); text-align: right; font-size: 13px; font-weight: 650;
}
.tabs .tab > span { width: 22px; text-align: center; color: var(--gold-deep); font-size: 16px; }
.tabs .tab:hover { background: var(--surface-high); color: var(--ink); }
.tabs .tab.active { background: var(--ink); color: #fff; box-shadow: var(--shadow-1); }
.tabs .tab.active > span { color: #ffdea6; }

main { margin-right: var(--rail); padding: 104px 28px 40px !important; max-width: none !important; }
footer { margin-right: var(--rail); padding: 20px 28px 28px; color: var(--ink-soft); font-size: 11px; border-top: 1px solid var(--stone); }
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 20px;
  padding: 26px 30px;
  border: 1px solid var(--stone);
  border-radius: 14px;
  background-color: #242220;
  background-image: 
    linear-gradient(115deg, rgba(253, 249, 243, 0.35) 0%, rgba(247, 243, 237, 0.18) 45%, rgba(30, 30, 34, 0.32) 100%),
    url("assets/visual-review/image-gen-1.png");
  background-size: cover;
  background-position: center 36%;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(194, 162, 104, 0.28);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 620px;
  background: rgba(253, 249, 243, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 18px 22px;
  border-radius: 12px;
  border: 1px solid rgba(226, 217, 204, 0.95);
  box-shadow: 0 6px 20px -4px rgba(30, 30, 34, 0.08);
}
.hero-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.hero-subbadge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(194, 162, 104, 0.15);
  border: 1px solid rgba(194, 162, 104, 0.35);
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 700;
}
.hero h1 {
  margin: 6px 0;
  color: var(--ink) !important;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.25;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}
.eyebrow { margin: 0; color: var(--gold-deep) !important; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(253, 249, 243, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(226, 217, 204, 0.9);
  box-shadow: 0 4px 16px -4px rgba(30, 30, 34, 0.06);
}

.primary, button.primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 9px 15px; font-weight: 700; }
.primary:hover { background: #2a2a30; border-bottom-color: var(--gold); }
.secondary, button.secondary { background: var(--surface-low); color: var(--ink); border: 1px solid var(--gold); border-radius: 8px; padding: 9px 15px; font-weight: 700; }
.ghost, button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--stone); border-radius: 8px; padding: 8px 12px; }
.danger, button.danger { background: #fff7f5; color: var(--terracotta); border: 1px solid #edcdc4; border-radius: 8px; padding: 9px 14px; font-weight: 700; }
.icon { width: 40px; min-width: 40px; padding: 0; border: 1px solid var(--stone); border-radius: 8px; background: var(--surface-low); color: var(--ink); font-size: 24px; }

.panel { min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.section-head h2, .section-head h3 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; color: var(--ink); }
.section-head h2 { font-size: 25px; }
.section-head h3 { font-size: 18px; }
.section-head p { margin: 0; color: var(--ink-soft); font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card { position: relative; min-height: 132px; padding: 16px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); text-align: right; overflow: hidden; }
.kpi-card::after { content: ""; position: absolute; top: 0; right: 0; width: 4px; height: 100%; background: var(--gold); }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-2); }
.kpi-card span { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.kpi-card b { display: block; margin: 8px 0 2px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 29px; font-variant-numeric: tabular-nums; }
.kpi-card small { color: var(--ink-soft); font-size: 10px; }
.kpi-card.balance::after { background: var(--terracotta); }

.search-card, .subpanel, .report-section { border: 1px solid var(--stone) !important; border-radius: 11px !important; background: var(--surface) !important; box-shadow: var(--shadow-1); }
.matrix-head-wrap { margin-bottom: 12px; }
.matrix-period-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  margin: 10px 0 12px;
  border-radius: 8px;
  background: var(--surface-low);
  border: 1px solid var(--stone);
  flex-wrap: wrap;
}
.matrix-check-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}
.matrix-check-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.matrix-check-inputs label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin: 0;
  color: var(--ink-soft);
}
.matrix-check-inputs input[type="date"] {
  width: auto;
  min-height: 32px;
  height: 32px;
  padding: 4px 8px;
  font-size: 11px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--stone);
  border-radius: 6px;
}
.matrix-check-inputs button {
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}
label { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--stone); border-radius: 8px; background: var(--canvas); color: var(--ink); }
textarea { min-height: 78px; resize: vertical; }

.dashboard-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(310px, 1fr);
  gap: 16px;
  align-items: start;
}
.units-column {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--stone);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.operations-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.operations-sidebar > section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--stone);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.chip-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-filters button { min-height: 32px; padding: 5px 9px; border: 1px solid var(--stone); border-radius: 6px; background: var(--surface-low); color: var(--ink-soft); font-size: 10px; }
.chip-filters button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.unit-matrix, .unit-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.unit-card-v1 { position: relative; min-width: 0; padding: 13px; border: 1px solid var(--stone); border-right: 4px solid var(--emerald); border-radius: 9px; background: var(--surface-low); text-align: right; box-shadow: none; }
.unit-card-v1[data-state="occupied"] { border-right-color: var(--blue); }
.unit-card-v1[data-state="arrival"], .unit-card-v1[data-state="future"] { border-right-color: var(--gold); }
.unit-card-v1[data-state="departure"] { border-right-color: var(--terracotta); }
.unit-card-v1[data-state="maintenance"], .unit-card-v1[data-state="inactive"] { border-right-color: var(--bronze); }
.unit-card-v1:hover { background: var(--surface); border-color: var(--gold); border-right-width: 4px; box-shadow: var(--shadow-1); }
.unit-card-v1 .unit-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.unit-card-v1 .unit-code { color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 800; }
.unit-card-v1 .unit-type, .status-badge { display: inline-block; padding: 3px 6px; border: 1px solid var(--stone); border-radius: 5px; color: var(--ink-soft); background: var(--surface); font-size: 9px; }
.unit-card-v1 .unit-guest { display: block; width: 100%; min-height: 0; margin: 10px 0 5px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: right; font-weight: 750; }
.unit-card-v1 .unit-meta { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid rgba(226, 217, 204, .8); color: var(--ink-soft); font-size: 10px; }
.movement-list { display: grid; gap: 9px; }
.movement-row { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--stone); border-radius: 8px; background: var(--surface-low); text-align: right; }
.movement-row::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.movement-row.departure::before { background: var(--terracotta); }
.movement-row b, .movement-row span { display: block; }
.movement-row span { color: var(--ink-soft); font-size: 10px; }
.movement-row > small { color: var(--terracotta); font-weight: 750; }

.summary { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary > div { padding: 13px; border: 1px solid var(--stone); border-radius: 9px; background: var(--surface); }
.summary span { display: block; color: var(--ink-soft); font-size: 10px; }
.summary b { display: block; margin-top: 5px; font-size: 19px; font-variant-numeric: tabular-nums; }
.filters, .calendar-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { min-width: 260px; }
.table-wrap { max-width: 100%; overflow: visible; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 10px; background: var(--surface-mid); color: var(--ink-soft); text-align: right; font-size: 10px; }
td { padding: 12px 10px; border-top: 1px solid var(--stone); vertical-align: top; font-size: 12px; }
tbody tr { transition: background .18s ease; }
tbody tr:hover { background: var(--surface-low); }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.row-actions button { min-height: 30px; padding: 4px 7px; border: 1px solid var(--stone); border-radius: 6px; background: var(--surface-low); color: var(--ink); font-size: 9px; }
.row-actions button:first-child { border-color: var(--ink); background: var(--ink); color: #fff; }
.panel-search { min-width: 280px; }
.customer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.customer-card { padding: 15px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); text-align: right; }
.customer-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.customer-card h3 { margin: 0 0 5px; font-size: 15px; }
.customer-card p { margin: 3px 0; color: var(--ink-soft); font-size: 11px; }
.customer-card .customer-stats { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--stone); }
.customer-card .customer-stats b { color: var(--gold-deep); }
.occupancy-calendar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.calendar-day { min-width: 0; padding: 14px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); }
.calendar-day header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--stone); }
.calendar-day header b { font-size: 13px; }
.calendar-day header span { color: var(--ink-soft); font-size: 10px; }
.calendar-events { display: grid; gap: 6px; }
.calendar-event { min-height: 38px; padding: 7px 9px; border: 1px solid #bdd8cc; border-radius: 6px; background: var(--emerald-soft); color: var(--emerald); text-align: right; }
.calendar-event.departure { border-color: #edcdc4; background: var(--terracotta-soft); color: var(--terracotta); }
.calendar-event span { display: block; color: currentColor; font-size: 9px; opacity: .86; }
.notice { border: 1px solid var(--stone) !important; border-radius: 9px !important; background: var(--surface-low) !important; color: var(--ink-soft) !important; }

/* Empty state polish */
.empty {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 34px 20px !important;
  border: 1px dashed var(--stone) !important;
  border-radius: 11px !important;
  background: var(--surface-low) !important;
  color: var(--ink-soft) !important;
  text-align: center !important;
  font-size: 13px !important;
  margin: 14px 0 !important;
}
.empty::before {
  content: "◇";
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--stone);
  color: var(--gold-deep);
  font-size: 15px;
  margin-bottom: 2px;
}

/* Login Gate Polish */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: #1a1a1d;
  background-image:
    linear-gradient(145deg, rgba(20, 20, 24, 0.40) 0%, rgba(30, 30, 34, 0.55) 100%),
    url("assets/visual-review/image-gen-3.png");
  background-size: cover;
  background-position: center;
}
.gate-card {
  width: min(100%, 460px);
  background: rgba(253, 249, 243, 0.96) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(194, 162, 104, 0.45) !important;
  border-top: 4px solid var(--gold) !important;
  border-radius: 16px !important;
  padding: 34px 28px !important;
  box-shadow: 0 24px 60px -12px rgba(10, 10, 14, 0.65) !important;
  text-align: right;
  color: var(--ink);
}
.gate-card > img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--ink);
  padding: 6px;
  border: 1px solid var(--stone);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  margin-bottom: 10px;
}
.gate-card .eyebrow {
  color: var(--gold-deep) !important;
  font-size: 11px;
  font-weight: 800;
  margin: 2px 0 6px;
}
.gate-card h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  color: var(--ink);
  margin: 4px 0 6px;
}
.gate-card .muted {
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 16px;
}
.gate-form input {
  background: var(--surface);
  border: 1px solid var(--stone);
  color: var(--ink);
  border-radius: 8px;
}
.gate-form input:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(194, 162, 104, 0.18) !important;
}
.gate-form button.primary {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 8px;
  min-height: 44px;
  font-weight: 700;
  font-size: 14px;
  margin-top: 6px;
  box-shadow: 0 2px 6px rgba(30, 30, 34, 0.14);
}
.gate-form button.primary:hover {
  background: #2a2a30;
  border-bottom-color: var(--gold);
}

dialog { width: min(720px, calc(100vw - 32px)); max-height: min(90vh, 920px); padding: 0; border: 1px solid rgba(194, 162, 104, .5); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 50px -18px rgba(30, 30, 34, .34); }
dialog::backdrop { background: rgba(30, 30, 34, .45); backdrop-filter: blur(4px); }
dialog > form { padding: 18px; }
.booking-dialog { width: min(920px, calc(100vw - 32px)); }
.dialog-head { position: sticky; top: -18px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: -18px -18px 16px; padding: 16px 18px; border-bottom: 1px solid var(--stone); background: var(--surface-low); }
.dialog-head h2 { margin: 0 0 3px; font-family: Georgia, "Times New Roman", serif; }
.dialog-head p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wide { grid-column: 1 / -1; }
.booking-step { margin-bottom: 13px; padding: 14px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface-low); }
.booking-summary { border-color: var(--gold) !important; background: #faf5eb !important; }

.drawer-scrim { position: fixed; inset: 0; z-index: 135; background: rgba(30, 30, 34, .45); backdrop-filter: blur(3px); }
.detail-drawer { position: fixed; z-index: 140; top: 0; bottom: 0; left: 0; width: min(520px, 100%); display: flex; flex-direction: column; border-right: 3px solid var(--gold); background: var(--canvas); box-shadow: -12px 0 32px rgba(30, 30, 34, .14); transform: translateX(-105%); transition: transform .25s ease; }
.detail-drawer.open { transform: translateX(0); }
.detail-drawer > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px; border-bottom: 1px solid var(--stone); background: var(--surface-low); }
.detail-drawer h2 { margin: 3px 0; font-family: Georgia, "Times New Roman", serif; font-size: 24px; }
.detail-drawer header p { margin: 0; color: var(--ink-soft); font-size: 11px; }
.drawer-kicker { color: var(--gold-deep); font-size: 10px; font-weight: 800; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-section { margin-bottom: 12px; padding: 14px; border: 1px solid var(--stone); border-radius: 9px; background: var(--surface); }
.drawer-section h3 { margin: 0 0 10px; color: var(--gold-deep); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-grid span { display: block; color: var(--ink-soft); font-size: 9px; }
.detail-grid b { display: block; margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }
.detail-list { display: grid; gap: 7px; }
.detail-list button, .detail-list .detail-row { width: 100%; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px; border: 1px solid var(--stone); border-radius: 7px; background: var(--surface-low); color: var(--ink); text-align: right; }
.detail-list small { color: var(--ink-soft); }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--stone); background: var(--surface-low); }
.drawer-actions button { flex: 1 1 120px; }

.toast-region { position: fixed; z-index: 200; left: 20px; bottom: 20px; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border: 1px solid var(--stone); border-right: 4px solid var(--emerald); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-2); color: var(--ink); font-size: 12px; animation: toast-in .2s ease; }
.toast.error { border-right-color: var(--terracotta); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  :root { --rail: 236px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .local-runtime { display: none; }
}

@media (max-width: 767px) {
  :root { --rail: 0px; }
  .demo-banner { display: none !important; }
  .topbar { top: 0; right: 0; height: 72px; padding: 10px 12px; gap: 8px; }
  .topbar .brand { position: static; width: auto; height: auto; margin-left: auto; padding: 0; border: 0; background: transparent; }
  .brand img { width: 34px; height: 34px; }
  .brand strong { font-size: 16px; }
  .brand span, .global-search, .session > div:first-child, #headerActionsToggle { display: none; }
  .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .header-actions-popover { display: none !important; }
  .tabs { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 78vh; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 12px 80px; border: 1px solid var(--stone); border-radius: 16px; box-shadow: 0 18px 54px rgba(30, 30, 34, .28); transform: translateY(120%); opacity: 0; pointer-events: none; transition: .25s ease; }
  body.nav-open .tabs { display: grid; transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-section-title { grid-column: 1 / -1; padding: 8px 6px 2px; margin-top: 4px; }
  .tabs .tab { min-height: 46px; }
  main { margin-right: 0; padding: 88px 12px 88px !important; }
  footer { margin-right: 0; padding: 18px 12px 90px; }
  .hero { align-items: stretch; margin-bottom: 14px; padding: 14px; }
  .hero, .search-card, .section-head { flex-direction: column; }
  .hero-content { max-width: 100%; width: 100%; padding: 14px; }
  .hero-actions { width: 100%; padding: 10px 12px; }
  .hero-actions, .hero-actions button, .date-search, .date-search label, .date-search button { width: 100%; }
  .matrix-period-check { flex-direction: column; align-items: stretch; }
  .matrix-check-inputs { width: 100%; }
  .matrix-check-inputs label, .matrix-check-inputs input, .matrix-check-inputs button { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-card { min-height: 116px; padding: 13px; }
  .kpi-card b { font-size: 23px; }
  .dashboard-columns, .unit-matrix, .unit-catalog, .customer-grid, .occupancy-calendar { grid-template-columns: 1fr; }
  .dashboard-columns > section, .operations-sidebar > section { padding: 12px; }
  .chip-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .filters, .filters input, .filters select, .panel-search, .calendar-controls, .calendar-controls button { width: 100%; min-width: 0; }
  .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  table, tbody, tr, td { display: block; width: 100%; min-width: 0 !important; max-width: 100% !important; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { padding: 10px 12px; border: 1px solid var(--stone); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-1); }
  td { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(226, 217, 204, .65); text-align: left; }
  td:first-child { border-top: 0; }
  td::before { color: var(--ink-soft); font-size: 9px; text-align: right; }
  #bookingRows td:nth-child(1)::before { content: "النزيل"; }
  #bookingRows td:nth-child(2)::before { content: "الوحدة"; }
  #bookingRows td:nth-child(3)::before { content: "الدخول"; }
  #bookingRows td:nth-child(4)::before { content: "المغادرة"; }
  #bookingRows td:nth-child(5)::before { content: "العميل"; }
  #bookingRows td:nth-child(6)::before { content: "الدفع"; }
  #bookingRows td:nth-child(7)::before { content: "الحالة"; }
  #bookingRows td:nth-child(8)::before { content: "الإجراءات"; }
  .row-actions { justify-content: flex-end; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  dialog { width: 100%; max-width: none; max-height: 94vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .booking-dialog { width: 100%; }
  .detail-drawer { top: auto; right: 0; bottom: 0; width: 100%; height: min(92vh, 900px); border: 0; border-top: 3px solid var(--gold); border-radius: 16px 16px 0 0; transform: translateY(105%); }
  .detail-drawer.open { transform: translateY(0); }
  .toast-region { right: 12px; left: 12px; bottom: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Readability pass: preserve the calm layout while bringing operational text
   to comfortable sizes on desktop and small screens. */
body { font-size: 17px; line-height: 1.55; }
button, input, select, textarea { font-size: 16px; }
label { font-size: 15px; }
th { font-size: 14px; }
td { font-size: 15px; }
.small, .muted, .section-head p { font-size: 14px; }
.tag, .status-badge, .customer-badge { font-size: 13px; }
.row-actions button { min-height: 38px; font-size: 13px; }
.unit-card-v1 .unit-type, .unit-card-v1 .unit-meta,
.movement-row span, .summary span, .kpi-card span,
.kpi-card small, .calendar-day header span { font-size: 13px; }
.calendar-event span { font-size: 13px; }
footer, .brand span, .session .tag { font-size: 13px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  button, input, select, textarea { font-size: 16px; }
  th, td { font-size: 14px; }
  .row-actions button { min-height: 40px; }
}
.edit-pricing-readonly { display: grid; gap: 4px; align-content: start; padding: 10px 12px; border: 1px solid var(--stone); border-radius: 8px; color: var(--ink); }
.edit-pricing-readonly span, .edit-pricing-readonly small { color: var(--ink-soft); }

/* Financial summaries need fewer, wider cards for readable Arabic labels. */
.financial-summary-cards { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
#monthlyReportSummary { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 900px) {
  .financial-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #monthlyReportSummary { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
