/* Aquarabia Cabana Manager — base styles */
:root {
  --aq-bg: #f5f4ef;
  --aq-fg: #0f172a;
  --aq-muted: #64748b;
  --aq-card: #ffffff;
  --aq-border: #e2e8f0;
  --aq-primary: #0e7490;       /* teal — water */
  --aq-primary-2: #06b6d4;
  --aq-sand: #d6a866;          /* desert sand */
  --aq-accent: #f59e0b;
  --aq-shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);

  /* Cabana status colors */
  --status-available:    #16a34a;
  --status-occupied:     #dc2626;
  --status-blocked:      #f87171;
  --status-maintenance:  #7c3aed;
  --status-reserved_vip: #fbbf24;
  --status-cleaning:     #f97316;   /* between occupied → available */
}

* { box-sizing: border-box; }
/* Always honor the [hidden] attribute even when other rules set display: */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--aq-fg);
  background: var(--aq-bg);
  min-height: 100vh;
}

a { color: var(--aq-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Per-port session profile strip — colored bar at the very top so multi-session tabs are visually distinct */
.profile-strip { height: 4px; background: var(--profile-accent, var(--aq-primary)); }
.profile-chip {
  display: inline-block; margin-left: .5rem; padding: .1rem .55rem;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; font-size: .72rem; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.25rem;
  background: linear-gradient(90deg, #0e7490 0%, #06b6d4 100%);
  color: #fff;
  box-shadow: var(--aq-shadow);
}
.topbar .brand {
  font-weight: 700; font-size: 1.05rem; letter-spacing: .02em;
  display: flex; align-items: center; gap: .5rem;
}
.topbar .brand::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  border-radius: 50%; background: var(--aq-sand);
  box-shadow: 0 0 0 3px rgba(255,255,255,.3);
}
.topbar nav { display: flex; gap: .25rem; margin-left: 1rem; }
.topbar nav a {
  color: #fff; padding: .35rem .7rem; border-radius: 6px;
  font-weight: 500; opacity: .85;
}
.topbar nav a.active, .topbar nav a:hover {
  background: rgba(255,255,255,.18); opacity: 1; text-decoration: none;
}
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: .5rem; opacity: .92; }
.topbar .who .role {
  background: rgba(255,255,255,.2); padding: .15rem .5rem;
  border-radius: 999px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
}
.topbar .logout { color: #fff; opacity: .8; font-size: .85rem; }

/* Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.h1 { font-size: 1.4rem; font-weight: 700; margin: 0 0 .25rem; }
.sub { color: var(--aq-muted); font-size: .9rem; margin: 0 0 1rem; }

/* Cards */
.card {
  background: var(--aq-card); border: 1px solid var(--aq-border);
  border-radius: 10px; box-shadow: var(--aq-shadow);
  padding: 1rem;
}

/* Summary tiles */
.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { padding: .85rem 1rem; border-radius: 10px; background: var(--aq-card); border: 1px solid var(--aq-border); box-shadow: var(--aq-shadow); }
.tile .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--aq-muted); margin-bottom: .25rem; }
.tile .value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.tile .pct { font-size: .8rem; color: var(--aq-muted); margin-top: .25rem; }
.tile.available  { border-top: 4px solid var(--status-available); }
.tile.occupied   { border-top: 4px solid var(--status-occupied); }
.tile.blocked    { border-top: 4px solid var(--status-blocked); }
.tile.maintenance{ border-top: 4px solid var(--status-maintenance); }
.tile.reserved_vip{border-top: 4px solid var(--status-reserved_vip); }
.tile.cleaning   { border-top: 4px solid var(--status-cleaning); }
.tile.total      { border-top: 4px solid var(--aq-primary); }

/* Zone cards strip */
.zones-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1.5rem; }
.zone-card {
  background: var(--aq-card); border: 1px solid var(--aq-border); border-radius: 10px;
  box-shadow: var(--aq-shadow); padding: .8rem;
  border-top: 4px solid var(--aq-primary);
}
.zone-card .name { font-weight: 700; margin-bottom: .25rem; }
.zone-card .total { font-size: .85rem; color: var(--aq-muted); margin-bottom: .5rem; }
.zone-card .breakdown { display: grid; grid-template-columns: repeat(6, 1fr); gap: .15rem; font-size: .7rem; }
.zone-card .breakdown div { text-align: center; padding: .2rem; border-radius: 4px; }
.zone-card .breakdown .bd-occupied  { background: #fee2e2; color: #991b1b; }
.zone-card .breakdown .bd-available { background: #dcfce7; color: #166534; }
.zone-card .breakdown .bd-blocked   { background: #fed7d7; color: #b91c1c; }
.zone-card .breakdown .bd-maintenance{background: #ede9fe; color: #5b21b6; }
.zone-card .breakdown .bd-reserved_vip{background:#fef3c7; color:#92400e; }
.zone-card .breakdown .bd-cleaning  { background: #ffedd5; color: #9a3412; }

/* Cabana grid */
.zone-section { margin-bottom: 1.25rem; }
.zone-section h2 { font-size: 1.05rem; margin: 1rem 0 .5rem; display: flex; align-items: center; gap: .5rem; }
.zone-section h2 .swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.zone-section h2 .tier { font-size: .65rem; padding: .15rem .5rem; border-radius: 999px; background: var(--aq-border); color: var(--aq-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.zone-section h2 .tier.premium      { background: #cffafe; color: #155e75; }
.zone-section h2 .tier.premium_plus { background: #fde68a; color: #92400e; }

/* Building/floor/side data still carried on each cabana for future use, but
   the grid is rendered as a simple auto-fill row of cards per zone. */
.cabana-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.cabana {
  position: relative;
  border: 1px solid var(--aq-border); border-radius: 8px; padding: .55rem .65rem;
  background: var(--aq-card); cursor: pointer; transition: transform .08s ease, box-shadow .08s ease;
  border-left: 6px solid var(--status-available);
}
.cabana:hover { transform: translateY(-1px); box-shadow: var(--aq-shadow); }
.cabana .num { font-weight: 700; font-size: 1rem; }
.cabana .floor { font-size: .7rem; color: var(--aq-muted); text-transform: uppercase; letter-spacing: .04em; }
.cabana .guest { font-size: .8rem; margin-top: .25rem; color: var(--aq-fg); }
.cabana[data-status="available"]   { border-left-color: var(--status-available); }
.cabana[data-status="occupied"]    { border-left-color: var(--status-occupied);  background: #fff5f5; }
.cabana[data-status="blocked"]     { border-left-color: var(--status-blocked);   background: #fff1f1; }
.cabana[data-status="maintenance"] { border-left-color: var(--status-maintenance);background: #f5f3ff; }
.cabana[data-status="reserved_vip"]{ border-left-color: var(--status-reserved_vip);background: #fffbeb; }
.cabana[data-status="cleaning"]    { border-left-color: var(--status-cleaning); background: #fff7ed; }

.cabana .lock {
  position: absolute; top: 4px; right: 6px; font-size: .65rem;
  background: rgba(220,38,38,.92); color: #fff; padding: 1px 6px; border-radius: 999px;
}
.cabana .arrival {
  margin-top: .35rem; font-size: .68rem; padding: .15rem .5rem; border-radius: 999px;
  display: inline-block; font-weight: 600; cursor: pointer; user-select: none;
  transition: filter .1s, transform .1s;
}
.cabana .arrival:hover { filter: brightness(1.1); transform: translateY(-1px); }
.cabana .arrival::after { content: " ✕"; opacity: .6; font-size: .8em; }
.cabana .arrival-pending      { background: #fef3c7; color: #92400e; animation: arr-pulse 1.6s ease-in-out infinite; }
.cabana .arrival-acknowledged { background: #dcfce7; color: #166534; }
@keyframes arr-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(217,119,6,.5); }
  50%     { box-shadow: 0 0 0 5px rgba(217,119,6,0); }
}

/* Quick-action row in the booking modal */
.quick-actions {
  display: flex; gap: .35rem; margin: .65rem 0 0;
  padding: .65rem .65rem; background: #f8fafc; border-radius: 8px;
  border: 1px solid var(--aq-border); flex-wrap: wrap; align-items: center;
}
.quick-actions .small { font-size: .7rem; }

/* Login */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 50%, #d6a866 100%); }
.login-card { width: 360px; max-width: 92vw; padding: 1.75rem 1.5rem; border-radius: 14px; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.login-card h1 { font-size: 1.3rem; margin: 0 0 .25rem; }
.login-card .sub { margin-bottom: 1.25rem; }
.field { display: block; margin-bottom: .75rem; }
.field label { display: block; font-size: .8rem; color: var(--aq-muted); margin-bottom: .25rem; }
.field input { width: 100%; padding: .55rem .65rem; font-size: .95rem; border: 1px solid var(--aq-border); border-radius: 8px; background: #fff; }
.field input:focus { outline: 2px solid var(--aq-primary-2); outline-offset: 0; border-color: var(--aq-primary-2); }
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--aq-primary); color: #fff; font-weight: 600; cursor: pointer; font-size: .9rem;
}
.btn:hover { background: #0c6177; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--aq-fg); border-color: var(--aq-border); }
.flash { background: #fee2e2; color: #991b1b; padding: .5rem .75rem; border-radius: 8px; margin-bottom: .75rem; font-size: .85rem; }
.flash.ok { background: #dcfce7; color: #166534; }

/* Modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; z-index: 1; width: 560px; max-width: 94vw; max-height: 92vh; overflow: auto;
  background: var(--aq-card); border-radius: 12px; padding: 1.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.modal-header h2 { margin: 0; font-size: 1.1rem; }
.modal-header > div { flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

.field span:first-child { display: block; font-size: .75rem; color: var(--aq-muted); margin-bottom: .2rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .45rem .55rem; font-size: .9rem;
  border: 1px solid var(--aq-border); border-radius: 7px; background: #fff;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--aq-primary-2); border-color: var(--aq-primary-2);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

.booking-only.disabled { opacity: .5; pointer-events: none; }

/* Modal field tightening */
.modal-card .field { margin-bottom: .55rem; }
.modal-card .grid-2 { margin-bottom: .55rem; }

/* Per-person guest grid (butler modal) */
.guest-grid { display: grid; gap: .35rem; }
.guest-row {
  display: grid; grid-template-columns: auto 1fr; gap: .5rem; align-items: center;
  padding: .35rem .55rem; background: #f8fafc; border: 1px solid var(--aq-border); border-radius: 7px;
}
.guest-row .badge {
  padding: .15rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.guest-row .badge.adult { background: #cffafe; color: #155e75; }
.guest-row .badge.child { background: #fef3c7; color: #92400e; }
.guest-row input[type=text] {
  border: 1px solid transparent; background: transparent; padding: .35rem .45rem;
  font-size: .92rem; border-radius: 5px; width: 100%; font-family: inherit;
}
.guest-row input[type=text]:focus { outline: 2px solid var(--aq-primary-2); background: #fff; border-color: var(--aq-primary-2); }

/* Spoken-language flag (used on butler cabana tile + guest modal header) */
.lang-flag { display: inline-block; font-size: 1.05em; margin-left: .25rem; vertical-align: middle; }

.cabana.clickable { cursor: pointer; }
.cabana.clickable:hover { box-shadow: 0 4px 12px rgba(15,23,42,.08); transform: translateY(-1px); }

/* Reports */
.report-tabs { display: flex; gap: .25rem; margin: 1rem 0; border-bottom: 1px solid var(--aq-border); }
.report-tabs a {
  padding: .55rem 1rem; border-radius: 8px 8px 0 0; color: var(--aq-fg); font-weight: 500;
  border-bottom: 3px solid transparent;
}
.report-tabs a:hover { background: #f1f5f9; text-decoration: none; }
.report-tabs a.active { background: #fff; border-bottom-color: var(--aq-primary); }

.report-pane { display: none; }
.report-pane.active { display: block; }

.report-toolbar { display: flex; gap: .75rem; align-items: end; margin-bottom: 1rem; padding: .65rem; background: #f8fafc; border: 1px solid var(--aq-border); border-radius: 10px; }

.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .report-grid { grid-template-columns: 1fr; } }

.rep-h2 { font-size: .9rem; margin: 0 0 .5rem; color: var(--aq-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Chart.js containers — fixed height stops the responsive-feedback growth loop. */
.chart-box { position: relative; height: 240px; width: 100%; }
.chart-box > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* Toggle switch row */
.switch-row { display: flex; align-items: center; gap: .65rem; padding: .65rem .25rem; cursor: pointer; user-select: none; }
.switch-row input.switch { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  display: inline-block; position: relative; width: 38px; height: 22px;
  background: #cbd5e1; border-radius: 999px; transition: background .15s;
  flex: 0 0 auto;
}
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; transition: left .15s, background .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch-row input.switch:checked + .switch-track { background: var(--aq-primary); }
.switch-row input.switch:checked + .switch-track .switch-thumb { left: 18px; }
.switch-label { font-size: .92rem; }
.switch-label .muted { font-size: .8rem; }

/* Multi-day fieldset */
fieldset.multiday { border: 1px dashed var(--aq-border); border-radius: 8px; padding: .65rem .85rem .25rem; margin-bottom: .65rem; }
fieldset.multiday[hidden] { display: none; }

/* Advanced details */
details.advanced { margin: .25rem 0 .75rem; padding: .35rem .5rem; border: 1px solid var(--aq-border); border-radius: 8px; background: #fafaf9; }
details.advanced summary { cursor: pointer; font-size: .85rem; color: var(--aq-muted); }
details.advanced[open] { background: #fff; }
details.advanced .small { font-size: .75rem; margin: .25rem 0 0; }

.btn.primary { background: var(--aq-primary); }
.btn.primary:hover { background: #0c6177; }

/* Toast */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: .65rem 1rem; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100; opacity: 0;
  transition: transform .2s, opacity .2s;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok   { background: #166534; }
#toast.warn { background: #b91c1c; }

/* ---------- Admin layout ---------- */
.adm-wrap { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 50px); }
.adm-sidebar { background: #fff; border-right: 1px solid var(--aq-border); padding: 1rem .75rem; }
.adm-sidebar h3 { margin: .25rem 0 .75rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; color: var(--aq-muted); }
.adm-sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.adm-sidebar nav a { padding: .5rem .65rem; border-radius: 7px; color: var(--aq-fg); font-weight: 500; }
.adm-sidebar nav a:hover { background: #f1f5f9; text-decoration: none; }
.adm-sidebar nav a.active { background: var(--aq-primary); color: #fff; }
.adm-sub { font-size: .72rem; margin-top: 1rem; }
.adm-main { padding: 1rem 1.25rem; }

/* Admin tables */
.adm-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--aq-shadow); margin-top: .5rem; }
.adm-table th, .adm-table td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--aq-border); font-size: .9rem; }
.adm-table th { background: #f8fafc; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--aq-muted); }
.adm-table tr.inactive { color: var(--aq-muted); background: #fafaf9; }
.adm-table tr:last-child td { border-bottom: none; }

.color-chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: .25rem; border: 1px solid var(--aq-border); }

/* Signage thumbnail in admin table */
.signage-thumb { display: block; width: 140px; height: 78px; object-fit: cover; border-radius: 6px; border: 1px solid var(--aq-border); background: #f1f5f9; }

.cab-rest-popover {
  position: absolute; z-index: 10;
  background: #fff; border: 1px solid var(--aq-border); border-radius: 8px;
  padding: .5rem .65rem; box-shadow: 0 8px 24px rgba(15,23,42,.18);
  display: flex; flex-direction: column; gap: .35rem; min-width: 220px;
}
.cab-rest-popover select { width: 100%; }

.adm-table input[type=text],
.adm-table input[type=number],
.adm-table input[type=tel],
.adm-table input[type=datetime-local],
.adm-table textarea,
.adm-table select { padding: .3rem .45rem; font-size: .85rem; border: 1px solid var(--aq-border); border-radius: 5px; background: #fff; max-width: 100%; }

.role-pill { font-size: .7rem; padding: .15rem .55rem; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.role-pill.role-superadmin     { background: #fee2e2; color: #991b1b; }
.role-pill.role-manager        { background: #fef3c7; color: #92400e; }
.role-pill.role-agent          { background: #cffafe; color: #155e75; }
.role-pill.role-butler         { background: #ede9fe; color: #5b21b6; }
.role-pill.role-butler_manager { background: #dbeafe; color: #1e40af; }

/* Duty roster */
.duty-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: .75rem 0 .5rem; }
.duty-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--aq-border); }
.duty-tabs a { padding: .45rem .85rem; border-radius: 8px 8px 0 0; color: var(--aq-fg); font-weight: 500; border-bottom: 3px solid transparent; }
.duty-tabs a:hover { background: #f1f5f9; text-decoration: none; }
.duty-tabs a.active { background: #fff; border-bottom-color: var(--aq-primary); }
.duty-picker { display: flex; gap: .5rem; align-items: end; }

.duty-grid-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--aq-border); border-radius: 10px; }
.duty-grid { border-collapse: collapse; width: 100%; min-width: 600px; }
.duty-grid th, .duty-grid td { border-bottom: 1px solid var(--aq-border); border-right: 1px solid var(--aq-border); padding: .35rem .5rem; text-align: center; font-size: .82rem; }
.duty-grid thead th { background: #f8fafc; color: var(--aq-muted); text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; padding: .35rem .25rem; }
.duty-grid th.duty-day .dow { font-weight: 700; font-size: .65rem; }
.duty-grid th.duty-day .dom { font-size: 1rem; color: var(--aq-fg); font-weight: 700; font-variant-numeric: tabular-nums; }
.duty-grid th.weekend { background: #fef3c7; }
.duty-grid th.today, .duty-grid td.today { background: rgba(14,116,144,.08); }
.duty-name-col   { text-align: left !important; min-width: 160px; max-width: 220px; }
.duty-total-col  { background: #f8fafc; color: var(--aq-muted); }
.duty-cell { padding: 0 !important; }
.duty-toggle {
  width: 100%; min-width: 32px; height: 34px; border: 0; background: transparent;
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: transparent;
  transition: background-color .1s;
}
.duty-toggle.on { background: #16a34a; color: #fff; font-weight: 700; }
.duty-toggle.off:hover { background: #dcfce7; color: #166534; }
.duty-toggle.on:hover { background: #166534; }

.btn.small { padding: .25rem .5rem; font-size: .8rem; }

/* Shifts grid */
.adm-shifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.adm-shift-cell { background: #fff; border: 1px solid var(--aq-border); border-radius: 8px; padding: .5rem .65rem; }
.adm-shift-cell .adm-shift-cab { font-weight: 600; margin-bottom: .25rem; font-size: .85rem; }
.adm-shift-cell select { width: 100%; padding: .3rem .4rem; font-size: .8rem; border: 1px solid var(--aq-border); border-radius: 6px; }

/* Butler dashboard */
.butler-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.butler-col h2 { font-size: 1rem; margin: 0 0 .65rem; }
.alert-list { display: flex; flex-direction: column; gap: .65rem; min-height: 100px; }

.alert-card {
  background: #fff; border: 1px solid var(--aq-border); border-radius: 10px;
  padding: .75rem .9rem; box-shadow: var(--aq-shadow); border-left: 4px solid var(--aq-primary);
}
.alert-card.kind-arrival { border-left-color: #f59e0b; }
.alert-card.kind-call    { border-left-color: #dc2626; }
.alert-card.kind-order   { border-left-color: #0891b2; }
.alert-card.pulse { animation: alertpulse 1.6s ease-in-out infinite; }
@keyframes alertpulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.0); }
  50%     { box-shadow: 0 0 0 6px rgba(220,38,38,.2); }
}
.alert-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.alert-body { font-size: .9rem; }
.alert-body .small { font-size: .75rem; }
.alert-actions { display: flex; gap: .35rem; margin-top: .65rem; flex-wrap: wrap; }
.alert-actions .btn.small { padding: .3rem .65rem; font-size: .8rem; }

/* Live "elapsed since notified" counter */
.elapsed {
  margin-top: .45rem; padding: .35rem .55rem; border-radius: 8px;
  background: #f1f5f9; border-left: 4px solid #94a3b8;
  font-size: .85rem;
}
.elapsed strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.elapsed.warn   { background: #fef3c7; border-left-color: #f59e0b; }
.elapsed.alarm  { background: #fee2e2; border-left-color: #dc2626; animation: alertpulse 1.6s ease-in-out infinite; }

.cab-num { background: var(--aq-primary); color: #fff; padding: .1rem .55rem; border-radius: 6px; font-weight: 700; }

.status-pill {
  font-size: .65rem; padding: .15rem .5rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.status-pill.pending      { background: #fef3c7; color: #92400e; }
.status-pill.acknowledged { background: #dbeafe; color: #1e40af; }
.status-pill.arrived      { background: #dcfce7; color: #166534; }
.status-pill.cancelled    { background: #f1f5f9; color: #64748b; }
.status-pill.open         { background: #fee2e2; color: #991b1b; }
.status-pill.closed       { background: #f1f5f9; color: #64748b; }
.status-pill.confirmed    { background: #cffafe; color: #155e75; }
.status-pill.preparing    { background: #fef3c7; color: #92400e; }
.status-pill.on_its_way   { background: #cffafe; color: #155e75; }
.status-pill.completed    { background: #dcfce7; color: #166534; }

/* Toast (shared with grid) */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: .65rem 1rem; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100; opacity: 0;
  transition: transform .2s, opacity .2s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok   { background: #166534; }
.toast.warn { background: #b91c1c; }

/* Arrival popover (on grid page) */
.arrival-popover {
  position: absolute; z-index: 30; width: 320px;
  background: #fff; border: 1px solid var(--aq-border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15,23,42,.18); padding: 1rem;
}
.arrival-popover h3 { margin: 0 0 .5rem; font-size: 1rem; }

/* Reveal-URL row in tokens table */
.reveal-url {
  margin-top: .35rem; padding: .5rem .65rem; background: #f8fafc;
  border: 1px solid var(--aq-border); border-radius: 6px;
  display: flex; gap: .35rem; align-items: center; flex-wrap: wrap;
  font-family: ui-monospace, Menlo, monospace; font-size: .78rem; word-break: break-all;
}
.reveal-url code { background: transparent; padding: 0; flex: 1; min-width: 200px; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* Help / training viewer */
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .85rem; margin-top: 1rem; }
.help-card {
  display: block; padding: .85rem 1rem; background: #fff; border: 1px solid var(--aq-border);
  border-radius: 12px; box-shadow: var(--aq-shadow); color: var(--aq-fg); text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}
.help-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15,23,42,.08); text-decoration: none; }
.help-card-pill {
  display: inline-block; font-size: .65rem; padding: .15rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700; margin-bottom: .5rem;
}
.help-card-pill.pill-you      { background: #cffafe; color: #155e75; }
.help-card-pill.pill-team     { background: #fef3c7; color: #92400e; }
.help-card-pill.pill-ref      { background: #ede9fe; color: #5b21b6; }
.help-card-pill.pill-handout  { background: #dcfce7; color: #166534; }
.help-card-pill.pill-producer { background: #fce7f3; color: #9d174d; }
.help-section-h2 {
  margin: 1.5rem 0 .5rem; font-size: .85rem; color: var(--aq-muted);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
}
.help-card-title { font-weight: 700; font-size: 1.02rem; margin-bottom: .25rem; line-height: 1.3; }
.help-card-meta  { color: var(--aq-muted); font-size: .8rem; }

/* Rendered markdown body */
.markdown-body { max-width: 820px; line-height: 1.55; font-size: .95rem; background: #fff; padding: 1.5rem 1.75rem; border: 1px solid var(--aq-border); border-radius: 12px; box-shadow: var(--aq-shadow); }
.markdown-body h1 { font-size: 1.6rem; margin: 0 0 .5rem; padding-bottom: .35rem; border-bottom: 2px solid var(--aq-border); }
.markdown-body h2 { font-size: 1.25rem; margin: 1.4rem 0 .4rem; padding-bottom: .25rem; border-bottom: 1px solid var(--aq-border); }
.markdown-body h3 { font-size: 1.05rem; margin: 1.1rem 0 .3rem; }
.markdown-body h4 { font-size: .95rem; margin: 1rem 0 .25rem; color: var(--aq-muted); text-transform: uppercase; letter-spacing: .05em; }
.markdown-body p { margin: .55rem 0; }
.markdown-body ul, .markdown-body ol { margin: .55rem 0; padding-left: 1.5rem; }
.markdown-body li { margin: .2rem 0; }
.markdown-body strong { color: var(--aq-fg); }
.markdown-body code {
  background: #f1f5f9; padding: .1rem .35rem; border-radius: 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: .85em;
}
.markdown-body pre {
  background: #0f172a; color: #f1f5f9; padding: .85rem 1rem; border-radius: 8px;
  overflow-x: auto; margin: .75rem 0;
}
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body blockquote {
  border-left: 4px solid var(--aq-primary); padding: .25rem .85rem; margin: .75rem 0;
  background: rgba(14,116,144,.05); color: var(--aq-muted);
}
.markdown-body table { border-collapse: collapse; width: 100%; margin: .75rem 0; font-size: .88rem; }
.markdown-body table th, .markdown-body table td { border: 1px solid var(--aq-border); padding: .45rem .65rem; text-align: left; }
.markdown-body table th { background: #f8fafc; font-weight: 700; }
.markdown-body table tr:nth-child(even) td { background: #fafaf9; }
.markdown-body hr { border: none; border-top: 1px solid var(--aq-border); margin: 1.5rem 0; }
.markdown-body a { color: var(--aq-primary); }
.markdown-body img { max-width: 100%; border-radius: 8px; }
@media print {
  .topbar, .profile-strip, body::before { display: none !important; }
  .markdown-body { box-shadow: none; border: none; padding: 0; }
}

/* Misc */
.muted { color: var(--aq-muted); }
.small { font-size: .8rem; }
.right { text-align: right; }
.spacer { flex: 1; }

/* ---------------- Notify-butler popup (classic mode) ---------------- */
.notify-card { width: 460px; }
.notify-card h2 { margin: 0 0 .5rem; }
.notify-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

/* ---------------- Booking wizard (prefer_wizard=1) ---------------- */
.wiz-card { width: 720px; max-width: 96vw; padding: 1.4rem 1.5rem; }
.wiz-header { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.wiz-header h2 { margin: 0; font-size: 1.2rem; }
.wiz-header > div { flex: 1; }
.wiz-close { font-size: 1.1rem; }

.wiz-q { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600;
         display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.wiz-q .en { color: var(--aq-ink, #0f172a); }
.wiz-q .ar { color: var(--aq-muted); font-size: 1rem; font-weight: 500; }

.wiz-choices {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
}
@media (max-width: 640px) { .wiz-choices { grid-template-columns: repeat(2, 1fr); } }
.wiz-choice {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: 1.1rem .75rem; border: 2px solid var(--aq-border, #e2e8f0); border-radius: 14px;
  background: #fff; cursor: pointer; transition: transform .05s, border-color .1s, background .1s;
  font-family: inherit;
}
.wiz-choice:hover  { border-color: var(--aq-primary-2, #0ea5a3); background: #f0fdfa; }
.wiz-choice:active { transform: scale(.97); }
.wiz-choice .wiz-ico { font-size: 2.3rem; line-height: 1; }
.wiz-choice .wiz-en  { font-weight: 600; font-size: .95rem; color: #0f172a; }
.wiz-choice .wiz-ar  { font-size: .9rem; color: var(--aq-muted); }

.c-reserve { border-color: #bae6fd; }
.c-vip     { border-color: #fde68a; }
.c-clean   { border-color: #fed7aa; }
.c-free    { border-color: #bbf7d0; }
.c-maint   { border-color: #ddd6fe; }
.c-block   { border-color: #fecaca; }

.wiz-counter { display: flex; flex-direction: column; gap: .9rem; max-width: 460px; margin: 0 auto; }
.wiz-counter-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1.1rem; border: 2px solid var(--aq-border, #e2e8f0); border-radius: 12px; background: #fff;
}
.wiz-counter-row .lbl { display: flex; align-items: center; gap: .55rem; }
.wiz-counter-row .lbl .ico { font-size: 1.8rem; }
.wiz-counter-row .lbl .en  { font-weight: 600; font-size: 1rem; }
.wiz-counter-row .lbl .ar  { color: var(--aq-muted); font-size: .9rem; }
.wiz-counter-row .ctrl { display: flex; align-items: center; gap: .75rem; }
.wiz-step-btn {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; font-size: 1.4rem; font-weight: 700; border: 2px solid var(--aq-border);
  background: #fff; cursor: pointer;
}
.wiz-step-btn:hover { background: #f0fdfa; border-color: var(--aq-primary-2, #0ea5a3); }
.wiz-counter-val { min-width: 2rem; text-align: center; font-size: 1.6rem; font-weight: 700; }

#wiz-guest-name {
  width: 100%; padding: .9rem 1rem; font-size: 1.15rem;
  border: 2px solid var(--aq-border); border-radius: 12px; background: #fff;
}
#wiz-guest-name:focus { outline: 2px solid var(--aq-primary-2); border-color: var(--aq-primary-2); }

.wiz-lang { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (max-width: 640px) { .wiz-lang { grid-template-columns: repeat(2, 1fr); } }
.wiz-lang-btn {
  display: flex; align-items: center; gap: .55rem; padding: .8rem 1rem;
  border: 2px solid var(--aq-border); border-radius: 12px; background: #fff;
  cursor: pointer; font-family: inherit; font-size: .95rem; text-align: left;
}
.wiz-lang-btn:hover { background: #f0fdfa; border-color: var(--aq-primary-2); }
.wiz-lang-btn.on    { background: #ccfbf1; border-color: var(--aq-primary-2); }
.wiz-lang-btn .flag { font-size: 1.6rem; line-height: 1; }

.wiz-summary { display: flex; flex-direction: column; gap: .55rem; }
.wiz-sum-row {
  display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: center; gap: .75rem;
  padding: .75rem 1rem; background: #f8fafc; border-radius: 10px;
}
.wiz-sum-row .ico { font-size: 1.7rem; line-height: 1; text-align: center; }
.wiz-sum-row .ar  { color: var(--aq-muted); font-size: .9rem; }

.wiz-notify-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 640px) { .wiz-notify-actions { grid-template-columns: 1fr; } }
.wiz-big-btn {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: 1.2rem .8rem; border-radius: 14px; cursor: pointer; font-family: inherit;
  border: 2px solid var(--aq-border); background: #fff;
}
.wiz-big-btn.primary { border-color: var(--aq-primary-2); background: #ccfbf1; }
.wiz-big-btn.ghost   { color: #475569; }
.wiz-big-btn .wiz-ico { font-size: 2.1rem; line-height: 1; }
.wiz-big-btn .wiz-en  { font-weight: 600; }
.wiz-big-btn .wiz-ar  { color: var(--aq-muted); font-size: .9rem; }

.wiz-footer { display: flex; gap: .5rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }
.wiz-footer .en, .wiz-footer .ar { display: inline; }

/* ---------------- Language visibility (html[data-lang]) ---------------- */
/* Default (no attribute, or "both"): show both EN + AR inline. */
.i18n { display: inline; }
.i18n .en, .i18n .ar { display: inline; }
.i18n .ar { color: var(--aq-muted); font-size: .9em; margin-inline-start: .35em; }
.i18n .ar::before { content: '· '; }

html[data-lang="en"] .i18n .ar,
html[data-lang="en"] .wiz-ar,
html[data-lang="en"] .ar { display: none !important; }
html[data-lang="ar"] .i18n .en,
html[data-lang="ar"] .wiz-en,
html[data-lang="ar"] .en { display: none !important; }
html[data-lang="ar"] .i18n .ar { color: inherit; font-size: inherit; margin-inline-start: 0; }
html[data-lang="ar"] .i18n .ar::before { content: ''; }

/* In AR-only mode flip the global direction for layout-aware widgets. */
html[data-lang="ar"] body { direction: rtl; }

/* ---------------- Top-bar prefs group (Wizard / Lang flips) ---------------- */
.topbar-prefs { display: flex; gap: .55rem; align-items: center; margin-inline: .5rem; }
.pref-group {
  display: inline-flex; background: rgba(255,255,255,.16); border-radius: 999px; padding: 2px;
  gap: 2px;
}
.pref-btn {
  font: inherit; border: 0; cursor: pointer; padding: .25rem .65rem; border-radius: 999px;
  background: transparent; color: rgba(255,255,255,.85); font-size: .8rem; line-height: 1.1;
}
.pref-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.pref-btn.on    { background: #fff; color: var(--aq-primary, #0e7490); font-weight: 600; }
.pref-btn .i18n .ar { font-size: .85em; }
@media (max-width: 720px) { .topbar-prefs { display: none; } }

/* ---------------- Wizard: per-person names step ---------------- */
.wiz-persons { display: flex; flex-direction: column; gap: .5rem; max-width: 520px; margin: 0 auto; }
.wiz-person-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; border: 1px solid var(--aq-border); border-radius: 10px; background: #fff;
}
.wiz-person-row .badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.2rem; padding: .2rem .5rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700;
}
.wiz-person-row .badge.adult { background: #ccfbf1; color: #0f766e; }
.wiz-person-row .badge.child { background: #fef3c7; color: #92400e; }
.wiz-person-row input {
  flex: 1; border: 0; outline: 0; padding: .4rem .25rem; font-size: 1rem; background: transparent;
}
.wiz-person-row[data-lead="1"] input { color: var(--aq-muted); font-style: italic; }

/* ---------------- Returning-guest badge (cabana TV + butler card) ---------------- */
.welcome-badge {
  display: inline-block; padding: .3rem .75rem; margin-bottom: .55rem;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; font-size: .85rem; letter-spacing: .04em; font-weight: 600;
  backdrop-filter: blur(4px);
}
.welcome.is-vip .welcome-badge { background: linear-gradient(90deg,#fbbf24,#f59e0b); color:#1f1208; border-color:#fde68a; }
.welcome.is-returning .welcome-badge { background: rgba(99, 102, 241, .35); border-color: rgba(165, 180, 252, .5); }

.cabana.has-history { box-shadow: 0 0 0 2px rgba(99,102,241,.4) inset; }
.cabana .ret-badge {
  position: absolute; top: 6px; right: 8px;
  font-size: .7rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px;
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe;
}
.cabana .ret-badge.vip { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cabana { position: relative; }     /* ret-badge anchor */

/* Guests admin table */
.guest-row.vip { background: #fffbeb; }

/* ---------------- Duty board (drag-and-drop) ---------------- */
.duty-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: 220px;
  gap: .75rem; padding-bottom: 1rem; overflow-x: auto;
}
.dboard-col {
  background: var(--aq-card, #fff); border: 1px solid var(--aq-border); border-radius: 12px;
  display: flex; flex-direction: column; min-height: 70vh;
}
.dboard-col header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .8rem; border-bottom: 1px solid var(--aq-border);
  background: #f8fafc; border-radius: 12px 12px 0 0;
}
.dboard-col header h3 { margin: 0; font-size: .95rem; }
.dboard-col header .count {
  background: var(--aq-primary-2, #0ea5a3); color: #fff;
  font-weight: 700; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; min-width: 1.6rem; text-align: center;
}
.dboard-pool header { background: #eef2ff; }
.dboard-pool header .count { background: #4f46e5; }

.dboard-drop {
  flex: 1; padding: .5rem; display: flex; flex-direction: column; gap: .35rem; overflow-y: auto;
}
.dboard-drop.over { background: rgba(14,165,163,.08); outline: 2px dashed var(--aq-primary-2); outline-offset: -4px; }

.dboard-cab {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .5rem;
  padding: .45rem .65rem; background: #fff; border-radius: 8px;
  border-left: 4px solid var(--zone-color, #0e7490);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  cursor: grab; user-select: none;
}
.dboard-cab.dragging { opacity: .4; cursor: grabbing; }
.dboard-cab .cab-num  { font-weight: 700; font-size: .95rem; }
.dboard-cab .cab-zone { color: var(--aq-muted); font-size: .8rem; }

.duty-board::-webkit-scrollbar { height: 10px; }
.duty-board::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }

.dboard-col header .shift-pill {
  display: inline-block; margin-left: .35rem; padding: .05rem .45rem;
  font-size: .65rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: #ecfeff; color: #155e75; border: 1px solid #a5f3fc; border-radius: 999px;
}

/* ---------------- Emergency styling ---------------- */
@keyframes em-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.55); }
  50%     { box-shadow: 0 0 0 14px rgba(220,38,38,0); }
}
@keyframes em-flash {
  0%,100% { background: #fee2e2; }
  50%     { background: #fca5a5; }
}

/* Cabana TV emergency button + confirm card */
.big-btn.emergency {
  background: linear-gradient(180deg,#dc2626,#991b1b); color:#fff;
  font-weight: 800; letter-spacing: .05em;
  border: 2px solid #fecaca;
  animation: em-pulse 1.4s infinite;
}
.big-btn.emergency:hover { filter: brightness(1.08); }
.cab-modal-card.emerg-card { border: 3px solid #dc2626; }
.cab-modal-card.emerg-card h2 { color: #991b1b; }

/* Butler/manager call card when reason=emergency */
.alert-card.kind-emergency {
  border-left: 6px solid #dc2626 !important;
  background: #fff5f5;
  animation: em-flash 1s infinite;
}
.alert-card.kind-emergency strong, .alert-card.kind-emergency .alert-body { color: #7f1d1d; }

/* Agent grid cabana card with active emergency call */
.cabana.emergency {
  outline: 3px solid #dc2626; outline-offset: -1px;
  animation: em-pulse 1.4s infinite;
  background: #fee2e2 !important;
}
.cabana .emergency-pill {
  position: absolute; left: 6px; top: 6px;
  background: #dc2626; color: #fff; font-weight: 800; font-size: .7rem; letter-spacing: .06em;
  padding: .1rem .4rem; border-radius: 4px;
}

/* Manager dashboard top banner */
.emerg-banner {
  position: sticky; top: 0; z-index: 80;
  background: #dc2626; color: #fff;
  padding: .55rem .9rem; font-weight: 700;
  border-bottom: 2px solid #991b1b;
  display: flex; flex-direction: column; gap: .35rem;
  animation: em-flash 1.4s infinite;
}
.emerg-banner .emerg-row { font-size: .95rem; }

/* ---------------- Butler KPIs ---------------- */
.adm-table.kpi-timeline td { font-variant-numeric: tabular-nums; }
.adm-table .row-emergency { background: #fef2f2; }
.adm-table .row-emergency td:first-child { border-left: 4px solid #dc2626; }
.badge-em {
  display: inline-block; background: #dc2626; color: #fff;
  padding: .05rem .45rem; border-radius: 999px; font-weight: 700; font-size: .75rem;
}
.btn.ghost.on { background: #0e7490; color: #fff; }
