/* =========================================================================
   TricomHub Hi-Fi Design System
   Session 19 — Acacia & Stone palette.
   Primary #1E3A3A · Accent #D97757 (light) / #E89171 (dark WCAG AA-lifted)
   Light bg #FAF7F2 Raw Linen · Dark bg #111827 Obsidian
   Typography: Instrument Serif (headings) · Inter (body) · JetBrains Mono (numerics)
   ========================================================================= */

/* ---- Font loading (Google Fonts; swap for self-hosted later) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@400;500;600;700&display=swap');

/* ---- Shell components ------------------------------------------------- */
@import url('components/sidebar.css');
@import url('components/breadcrumb.css');
@import url('components/footer-marketing.css');
@import url('components/footer-admin.css');
@import url('components/undo-banner.css');
@import url('components/table-card-toggle.css');
@import url('components/wizard.css');
@import url('components/pub-breadcrumb.css');

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; margin: 0; }

/* ---- Tokens: light mode (default) ------------------------------------- */
:root {
  /* Acacia & Stone palette — light mode */
  --wf-bg:          #FAF7F2;  /* Raw Linen */
  --wf-surface:     #FFFFFF;
  --wf-surface-2:   #F3EFE7;  /* Warm tint, used for grouped panels + table striping */
  --wf-line:        #D9CBB0;  /* Warm hairline — darkened from #E5DDCF after recalibration so .wf-card--flat borders don't vanish on Raw Linen bg */
  --wf-fill:        #D9CDB8;
  --wf-fill-strong: #B5A584;
  --wf-text-faint:  #8A9090;
  --wf-text-muted:  #6B7A7A;
  --wf-text:        #3A4A4A;
  --wf-text-strong: #1E3A3A;  /* Acacia Shade */
  --wf-ink:         #1E3A3A;
  --wf-primary:     #1E3A3A;  /* Acacia Shade primary */
  --wf-accent:      #D97757;  /* Terracotta */
  --wf-accent-soft: #E8A586;  /* Terracotta 40% lift for hover/glow */
  --wf-accent-ink:  #FAF7F2;  /* Text on accent-filled buttons */

  /* Semantic (tuned to warm palette) */
  --wf-ok:          #4A7C7E;  /* Teal — harmonises with Acacia Shade */
  --wf-warn:        #C77B3E;  /* Amber, cousin of Terracotta */
  --wf-err:         #A94E4E;  /* Muted brick */

  /* Spacing scale */
  --wf-s-1: 4px;
  --wf-s-2: 8px;
  --wf-s-3: 12px;
  --wf-s-4: 16px;
  --wf-s-5: 24px;
  --wf-s-6: 32px;
  --wf-s-7: 48px;
  --wf-s-8: 64px;

  /* Typography — Acacia & Stone */
  --wf-font-heading: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --wf-font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --wf-font-mono:    'JetBrains Mono', 'SF Mono', Consolas, Menlo, monospace;
  --wf-font-arabic:  'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  --wf-font:         var(--wf-font-body);  /* body default */

  /* Type scale: expanded for hi-fi hierarchy.
     Display + h1/h2 use Instrument Serif (airy, editorial).
     h3/h4/h5 + body/small/micro use Inter (UI clarity). */
  --wf-fs-display: 48px; --wf-lh-display: 54px;
  --wf-fs-h1:      32px; --wf-lh-h1:      38px;
  --wf-fs-h2:      24px; --wf-lh-h2:      30px;
  --wf-fs-h3:      20px; --wf-lh-h3:      26px;
  --wf-fs-h4:      16px; --wf-lh-h4:      22px;
  --wf-fs-h5:      14px; --wf-lh-h5:      20px;
  --wf-fs-body:    15px; --wf-lh-body:    23px;
  --wf-fs-small:   13px; --wf-lh-small:   18px;
  --wf-fs-micro:   12px; --wf-lh-micro:   16px;

  /* Radii */
  --wf-r-sm: 4px;
  --wf-r-md: 8px;
  --wf-r-lg: 12px;
  --wf-r-pill: 999px;

  /* Elevation */
  --wf-shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --wf-shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --wf-shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

/* ---- Tokens: dark mode ------------------------------------------------- */
[data-mode="dark"] {
  --wf-bg:          #111827;  /* Obsidian */
  --wf-surface:     #1B2632;
  --wf-surface-2:   #273241;
  --wf-line:        #37414F;
  --wf-fill:        #3E4B5B;
  --wf-fill-strong: #5C6B7D;
  --wf-text-faint:  #7A8890;
  --wf-text-muted:  #9CA8AA;
  --wf-text:        #D4CFC5;
  --wf-text-strong: #FAF7F2;
  --wf-ink:         #FAF7F2;
  --wf-primary:     #FAF7F2;  /* Inverted primary on dark — text-strong doubles as primary ink */
  --wf-accent:      #E89171;  /* Terracotta lifted for WCAG AA on Obsidian surface (~4.8:1 body) */
  --wf-accent-soft: #F0B39A;
  --wf-accent-ink:  #111827;  /* Text on accent-filled buttons (Obsidian on lifted Terracotta) */

  /* Semantic rebalanced for dark */
  --wf-ok:          #6FA5A7;
  --wf-warn:        #E8A05A;
  --wf-err:         #D87878;

  --wf-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --wf-shadow-md: 0 2px 8px rgba(0,0,0,0.35);
  --wf-shadow-lg: 0 12px 32px rgba(0,0,0,0.45);
}

/* ---- Base -------------------------------------------------------------- */
html { font-family: var(--wf-font); font-size: var(--wf-fs-body); line-height: var(--wf-lh-body); }
body {
  background: var(--wf-bg);
  color: var(--wf-text);
  font-family: var(--wf-font);
  font-size: var(--wf-fs-body);
  line-height: var(--wf-lh-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.wf-display { font-family: var(--wf-font-heading); font-size: var(--wf-fs-display); line-height: var(--wf-lh-display); font-weight: 400; margin: 0; color: var(--wf-text-strong); letter-spacing: -0.01em; }
h1, .wf-h1 { font-family: var(--wf-font-heading); font-size: var(--wf-fs-h1); line-height: var(--wf-lh-h1); font-weight: 400; margin: 0; color: var(--wf-text-strong); letter-spacing: -0.005em; }
h2, .wf-h2 { font-family: var(--wf-font-heading); font-size: var(--wf-fs-h2); line-height: var(--wf-lh-h2); font-weight: 400; margin: 0; color: var(--wf-text-strong); }
h3, .wf-h3 { font-family: var(--wf-font-body);    font-size: var(--wf-fs-h3); line-height: var(--wf-lh-h3); font-weight: 600; margin: 0; color: var(--wf-text-strong); }
h4, .wf-h4 { font-family: var(--wf-font-body);    font-size: var(--wf-fs-h4); line-height: var(--wf-lh-h4); font-weight: 600; margin: 0; color: var(--wf-text-strong); }
h5, .wf-h5 { font-family: var(--wf-font-body);    font-size: var(--wf-fs-h5); line-height: var(--wf-lh-h5); font-weight: 600; margin: 0; color: var(--wf-text-strong); letter-spacing: 0.02em; text-transform: uppercase; }
p, .wf-p { margin: 0; }
small, .wf-small { font-size: var(--wf-fs-small); line-height: var(--wf-lh-small); color: var(--wf-text-muted); }
.wf-micro { font-size: var(--wf-fs-micro); line-height: var(--wf-lh-micro); color: var(--wf-text-muted); }
.wf-mono  { font-family: var(--wf-font-mono); font-feature-settings: 'tnum' 1, 'zero' 1; }
.wf-muted { color: var(--wf-text-muted); }
.wf-faint { color: var(--wf-text-faint); }

/* Arabic shift: RTL swaps body + heading to Noto Kufi Arabic (latin fallbacks preserved) */
[dir="rtl"] { --wf-font-heading: var(--wf-font-arabic); --wf-font-body: var(--wf-font-arabic); --wf-font: var(--wf-font-arabic); }

/* ---- Layout primitives ------------------------------------------------- */
.wf-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--wf-bg); }
.wf-container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--wf-s-4); }
.wf-main { flex: 1; padding: var(--wf-s-5) 0; }
.wf-section { padding: var(--wf-s-6) 0; }
.wf-divider { height: 1px; background: var(--wf-line); border: 0; margin: var(--wf-s-5) 0; }

.wf-stack { display: flex; flex-direction: column; gap: var(--wf-s-3); }
.wf-stack--lg { gap: var(--wf-s-5); }
.wf-stack--sm { gap: var(--wf-s-2); }
.wf-row { display: flex; flex-direction: row; align-items: center; gap: var(--wf-s-3); }
.wf-row--between { justify-content: space-between; }
.wf-row--end { justify-content: flex-end; }
.wf-row--wrap { flex-wrap: wrap; }
.wf-grow { flex: 1; }

.wf-grid {
  display: grid;
  gap: var(--wf-s-4);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.wf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.wf-grid--3 { grid-template-columns: repeat(3, 1fr); }
.wf-grid--4 { grid-template-columns: repeat(4, 1fr); }
.wf-grid--magazine { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--wf-s-5); }
.wf-grid--compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--wf-s-3); }

@media (max-width: 900px) {
  .wf-grid--2, .wf-grid--3, .wf-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .wf-grid, .wf-grid--2, .wf-grid--3, .wf-grid--4, .wf-grid--magazine, .wf-grid--compact { grid-template-columns: 1fr; }
}

/* ---- Placeholders (the mountain-in-frame is the hero icon) ------------- */
.wf-placeholder-img {
  background: var(--wf-fill);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wf-fill-strong);
  min-height: 120px;
  position: relative;
  overflow: hidden;
}
.wf-placeholder-img::before {
  content: "";
  display: block;
  width: 40%;
  height: 40%;
  max-width: 80px;
  max-height: 80px;
  background: var(--wf-fill-strong);
  -webkit-mask: url("../assets/icons/placeholder.svg") center / contain no-repeat;
  mask: url("../assets/icons/placeholder.svg") center / contain no-repeat;
  opacity: 0.65;
}
.wf-placeholder-img--16-9 { aspect-ratio: 16/9; }
.wf-placeholder-img--4-3 { aspect-ratio: 4/3; }
.wf-placeholder-img--square { aspect-ratio: 1/1; }
.wf-placeholder-img--hero { aspect-ratio: 21/9; min-height: 240px; }

/* Inline placeholder "lines" for copy */
.wf-line-ph { display: block; height: 10px; background: var(--wf-fill); border-radius: var(--wf-r-sm); margin-bottom: var(--wf-s-2); }
.wf-line-ph--strong { background: var(--wf-fill-strong); height: 12px; }
.wf-line-ph--w-50 { width: 50%; }
.wf-line-ph--w-70 { width: 70%; }
.wf-line-ph--w-80 { width: 80%; }
.wf-line-ph--w-100 { width: 100%; }

/* ---- Buttons ----------------------------------------------------------- */
.wf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wf-s-2);
  min-height: 36px;
  padding: 0 var(--wf-s-4);
  border-radius: var(--wf-r-md);
  border: 1px solid var(--wf-line);
  background: var(--wf-surface);
  color: var(--wf-text);
  font-size: var(--wf-fs-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.wf-btn:hover { background: var(--wf-surface-2); }
.wf-btn--primary { background: var(--wf-text-strong); color: var(--wf-bg); border-color: var(--wf-text-strong); }
.wf-btn--primary:hover { background: var(--wf-ink); }
.wf-btn--ghost { background: transparent; border-color: transparent; }
.wf-btn--ghost:hover { background: var(--wf-surface-2); }
.wf-btn--danger { background: transparent; border-color: var(--wf-err); color: var(--wf-err); }
.wf-btn--icon { min-width: 36px; padding: 0; }
.wf-btn--lg { min-height: 48px; padding: 0 var(--wf-s-5); font-size: var(--wf-fs-h4); }
.wf-btn--sm { min-height: 28px; padding: 0 var(--wf-s-3); font-size: var(--wf-fs-small); }
.wf-btn--block { width: 100%; }
.wf-btn[disabled], .wf-btn--disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Inputs ------------------------------------------------------------ */
.wf-input, .wf-select, .wf-textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: var(--wf-s-2) var(--wf-s-3);
  background: var(--wf-bg);
  color: var(--wf-text);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-r-md);
  font-size: var(--wf-fs-body);
  line-height: var(--wf-lh-body);
}
.wf-textarea { min-height: 96px; resize: vertical; }
.wf-input:focus, .wf-select:focus, .wf-textarea:focus { outline: 2px solid var(--wf-fill-strong); outline-offset: 1px; }

/* Range input — force greyscale across browsers (default accent leaks purple on Windows) */
input[type="range"], .wf-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; background: var(--wf-line); border-radius: var(--wf-r-pill);
  accent-color: var(--wf-text-strong); cursor: pointer; outline: none;
}
input[type="range"]::-webkit-slider-thumb, .wf-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--wf-text-strong); border: 2px solid var(--wf-bg); cursor: pointer;
}
input[type="range"]::-moz-range-thumb, .wf-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--wf-bg);
  background: var(--wf-text-strong); cursor: pointer;
}
input[type="range"]::-moz-range-track, .wf-range::-moz-range-track {
  height: 4px; background: var(--wf-line); border-radius: var(--wf-r-pill);
}

/* Checkbox + radio — force greyscale accent (default also leaks) */
input[type="checkbox"], input[type="radio"] { accent-color: var(--wf-text-strong); }
.wf-label { display: block; font-size: var(--wf-fs-small); color: var(--wf-text-muted); margin-bottom: var(--wf-s-1); }
.wf-field { display: flex; flex-direction: column; gap: var(--wf-s-1); margin-bottom: var(--wf-s-3); }
.wf-field-hint { font-size: var(--wf-fs-small); color: var(--wf-text-faint); }
.wf-field-err { font-size: var(--wf-fs-small); color: var(--wf-err); }

.wf-check, .wf-radio {
  display: inline-flex; align-items: center; gap: var(--wf-s-2); cursor: pointer; font-size: var(--wf-fs-body);
}
.wf-check-box, .wf-radio-box {
  display: inline-block; width: 16px; height: 16px; border: 1px solid var(--wf-fill-strong); background: var(--wf-bg); border-radius: var(--wf-r-sm); flex-shrink: 0;
}
.wf-radio-box { border-radius: 50%; }
.wf-check--on .wf-check-box { background: var(--wf-text-strong); border-color: var(--wf-text-strong); }
.wf-radio--on .wf-radio-box { background: var(--wf-text-strong); border-color: var(--wf-text-strong); box-shadow: inset 0 0 0 3px var(--wf-bg); }

.wf-otp-row { display: flex; gap: var(--wf-s-2); }
.wf-otp-cell {
  width: 44px; height: 52px; border: 1px solid var(--wf-line); border-radius: var(--wf-r-md);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--wf-text-strong); background: var(--wf-surface);
}

.wf-switch {
  width: 36px; height: 20px; background: var(--wf-fill); border-radius: var(--wf-r-pill); position: relative;
}
.wf-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: var(--wf-bg); border-radius: 50%;
}
.wf-switch--on { background: var(--wf-text-strong); }
.wf-switch--on::after { left: 18px; }

/* ---- Cards ------------------------------------------------------------- */
.wf-card {
  background: var(--wf-surface);
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-r-lg);
  padding: var(--wf-s-4);
  display: flex;
  flex-direction: column;
  gap: var(--wf-s-3);
}
.wf-card--flat { background: transparent; border-color: var(--wf-line); }
.wf-card--hoverable { cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.wf-card--hoverable:hover { box-shadow: var(--wf-shadow-md); transform: translateY(-2px); }
.wf-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--wf-s-3); }
.wf-card-title { font-family: var(--wf-font-body); font-size: var(--wf-fs-h3); font-weight: 600; color: var(--wf-text-strong); margin: 0; }
.wf-card-meta { font-size: var(--wf-fs-small); color: var(--wf-text-muted); }
.wf-card-body { display: flex; flex-direction: column; gap: var(--wf-s-2); }
.wf-card-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--wf-s-3); padding-top: var(--wf-s-3); border-top: 1px solid var(--wf-line); }

/* ---- Nav --------------------------------------------------------------- */
.wf-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--wf-s-4);
  padding: var(--wf-s-3) var(--wf-s-4);
  background: var(--wf-bg);
  border-bottom: 1px solid var(--wf-line);
  min-height: 56px;
}
.wf-nav-brand { display: inline-flex; align-items: center; gap: var(--wf-s-2); font-weight: 600; color: var(--wf-text-strong); }
.wf-nav-brand-mark { width: 24px; height: 24px; background: var(--wf-text-strong); border-radius: var(--wf-r-sm); }
.wf-nav-links { display: flex; gap: var(--wf-s-4); margin-left: var(--wf-s-4); }
.wf-nav-link { color: var(--wf-text-muted); font-size: var(--wf-fs-body); }
.wf-nav-link--active { color: var(--wf-text-strong); font-weight: 500; }
.wf-nav-actions { margin-left: auto; display: flex; align-items: center; gap: var(--wf-s-2); }
.wf-hamburger { display: none; }

@media (max-width: 768px) {
  .wf-nav-links { display: none; }
  .wf-hamburger { display: inline-flex; }
}

/* ---- Sidebar ----------------------------------------------------------- */
.wf-shell { display: flex; min-height: 100vh; }
.wf-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--wf-surface);
  border-right: 1px solid var(--wf-line);
  padding: var(--wf-s-4);
  display: flex;
  flex-direction: column;
  gap: var(--wf-s-3);
}
.wf-sidebar-brand { display: inline-flex; align-items: center; gap: var(--wf-s-2); font-weight: 600; color: var(--wf-text-strong); margin-bottom: var(--wf-s-4); }
.wf-sidebar-section { font-size: var(--wf-fs-small); color: var(--wf-text-faint); text-transform: uppercase; letter-spacing: 0.03em; padding: var(--wf-s-2) var(--wf-s-3); margin-top: var(--wf-s-3); }
.wf-sidebar-link {
  display: flex; align-items: center; gap: var(--wf-s-3);
  padding: var(--wf-s-2) var(--wf-s-3); border-radius: var(--wf-r-md);
  color: var(--wf-text-muted); font-size: var(--wf-fs-body);
}
.wf-sidebar-link:hover { background: var(--wf-surface-2); color: var(--wf-text-strong); }
.wf-sidebar-link--active { background: var(--wf-surface-2); color: var(--wf-text-strong); font-weight: 500; }
.wf-sidebar-icon { width: 16px; height: 16px; background: var(--wf-fill-strong); border-radius: var(--wf-r-sm); flex-shrink: 0; }
.wf-shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

@media (max-width: 900px) {
  .wf-sidebar { display: none; }
}

/* ---- Bottom nav (mobile-native variants can force this everywhere) ----- */
.wf-bottom-nav {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--wf-bg);
  border-top: 1px solid var(--wf-line);
  padding: var(--wf-s-2) 0;
  min-height: 56px;
}
.wf-bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--wf-text-muted); font-size: 10px; flex: 1;
}
.wf-bottom-nav-item--active { color: var(--wf-text-strong); }
.wf-bottom-nav-icon { width: 22px; height: 22px; background: var(--wf-fill-strong); border-radius: var(--wf-r-sm); }

/* ---- Badges, chips ----------------------------------------------------- */
.wf-badge {
  display: inline-flex; align-items: center; gap: var(--wf-s-1);
  padding: 2px var(--wf-s-2); min-height: 20px;
  background: var(--wf-surface-2); color: var(--wf-text); border-radius: var(--wf-r-pill);
  font-size: var(--wf-fs-small); font-weight: 500;
}
.wf-badge--outline { background: transparent; border: 1px solid var(--wf-line); }
.wf-badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--wf-fill-strong); }
.wf-badge--ok { color: var(--wf-ok); }
.wf-badge--ok.wf-badge--dot::before { background: var(--wf-ok); }
.wf-badge--warn { color: var(--wf-warn); }
.wf-badge--warn.wf-badge--dot::before { background: var(--wf-warn); }
.wf-badge--err { color: var(--wf-err); }
.wf-badge--err.wf-badge--dot::before { background: var(--wf-err); }

.wf-chip {
  display: inline-flex; align-items: center; gap: var(--wf-s-1);
  padding: var(--wf-s-1) var(--wf-s-3); border-radius: var(--wf-r-pill);
  border: 1px solid var(--wf-line); background: var(--wf-surface); color: var(--wf-text-muted);
  font-size: var(--wf-fs-small);
}
.wf-chip--active { background: var(--wf-text-strong); color: var(--wf-bg); border-color: var(--wf-text-strong); }

/* ---- Avatar ------------------------------------------------------------ */
.wf-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--wf-fill); color: var(--wf-text-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--wf-fs-small); font-weight: 500; flex-shrink: 0;
}
.wf-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.wf-avatar--lg { width: 48px; height: 48px; font-size: var(--wf-fs-body); }
.wf-avatar--xl { width: 80px; height: 80px; font-size: 20px; }

/* ---- Table ------------------------------------------------------------- */
.wf-table { width: 100%; border-collapse: collapse; background: var(--wf-bg); }
.wf-table th, .wf-table td {
  text-align: left; padding: var(--wf-s-3) var(--wf-s-4);
  border-bottom: 1px solid var(--wf-line); font-size: var(--wf-fs-body);
}
.wf-table th { color: var(--wf-text-muted); font-weight: 500; font-size: var(--wf-fs-small); text-transform: uppercase; letter-spacing: 0.02em; }
.wf-table tr:hover td { background: var(--wf-surface); }
.wf-table--dense th, .wf-table--dense td { padding: var(--wf-s-2) var(--wf-s-3); }
.wf-table-wrap { border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg); overflow: hidden; }

/* ---- Tabs -------------------------------------------------------------- */
.wf-tabs { display: flex; gap: var(--wf-s-4); border-bottom: 1px solid var(--wf-line); }
.wf-tab { padding: var(--wf-s-3) 0; color: var(--wf-text-muted); border-bottom: 2px solid transparent; cursor: pointer; font-size: var(--wf-fs-body); }
.wf-tab--active { color: var(--wf-text-strong); border-bottom-color: var(--wf-text-strong); font-weight: 500; }
.wf-tabs--pill { border-bottom: 0; gap: var(--wf-s-2); }
.wf-tabs--pill .wf-tab { padding: var(--wf-s-2) var(--wf-s-3); border: 1px solid var(--wf-line); border-radius: var(--wf-r-pill); }
.wf-tabs--pill .wf-tab--active { background: var(--wf-text-strong); color: var(--wf-bg); border-color: var(--wf-text-strong); }

/* ---- Search / filters -------------------------------------------------- */
.wf-search {
  display: flex; align-items: center; gap: var(--wf-s-2);
  width: 100%; padding: var(--wf-s-2) var(--wf-s-3);
  background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: var(--wf-r-pill);
  color: var(--wf-text-muted);
}
.wf-search--hero {
  padding: var(--wf-s-3) var(--wf-s-4); font-size: 15px; border-radius: var(--wf-r-lg); background: var(--wf-bg);
  box-shadow: var(--wf-shadow-md);
}
.wf-search-box { flex: 1; background: transparent; border: 0; outline: none; color: var(--wf-text); font-size: inherit; }

/* ---- Modal / overlay --------------------------------------------------- */
.wf-modal-backdrop {
  position: fixed; inset: 0; background: rgba(17,24,39,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 20;
  padding: var(--wf-s-4);
}
.wf-modal {
  width: 100%; max-width: 480px;
  background: var(--wf-bg); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg);
  padding: var(--wf-s-5); display: flex; flex-direction: column; gap: var(--wf-s-4);
  box-shadow: var(--wf-shadow-lg);
}
.wf-modal--sm { max-width: 360px; }
.wf-modal--md { max-width: 560px; }
.wf-modal--lg { max-width: 720px; }
.wf-modal--full { max-width: 100%; height: 100%; border-radius: 0; border: 0; }
.wf-modal-title { font-size: 18px; font-weight: 600; color: var(--wf-text-strong); margin: 0; }
.wf-modal-actions { display: flex; justify-content: flex-end; gap: var(--wf-s-2); }

/* ---- Toast ------------------------------------------------------------- */
.wf-toast {
  display: flex; align-items: flex-start; gap: var(--wf-s-3);
  padding: var(--wf-s-3) var(--wf-s-4);
  background: var(--wf-bg); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg);
  box-shadow: var(--wf-shadow-md); max-width: 360px;
}
.wf-toast-icon { width: 20px; height: 20px; background: var(--wf-fill-strong); border-radius: 50%; flex-shrink: 0; }
.wf-toast--ok .wf-toast-icon { background: var(--wf-ok); }
.wf-toast--warn .wf-toast-icon { background: var(--wf-warn); }
.wf-toast--err .wf-toast-icon { background: var(--wf-err); }
.wf-toast-body { flex: 1; }
.wf-toast-title { font-weight: 600; color: var(--wf-text-strong); font-size: var(--wf-fs-body); }
.wf-toast-msg { font-size: var(--wf-fs-small); color: var(--wf-text-muted); }

/* ---- Progress, step indicators ---------------------------------------- */
.wf-progress { height: 4px; background: var(--wf-surface-2); border-radius: var(--wf-r-pill); overflow: hidden; }
.wf-progress-bar { height: 100%; background: var(--wf-text-strong); }

.wf-stepper { display: flex; align-items: center; gap: var(--wf-s-2); }
.wf-step { display: inline-flex; align-items: center; gap: var(--wf-s-2); color: var(--wf-text-muted); font-size: var(--wf-fs-small); }
.wf-step-n {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--wf-surface-2); color: var(--wf-text-muted);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 500;
}
.wf-step--done .wf-step-n, .wf-step--active .wf-step-n { background: var(--wf-text-strong); color: var(--wf-bg); }
.wf-step--active { color: var(--wf-text-strong); font-weight: 500; }
.wf-step-line { flex: 1; height: 1px; background: var(--wf-line); }

/* ---- Empty / loading states ------------------------------------------- */
.wf-empty {
  text-align: center; padding: var(--wf-s-7) var(--wf-s-4);
  color: var(--wf-text-muted); display: flex; flex-direction: column; align-items: center; gap: var(--wf-s-3);
}
.wf-empty-icon { width: 48px; height: 48px; background: var(--wf-fill); border-radius: var(--wf-r-lg); }
.wf-skeleton { background: linear-gradient(90deg, var(--wf-surface-2), var(--wf-line), var(--wf-surface-2)); border-radius: var(--wf-r-sm); height: 10px; }

/* ---- Phone / email frames (for template mockups) ---------------------- */
.wf-phone-frame {
  width: 100%; max-width: 320px; margin: 0 auto;
  background: var(--wf-surface); border: 1px solid var(--wf-line);
  border-radius: 32px; padding: 12px; position: relative;
}
.wf-phone-frame::before {
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 80px; height: 18px; background: var(--wf-ink); border-radius: 999px;
}
.wf-phone-screen {
  background: var(--wf-bg); border-radius: 24px; padding: var(--wf-s-6) var(--wf-s-3) var(--wf-s-3);
  min-height: 480px; display: flex; flex-direction: column; gap: var(--wf-s-3);
}

.wf-email-frame {
  background: var(--wf-bg); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg); overflow: hidden;
}
.wf-email-header {
  padding: var(--wf-s-3) var(--wf-s-4); background: var(--wf-surface-2);
  border-bottom: 1px solid var(--wf-line); font-size: var(--wf-fs-small); color: var(--wf-text-muted);
  display: flex; flex-direction: column; gap: 2px;
}
.wf-email-body { padding: var(--wf-s-5); display: flex; flex-direction: column; gap: var(--wf-s-3); color: var(--wf-text); }

/* ---- Responsive helpers (applied globally, affect every variant) ------ */
/* Prevent horizontal page scroll */
html, body { overflow-x: hidden; max-width: 100%; }

/* Prevent any flex/grid item from forcing its parent wider than viewport —
   root cause of most mobile overflows: min-content child width > parent clientWidth */
*, *::before, *::after { min-width: 0; box-sizing: border-box; }

/* Mobile hard containment — nothing renders past viewport right edge */
@media (max-width: 768px) {
  html, body, main, section, article, header, footer,
  .wf-container, .wf-card, .wf-field, .wf-row, .wf-stack, .wf-grid,
  .wf-shell, .wf-shell-main, .wf-nav, .wf-hero, .wf-section {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  input, select, textarea, button,
  .wf-input, .wf-select, .wf-textarea, .wf-btn {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  input.wf-input, input[type="text"], input[type="email"], input[type="password"],
  input[type="tel"], input[type="number"], textarea, select.wf-select {
    width: 100% !important;
  }
}

/* Inputs/selects must never exceed their cell */
.wf-input, .wf-select, .wf-textarea, select, input, textarea {
  max-width: 100%;
}

/* Mobile: flex rows wrap, grid templates collapse, shell stacks */
@media (max-width: 768px) {
  .wf-row, .wf-row--between, .wf-row--end { flex-wrap: wrap; }

  /* Inline fixed-pixel grid templates on agent-authored pages collapse to single column */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Hard-cap structural blocks at viewport width */
  main, main.wf-main, main.wf-shell-main, section, article, .wf-card {
    max-width: 100%;
  }

  .wf-shell { flex-direction: column; }
  .wf-shell-main { width: 100%; }

  /* Tabs/chip rows scroll horizontally rather than overflowing */
  .wf-tabs:not(.wf-tabs--pill) {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .wf-tabs .wf-tab { flex-shrink: 0; }

  /* Chips + badges with long text truncate cleanly rather than forcing parents wider */
  .wf-chip, .wf-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Nav link lists wrap instead of overflowing */
  .wf-nav-links { flex-wrap: wrap; }
  .wf-nav-link { max-width: 100%; }

  /* .wf-grow inside narrow flex rows must allow shrink */
  .wf-grow { flex: 1 1 0; min-width: 0; }

  /* `.wf-container` shouldn't exceed viewport on mobile regardless of variant cap */
  .wf-container { max-width: 100%; }

  /* Images + frames never exceed their cell */
  img, .wf-placeholder-img, .wf-placeholder-img--hero, .wf-placeholder-img--4-3,
  .wf-placeholder-img--square, .wf-map, .wf-phone-frame, .wf-email-frame, iframe {
    max-width: 100%;
    height: auto;
  }

  /* Long text (booking refs, hotel names, SMS content) must break instead of pushing parents */
  .wf-card, .wf-card *, .wf-stack, .wf-stack *, .wf-grow, .wf-grow *,
  main, main *, section, article, article * {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Flex rows with an image + content: image capped, content takes remainder */
  .wf-row > .wf-placeholder-img,
  .wf-row > .wf-placeholder-img--4-3,
  .wf-row > .wf-placeholder-img--square,
  .wf-row > .wf-placeholder-img--hero {
    flex: 0 0 auto;
    max-width: 40%;
  }
}

/* ---- Mobile table card-stack (uses data-label attrs) ------------------ */
@media (max-width: 640px) {
  /* Any <table class="wf-table"> (optionally --dense) whose <td>s have data-label attrs
     converts to a stacked list of cards on mobile. Agents annotated V1/V2/V3 user-management,
     V2 support-tickets, V2 waitlist — these now render readable on mobile. */
  .wf-table td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--wf-s-3);
    border: 0;
    padding: 4px 0;
    font-size: var(--wf-fs-small);
    text-align: left;
  }
  .wf-table td[data-label]::before {
    content: attr(data-label);
    color: var(--wf-text-muted);
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 2px;
    flex-shrink: 0;
    min-width: 80px;
  }
  .wf-table td[data-label=""]::before { content: none; }
  /* When any td has data-label, convert the whole table */
  .wf-table:has(td[data-label]) {
    display: block;
    border: 0;
    background: transparent;
    white-space: normal;
  }
  .wf-table:has(td[data-label]) thead { display: none; }
  .wf-table:has(td[data-label]) tbody,
  .wf-table:has(td[data-label]) tr {
    display: block;
    width: 100%;
  }
  .wf-table:has(td[data-label]) tr {
    background: var(--wf-surface);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-r-md);
    padding: var(--wf-s-3);
    margin-bottom: var(--wf-s-2);
  }

  /* V5 inline-row pages (rooms-management, bookings-management): BEM __ columns stack */
  .wf-row[class*="__"],
  [class*="wf-room-row"],
  [class*="wf-booking-row"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: var(--wf-s-2);
  }
  /* data-col markers get a small uppercase label above the value for context */
  [data-col]:not(:empty)::before {
    content: attr(data-col);
    display: block;
    font-size: 10px;
    color: var(--wf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }
}

/* ---- Mobile tightening (<640px) ------------------------------------- */
@media (max-width: 640px) {

  /* Stat-card rows (inline grids of summary cards) collapse to single column */
  .wf-grid--2, .wf-grid--3, .wf-grid--4,
  div.wf-row.wf-row--between:has(> .wf-card),
  div.wf-row:has(> .wf-card),
  section > .wf-row:has(> .wf-card) {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }

  /* Buttons never push parents wider than viewport — clip text with ellipsis */
  .wf-btn {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* `.wf-nav-actions` flex row must wrap so Sign up / Sign out aren't cut off */
  .wf-nav-actions { flex-wrap: wrap; justify-content: flex-end; }
  .wf-nav-actions > * { flex-shrink: 0; }

  /* Filter-pill rows scroll horizontally, never wrap mid-word */
  .wf-row:has(> .wf-chip),
  .wf-row--wrap:has(> .wf-chip),
  .wf-filter-strip {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--wf-s-2);
    scrollbar-width: thin;
  }
  .wf-row:has(> .wf-chip) > .wf-chip,
  .wf-row--wrap:has(> .wf-chip) > .wf-chip,
  .wf-filter-strip > .wf-chip {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Top-nav: reduce to brand + hamburger at narrow widths. Keep chipbar on a 2nd row. */
  .wf-nav {
    min-height: 56px;
    padding: var(--wf-s-2) var(--wf-s-3);
  }
  .wf-nav > .wf-container .wf-nav-links,
  .wf-nav .wf-nav-links,
  .wf-nav .wf-nav-actions > a:not(.wf-btn--primary):not([id^="g-"]):not(.wf-chipbar a),
  .wf-nav .wf-nav-actions > button.wf-btn--ghost:not(.wf-hamburger):not([id^="g-"]) {
    display: none !important;
  }
  .wf-nav .wf-hamburger { display: inline-flex !important; }
  /* Primary action (Sign up / Reserve / etc.) can stay visible */
  .wf-nav .wf-btn--primary { display: inline-flex !important; }

  /* Booking widget detaches sticky position and stacks inline */
  .wf-booking-widget {
    position: static;
    box-shadow: none;
    border: 1px solid var(--wf-line);
  }

  /* V2 sidebar hidden + main takes full */
  .wf-shell { display: block; }
  .wf-sidebar { display: none; }
  .wf-shell-main { width: 100%; padding: 0; }
}

/* Tables scroll horizontally on narrow widths (keep table layout at desktop) */
.wf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
  .wf-table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  .wf-table thead, .wf-table tbody { display: table; width: max-content; min-width: 100%; }
}

/* Hero H1 responsive shrink */
@media (max-width: 600px) {
  .wf-hero-title { font-size: 28px !important; line-height: 32px !important; }
  .wf-hero { padding: var(--wf-s-5) 0 !important; }
}
@media (max-width: 900px) {
  .wf-hero-title { font-size: 36px; line-height: 40px; }
}

/* Booking widget stacks below content at tablet/mobile */
@media (max-width: 900px) {
  .wf-booking-widget { position: static; }
}

/* Nav collapse at narrow widths */
@media (max-width: 600px) {
  .wf-nav { padding: var(--wf-s-2) var(--wf-s-3); gap: var(--wf-s-2); min-height: 48px; flex-wrap: wrap; }
  .wf-nav-actions .wf-btn--sm:not(.wf-btn--primary):not([id^="g-"]) { display: none; }
  .wf-chipbar { order: 10; flex-basis: 100%; justify-content: flex-end; padding-top: var(--wf-s-2); border-top: 1px solid var(--wf-line); margin-top: var(--wf-s-2); }
}

/* Container padding shrinks on mobile */
@media (max-width: 600px) {
  .wf-container { padding: 0 var(--wf-s-3); }
  .wf-section { padding: var(--wf-s-5) 0; }
  .wf-card { padding: var(--wf-s-3); }
}

/* Multi-step stepper wraps on narrow */
@media (max-width: 600px) {
  .wf-stepper { flex-wrap: wrap; gap: var(--wf-s-2); }
  .wf-step { font-size: 10px; }
  .wf-step-line { flex: 0 0 auto; min-width: 12px; }
}

/* OTP input wraps */
@media (max-width: 400px) {
  .wf-otp-row { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .wf-otp-cell { width: 38px; height: 46px; font-size: 18px; }
}

/* Footer always stacks on mobile */
@media (max-width: 500px) {
  .wf-footer { padding: var(--wf-s-5) 0; }
  .wf-footer-cols { grid-template-columns: 1fr !important; gap: var(--wf-s-4); }
}

/* Images max-width safety */
.wf-placeholder-img, .wf-placeholder-img--hero { max-width: 100%; }

/* Form grids collapse on mobile */
@media (max-width: 600px) {
  [class*="wf-grid"] { grid-template-columns: 1fr !important; }
}

/* ---- Misc utility ------------------------------------------------------ */
.wf-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.wf-mt-1 { margin-top: var(--wf-s-1); }
.wf-mt-2 { margin-top: var(--wf-s-2); }
.wf-mt-3 { margin-top: var(--wf-s-3); }
.wf-mt-4 { margin-top: var(--wf-s-4); }
.wf-mt-5 { margin-top: var(--wf-s-5); }
.wf-mt-6 { margin-top: var(--wf-s-6); }
.wf-text-right { text-align: right; }
.wf-text-center { text-align: center; }

/* ---- Hero ------------------------------------------------------------- */
.wf-hero {
  padding: var(--wf-s-7) 0; display: flex; flex-direction: column; gap: var(--wf-s-4);
}
.wf-hero-title { font-size: 32px; line-height: 36px; font-weight: 600; color: var(--wf-text-strong); margin: 0; }
@media (min-width: 900px) {
  .wf-hero-title { font-size: 40px; line-height: 44px; }
}

/* ---- Sticky sidebar booking widget ------------------------------------ */
.wf-booking-widget {
  position: sticky; top: calc(var(--wf-s-5) + 56px);
  background: var(--wf-surface); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg);
  padding: var(--wf-s-4); display: flex; flex-direction: column; gap: var(--wf-s-3);
  box-shadow: var(--wf-shadow-md);
}

/* ---- Map placeholder -------------------------------------------------- */
.wf-map {
  background: var(--wf-surface-2); border: 1px solid var(--wf-line); border-radius: var(--wf-r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--wf-text-faint); min-height: 180px; font-size: var(--wf-fs-small);
  background-image:
    linear-gradient(var(--wf-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--wf-line) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
}

/* ---- Chat bubble ------------------------------------------------------ */
.wf-chat-bubble {
  position: fixed; right: var(--wf-s-4); bottom: var(--wf-s-4);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--wf-text-strong); color: var(--wf-bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--wf-shadow-lg); z-index: 15; cursor: pointer;
}
.wf-chat-panel {
  position: fixed; right: var(--wf-s-4); bottom: calc(var(--wf-s-4) + 72px);
  width: 320px; max-height: 440px; background: var(--wf-bg); border: 1px solid var(--wf-line);
  border-radius: var(--wf-r-lg); box-shadow: var(--wf-shadow-lg); z-index: 15;
  display: flex; flex-direction: column;
}
.wf-chat-header { padding: var(--wf-s-3) var(--wf-s-4); border-bottom: 1px solid var(--wf-line); font-weight: 600; color: var(--wf-text-strong); }
.wf-chat-messages { flex: 1; overflow: hidden; padding: var(--wf-s-3); display: flex; flex-direction: column; gap: var(--wf-s-2); }
.wf-chat-msg {
  max-width: 80%; padding: var(--wf-s-2) var(--wf-s-3); border-radius: var(--wf-r-lg); font-size: var(--wf-fs-small);
}
.wf-chat-msg--ours { align-self: flex-end; background: var(--wf-text-strong); color: var(--wf-bg); }
.wf-chat-msg--theirs { align-self: flex-start; background: var(--wf-surface-2); color: var(--wf-text); }
.wf-chat-input { padding: var(--wf-s-3); border-top: 1px solid var(--wf-line); display: flex; gap: var(--wf-s-2); }

/* ---- Footer ----------------------------------------------------------- */
.wf-footer {
  background: var(--wf-surface); border-top: 1px solid var(--wf-line);
  padding: var(--wf-s-6) 0; margin-top: var(--wf-s-7);
}
.wf-footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--wf-s-5); }
@media (max-width: 900px) { .wf-footer-cols { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .wf-footer-cols { grid-template-columns: 1fr; } }
.wf-footer-col-title { font-size: var(--wf-fs-small); color: var(--wf-text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--wf-s-3); }
.wf-footer-col ul { display: flex; flex-direction: column; gap: var(--wf-s-2); }
.wf-footer-link { color: var(--wf-text-muted); font-size: var(--wf-fs-small); }

/* ---- Mobile nav drawer (hamburger-triggered) --------------------------
   Hidden by default on mobile — only appears when .wf-*-open class is set.
   Backdrop dismisses. Desktop unaffected. */
.wf-nav-backdrop {
  position: fixed; inset: 0; background: rgba(17,24,39,0.45);
  z-index: 19; opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
}
body.wf-nav-open .wf-nav-backdrop {
  opacity: 1; pointer-events: auto;
}

@media (max-width: 768px) {
  /* Nav-links as a drawer from the top (V1/V3/V5) */
  .wf-nav-links.wf-nav-links--open {
    display: flex !important;
    position: fixed; top: 56px; left: 0; right: 0;
    background: var(--wf-bg);
    border-top: 1px solid var(--wf-line);
    border-bottom: 1px solid var(--wf-line);
    padding: var(--wf-s-3) var(--wf-s-4);
    flex-direction: column;
    gap: var(--wf-s-2);
    z-index: 20;
    box-shadow: var(--wf-shadow-md);
  }
  .wf-nav-links.wf-nav-links--open .wf-nav-link {
    padding: var(--wf-s-2) 0;
    font-size: 15px;
  }

  /* Sidebar as a slide-out drawer from the left (V2) */
  .wf-sidebar.wf-sidebar--open {
    display: flex !important;
    position: fixed; top: 0; bottom: 0; left: 0;
    width: 280px; max-width: 85vw;
    z-index: 20;
    background: var(--wf-bg);
    box-shadow: var(--wf-shadow-lg);
    overflow-y: auto;
    padding-top: var(--wf-s-4);
  }

  /* Ensure the injected hamburger button is visible on V2 shell top-bar */
  .wf-hamburger--injected {
    display: inline-flex !important;
    margin-right: var(--wf-s-2);
  }
}

/* RTL mirror: drawer opens from the right instead of left */
html[dir="rtl"] .wf-sidebar.wf-sidebar--open {
  left: auto; right: 0;
}

/* ---- Cosmetic page affordances (injected by page.js) ------------------
   Non-functional visual guides that represent real-product behaviour.
   Gallery's global toggles (V1-V5, M/T/D, L/K, LTR/RTL) are the real controls. */
.wf-chipbar {
  display: inline-flex;
  align-items: center;
  gap: var(--wf-s-2);
  flex-wrap: wrap;
}
.wf-sidebar-affordances {
  margin-top: auto;
  padding-top: var(--wf-s-4);
  border-top: 1px solid var(--wf-line);
}
.wf-affordance-float {
  position: fixed; top: 8px; right: 8px; z-index: 50;
}

/* On mobile: collapse chipbar to just language switcher; drop currency + theme to save nav space.
   The real TricomHub UI likely folds these into a profile dropdown on mobile anyway. */
@media (max-width: 768px) {
  .wf-chipbar .wf-ccy-switcher,
  .wf-chipbar .wf-theme-toggle { display: none; }
  .wf-chipbar { gap: var(--wf-s-1); }
  .wf-chipbar .wf-lang-switcher { padding: 1px; }
  .wf-chipbar .wf-lang-btn { min-width: 28px; font-size: 10px; padding: 0 6px; }
}

/* Language switcher (EN / AR) */
.wf-lang-switcher, .wf-ccy-switcher {
  display: inline-flex;
  gap: 2px; padding: 2px;
  border: 1px solid var(--wf-line);
  border-radius: var(--wf-r-pill);
  background: var(--wf-surface);
}
.wf-lang-btn, .wf-ccy-btn {
  min-width: 34px; min-height: 24px;
  border: 0; background: transparent;
  color: var(--wf-text-muted);
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  border-radius: var(--wf-r-pill);
  cursor: pointer; padding: 0 var(--wf-s-2);
}
.wf-lang-btn:hover, .wf-ccy-btn:hover { color: var(--wf-text-strong); }
.wf-lang-btn--active, .wf-ccy-btn--active {
  background: var(--wf-text-strong); color: var(--wf-bg);
}

/* Theme toggle (☀ / ☾) */
.wf-theme-toggle {
  width: 32px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--wf-line); background: var(--wf-surface);
  border-radius: var(--wf-r-pill);
  color: var(--wf-text-muted); cursor: pointer;
  font-size: 14px; line-height: 1;
}
.wf-theme-toggle:hover { color: var(--wf-text-strong); }
.wf-theme-icon { pointer-events: none; }

/* Back-to-top floating button */
.wf-back-to-top {
  position: fixed;
  right: var(--wf-s-4); bottom: var(--wf-s-4);
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--wf-line);
  background: var(--wf-bg); color: var(--wf-text-strong);
  box-shadow: var(--wf-shadow-md);
  cursor: pointer; font-size: 18px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none; z-index: 20;
}
.wf-back-to-top--visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.wf-back-to-top:hover { background: var(--wf-surface); }
/* Don't show back-to-top on tiny mobile (overlaps bottom-nav and thumb-CTA in V4) */
body[data-variant="v4-mobile-native"] .wf-back-to-top { bottom: calc(var(--wf-s-4) + 64px); }
/* In RTL, flip to the other side */
html[dir="rtl"] .wf-back-to-top { right: auto; left: var(--wf-s-4); }

/* RTL tweaks — mostly browser-native via dir="rtl", a few manual flips */
html[dir="rtl"] .wf-sidebar { border-right: 0; border-left: 1px solid var(--wf-line); }
html[dir="rtl"] .wf-nav-links { margin-left: 0; margin-right: var(--wf-s-4); }
html[dir="rtl"] .wf-nav-actions { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .wf-card-footer { flex-direction: row-reverse; }
html[dir="rtl"] .wf-breadcrumb > *:not(:last-child)::after { transform: scaleX(-1); }

/* RTL: fixed-position UI must move to the opposite edge */
html[dir="rtl"] .wf-chat-bubble { right: auto; left: var(--wf-s-4); }
html[dir="rtl"] .wf-chat-panel { right: auto; left: var(--wf-s-4); }
html[dir="rtl"] .wf-affordance-float { right: auto; left: 8px; }
html[dir="rtl"] .wf-lang-float { right: auto; left: 8px; }

/* Any directional arrow glyph inside text (→ ← ‹ › «) can be wrapped in
   <span class="wf-arrow">→</span> and it will flip automatically in RTL.
   This is the surgical fix for the literal Unicode arrows agents used. */
html[dir="rtl"] .wf-arrow { display: inline-block; transform: scaleX(-1); }

/* Chevron icons inside nav / links / buttons (when rendered as <svg> with class wf-icon-chevron) */
html[dir="rtl"] .wf-icon-chevron { transform: scaleX(-1); }

/* ---- Element-pick mode (feedback / approve selection) ---------------- */
body.wf-pick-mode { cursor: crosshair; }
body.wf-pick-mode a, body.wf-pick-mode button { cursor: crosshair !important; }
.wf-pick-hover {
  outline: 2px dashed var(--wf-text-strong) !important;
  outline-offset: 2px;
  background: rgba(0,0,0,0.02);
}
body.wf-pick-mode--approve .wf-pick-hover {
  outline-color: var(--wf-ok) !important;
  background: rgba(5, 150, 105, 0.05);
}
/* Small hint at top while in pick mode */
body.wf-pick-mode::before {
  content: "Click any section to continue";
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--wf-text-strong); color: var(--wf-bg);
  padding: 4px 12px; border-radius: var(--wf-r-pill);
  font-size: 11px; z-index: 100; pointer-events: none;
  box-shadow: var(--wf-shadow-md);
}
body.wf-pick-mode--approve::before {
  content: "Click a section to approve just that part";
  background: var(--wf-ok);
}

/* ---- Variant data-attribute hooks (overlay CSSes key off these) ------- */
[data-variant="v1-editorial"] { --wf-variant-hero-ratio: 21/9; }
[data-variant="v2-operator"]  { --wf-variant-hero-ratio: 5/2; }
[data-variant="v3-search-first"] { --wf-variant-hero-ratio: 16/9; }
[data-variant="v4-mobile-native"] { --wf-variant-hero-ratio: 4/3; }
[data-variant="v5-concierge"] { --wf-variant-hero-ratio: 21/9; }
