/* ═══════════════════════════════════════════════════════
   BSH — منصة المخزون العقاري
   Design system: LIGHT default · DARK via body.dark
   Palette grounded in the logo: slate navy + warm sand.
═══════════════════════════════════════════════════════ */

/* ─────────── LIGHT THEME (default) ─────────── */
:root {
  /* Icon masks for generated content (::before/::after), where markup — and so  the shared icon() helper — cannot reach. Mirrors ICONS.search / ICONS.lock in  supabase.js; if one changes, change both. */
  --ico-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  --ico-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  color-scheme: light;
  --navy:        #3D506E;   /* brand navy (the .btn-gold / gold-line class names are legacy and harmless) */
  --navy-light:  #51688A;
  --navy-dim:    #2E3E56;
  --navy-subtle: rgba(61,80,110,0.07);
  --navy-border: rgba(61,80,110,0.22);

  --sand:        #A8916F;
  --sand-subtle: rgba(168,145,111,0.12);
  --sand-border: rgba(168,145,111,0.32);

  --bg:          #F4F6FA;
  --bg-card:     #FFFFFF;
  --bg-elevated: #EEF1F7;
  --bg-hover:    #E4E9F2;
  --bg-input:    #F5F7FB;
  --bg-sidebar:  #FFFFFF;

  --border:        rgba(40,55,85,0.10);
  --border-strong: rgba(40,55,85,0.17);

  --text:       #1A2236;
  --text-muted: #5E6B85;
  --text-dim:   #97A1B8;

  --open-color: #1B9A5B;  --open-bg: #E7F7EE;  --open-border: #9FD9BB;
  --reserved-color: #B7791F; --reserved-bg: #FBF1DC; --reserved-border: #E8CE86;
  --sold-color: #C9384A;  --sold-bg: #FCE9EC;  --sold-border: #EDB0B9;
  --closed-color: #6B7794; --closed-bg: #EDEFF4; --closed-border: #C7CDDA;
  --info-color: #2C6FB5; --info-bg: #E6F0FB; --info-border: #A7C8EA;

  --shadow-card:  0 1px 2px rgba(30,45,80,.06), 0 8px 24px -14px rgba(30,45,80,.22);
  --shadow-hover: 0 2px 4px rgba(30,45,80,.08), 0 20px 44px -18px rgba(30,45,80,.30);
  --shadow-modal: 0 30px 70px -20px rgba(20,32,60,.42);

  --radius:    16px;
  --radius-sm: 11px;
  --radius-xs: 7px;
  --radius-pill: 20px;    /* every badge/chip/pill. NOT 999px: these wrap on a phone,
                             and a stadium radius mangles any pill that takes two lines. */

  /* Urgent attention (unread dot, escalated request). Deliberately ONE value for
     both themes: a solid red dot has to read the same on white and on navy. */
  --alert: #E05252;

  /* The sixth request-badge state. It has to stay distinguishable from
     the pending badge (which is --reserved-*), so it keeps its own amber rather
     than reusing one; it was 4 raw hexes + 3 body.dark overrides before. */
  --cancel-color: #A86F1C; --cancel-bg: rgba(201,138,46,0.14); --cancel-border: rgba(201,138,46,0.42);
  --nav-h: 66px;

  /* Floor-plan status palette — unified mapping: open=green, reserved=amber, sold=red, closed=grey */
  --grid-open-bg: #DCEFE2;     --grid-open-bd: #B3D9C4;     --grid-open-tx: #2F6B49;     --grid-open-ink: #3E8E63;
  --grid-reserved-bg: #FBEFCC; --grid-reserved-bd: #E8D08C; --grid-reserved-tx: #876717; --grid-reserved-ink: #C2962B;
  --grid-sold-bg: #F8DCDF;     --grid-sold-bd: #E6ABB1;     --grid-sold-tx: #9C3643;     --grid-sold-ink: #C9384A;
  --grid-closed-bg: #E5E8EF;   --grid-closed-bd: #C5CBD9;   --grid-closed-tx: #4A5570;   --grid-closed-ink: #6B7794;
}

/* ─────────── DARK THEME (default) — matches the portal's navy identity ─────────── */
body.dark {
  color-scheme: dark;
  --navy:        #6E8FBE;
  --navy-light:  #8DA9D2;
  --navy-dim:    #44597B;
  --navy-subtle: rgba(110,143,190,0.15);
  --navy-border: rgba(110,143,190,0.36);

  --sand:        #C2A878;
  --sand-subtle: rgba(194,168,120,0.14);
  --sand-border: rgba(194,168,120,0.30);

  --bg:          #0A1019;
  --bg-card:     #0F1A2C;
  --bg-elevated: #16233B;
  --bg-hover:    #1D2F4E;
  --bg-input:    #0C1626;
  --bg-sidebar:  #0C1422;

  --border:        rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);

  --text:       #EAF0FA;
  --text-muted: #93A0B8;
  --text-dim:   #5E6C86;

  --open-color: #56D49A;  --open-bg: #0C2A1C;  --open-border: #1C5C40;
  --reserved-color: #E3B341; --reserved-bg: #2A2207; --reserved-border: #6E5616;
  --sold-color: #F0788A;  --sold-bg: #2A0F16;  --sold-border: #6E2434;
  --closed-color: #8A93AC; --closed-bg: #141925; --closed-border: #2A3147;
  --info-color: #6FA8E6; --info-bg: #0C2238; --info-border: #235082;

  /* Floor-plan cells tuned for dark: translucent tint + bright label */
  --grid-open-bg: rgba(62,142,99,0.16);     --grid-open-bd: rgba(86,212,154,0.40);   --grid-open-tx: #6FE0AB;     --grid-open-ink: #56D49A;
  --grid-reserved-bg: rgba(194,150,43,0.16); --grid-reserved-bd: rgba(227,179,65,0.42); --grid-reserved-tx: #ECC560; --grid-reserved-ink: #E3B341;
  --grid-sold-bg: rgba(201,56,74,0.17);     --grid-sold-bd: rgba(240,120,138,0.42);   --grid-sold-tx: #F6909E;     --grid-sold-ink: #F0788A;
  --grid-closed-bg: rgba(120,132,162,0.14); --grid-closed-bd: rgba(138,147,172,0.34); --grid-closed-tx: #A6AFC6;   --grid-closed-ink: #8A93AC;

  --cancel-color: #E0A94D; --cancel-bg: rgba(201,138,46,0.16); --cancel-border: rgba(201,138,46,0.44);

  --shadow-card:  0 1px 2px rgba(0,0,0,.5), 0 8px 28px -12px rgba(0,0,0,.7);
  --shadow-hover: 0 1px 2px rgba(0,0,0,.5), 0 24px 60px -20px rgba(0,0,0,.85);
  --shadow-modal: 0 24px 80px rgba(0,0,0,.9);
}

/* ═══ RESET ═══ */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html, body { overflow-x: hidden; max-width: 100%; }
/* Reserve the scrollbar's width even on a page too short to scroll. Without it,
   the moment a list loads and the page grows a scrollbar (Windows: ~15px), every
   centred thing — the whole top bar included — jumped sideways (F, 2026-11-01). */
html { scrollbar-gutter: stable; }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }
/* Brand grace note: faint gold glow at the top, dark theme only */
body.dark::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 340px; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 50% -20%, rgba(194,168,120,0.10) 0%, rgba(194,168,120,0.03) 38%, transparent 66%);
}
/* Lift page content above the ::before glow — but NOT the fixed overlays that
   live as direct <body> children, or this would override their position/z-index
   and break them in dark mode: modals (.modal-overlay) drop to page bottom, the
   toast adds scroll, the lightbox and the date-picker popover (.bsh-cal) fall
   BEHIND open modals (the "date box behind the add button" bug). */
body.dark > *:not(.modal-overlay):not(.toast):not(.lightbox):not(.bsh-cal):not(.bsh-cal-backdrop):not(.nav-bottom):not(.bsh-dd) { position: relative; z-index: 1; }
body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  direction: rtl;
  transition: background 0.25s, color 0.25s;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }

/* ═══════════════════════════════════════════
   AUTH / LOGIN  — split screen
═══════════════════════════════════════════ */
#auth-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex;
  background: var(--bg);
}
.login-split {
  display: grid;
  /* form | brand. The form comes first in the markup, so in RTL it is the RIGHT
     column (2026-10-07, matching the Rosow CRM); the brand keeps its 1.05fr. */
  grid-template-columns: 1fr 1.05fr;
  width: 100%;
  min-height: 100vh; min-height: 100dvh;
}
/* Brand panel (navy) */
.login-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 0% 0%, #4A5F82 0%, transparent 55%),   /* outer (left) corner */
    linear-gradient(150deg, #3D506E 0%, #2A3a54 60%, #222E45 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}
/* subtle architectural blueprint lines */
.login-brand::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 100% at 20% 20%, #000 30%, transparent 75%);
          mask-image: radial-gradient(120% 100% at 20% 20%, #000 30%, transparent 75%);
  pointer-events: none;
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,183,156,0.16) 0%, transparent 65%);
  bottom: -180px; left: -120px; pointer-events: none;
}
.login-brand-inner { position: relative; z-index: 1; max-width: 420px; }
.login-brand-inner .brand-logo { height: 118px; width: auto; max-width: 100%; margin-bottom: 2rem; }
/* Small crisp mark + typographic wordmark (avoids blowing up the low-res lockup) */
.login-brand-inner .brand-mark { height: 46px; width: auto; margin-bottom: 20px; display: block; }
.login-brand-inner .brand-en { font-family: 'Cairo', sans-serif; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.26em; color: var(--sand); margin-bottom: 16px; }
.login-brand-inner h1 {
  font-family: 'Cairo', sans-serif; font-weight: 900;
  font-size: 2.4rem; line-height: 1.2; color: #fff; letter-spacing: -0.02em;
}
.login-brand-inner .brand-sub {
  color: rgba(255,255,255,0.66); font-size: 1.02rem; margin-top: 8px; font-weight: 500;
}
.login-brand-inner .brand-rule { width: 48px; height: 3px; background: var(--sand); border-radius: 3px; margin: 1.75rem 0; }
.login-brand-inner .brand-tagline { color: rgba(255,255,255,0.78); font-size: 0.95rem; line-height: 2; max-width: 360px; }
.login-brand-inner .brand-points { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 12px; }
.login-brand-inner .brand-point { display: flex; align-items: center; gap: 11px; color: rgba(255,255,255,0.9); font-size: 0.92rem; }
.login-brand-inner .brand-point span {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
/* Form side */
.login-form-side {
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem 1.5rem; background: var(--bg);
}
.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  width: 100%; max-width: 410px;
  box-shadow: var(--shadow-card);
}
.auth-logo-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 1.5rem; gap: 12px; }
.auth-logo-img { height: 52px; width: auto; object-fit: contain; }
/* Monogram swaps with the theme (dark navy on light, white on dark) */
.auth-logo-img.logo-dark { display: none; }
body.dark .auth-logo-img.logo-light { display: none; }
body.dark .auth-logo-img.logo-dark { display: block; }
.auth-site-name { font-family: 'Cairo', sans-serif; font-size: 1.18rem; font-weight: 800; color: var(--text); text-align: center; }
.auth-site-sub { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: -4px; }
.auth-welcome { text-align: center; margin-bottom: 1.5rem; }
/* التحقق بخطوتين (2026-11-04): the setup screen needs a little more room than the sign-in form. */
.auth-box:has(#two-step-box.ts-setup) { max-width: 520px; }
.ts-box .auth-welcome p b { color: var(--text); }
.ts-why { background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.ts-why summary, .ts-help summary { cursor: pointer; font-weight: 800; font-size: 0.85rem; color: var(--navy); }
.ts-why p, .ts-help p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.75; margin: 6px 0 0; }
.ts-steps { margin: 0 0 12px; padding-inline-start: 1.2rem; display: flex; flex-direction: column; gap: 12px; font-size: 0.86rem; }
.ts-steps li::marker { font-weight: 800; color: var(--navy); }
.ts-apps { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.ts-apps a { flex: 1 1 140px; text-align: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); font-weight: 700; font-size: 0.8rem; text-decoration: none; }
.ts-apps a:hover { border-color: var(--navy); }
.ts-hint { display: block; font-size: 0.78rem; color: var(--text-muted); line-height: 1.7; margin-top: 4px; }
.ts-qr { display: flex; justify-content: center; margin: 10px 0 6px; min-height: 60px; }
.ts-qr img { background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--border-strong); }
.ts-add { display: block; text-align: center; margin: 8px 0 6px; text-decoration: none; }
.ts-keyrow { display: flex; gap: 8px; align-items: center; }
.ts-keyrow code { flex: 1; min-width: 0; padding: 7px 9px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); font-size: 0.78rem; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.ts-copy { flex: none; padding: 7px 12px; font-size: 0.78rem; }
.ts-code { text-align: center; font-size: 1.35rem; letter-spacing: 0.4em; font-weight: 800; }
.ts-crm { background: var(--open-bg); border: 1px solid var(--open-border); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 0.84rem; margin: 0 0 12px; }
.ts-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.7; margin: 12px 0 0; }
.ts-help { margin-top: 12px; }
.auth-welcome h2 { font-family: 'Cairo', sans-serif; font-size: 1.3rem; font-weight: 800; }
.auth-welcome p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.auth-divider { height: 1px; background: var(--border); margin-bottom: 1.5rem; }
.auth-tabs {
  display: flex; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px; margin-bottom: 1.5rem; gap: 4px;
}
.auth-tab {
  flex: 1; padding: 10px; border-radius: 8px; font-size: 0.88rem; cursor: pointer;
  color: var(--text-muted); border: none; background: none; font-family: 'Tajawal', sans-serif;
  transition: all 0.2s; text-align: center; font-weight: 600;
}
.auth-tab.active { background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(61,80,110,0.30); }

@media (max-width: 860px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-form-side { min-height: 100vh; min-height: 100dvh; }
}

/* Phones: the Cloudflare check is a fixed 300x65 iframe injected after load. It
   used to push the form down ~70px when it arrived and, wider than the box's
   inner width on any phone up to ~400px, stretch the box off the LEFT edge (in
   RTL that overflow is cut off, not scrollable). Its height is reserved up
   front, the phone padding leaves it 300px, and below 340px it is zoomed down.
   Login fields are 16px there so iOS Safari does not zoom in on focus. */
#login-turnstile { min-height: 65px; }
@media (max-width: 480px) {
  .login-form-side { padding: 1rem 10px; }
  .auth-box { padding: 1.75rem 14px; }
  #auth-screen .form-input { font-size: 16px; }
}
@media (max-width: 339px) {
  #login-turnstile { zoom: 0.85; }  /* the 65px reserve zooms with it */
}

/* ═══════════════════════════════════════════
   TOP NAV
═══════════════════════════════════════════ */
nav {
  background: var(--bg-card);
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); position: sticky; top: 0; z-index: 100; gap: 12px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.nav-brand {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  /* It has role="button" and an onclick — so it has to LOOK clickable. It was a
     bare flex row: no pointer, no hover, no focus ring, and a tooltip that said
     nothing about where it goes. Padding is negative-margined back out so the
     hit area grows without shifting the bar's layout. */
  cursor: pointer; padding: 6px 10px; margin: 0 -10px; border-radius: var(--radius-xs);
  transition: background 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.nav-brand:hover { background: var(--bg-elevated); }
.nav-brand:hover .nav-brand-main { color: var(--navy); }
.nav-brand:active { background: var(--bg-hover); }
.nav-brand:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.nav-logo-img { height: 30px; width: auto; object-fit: contain; flex-shrink: 0; }
/* Bot honeypot — off-screen & inert for humans, visible to dumb form-fillers */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* Password field with show/hide eye toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.pw-toggle:hover { color: var(--navy); background: var(--bg-elevated); }
.pw-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.pw-bar { height: 7px; border-radius: 6px; background: var(--bg-elevated); border: 1px solid var(--border); overflow: hidden; }
.pw-bar-fill { height: 100%; width: 0; border-radius: 6px; transition: width 0.25s ease, background 0.25s ease; background: var(--sold-color); }
.pw-bar-fill.s1 { width: 25%;  background: var(--sold-color); }
.pw-bar-fill.s2 { width: 50%;  background: #D98324; }
.pw-bar-fill.s3 { width: 75%;  background: #D9B324; }
.pw-bar-fill.s4 { width: 100%; background: var(--open-color); }
.pw-meter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.pw-strength-label { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
.pw-reqs { display: flex; flex-wrap: wrap; gap: 5px; }
.pw-req { font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); color: var(--text-dim); background: var(--bg-elevated); white-space: nowrap; }
.pw-req.met { color: var(--open-color); border-color: var(--open-border); background: var(--open-bg); }
.pw-req.met::before { content: '✓ '; }
.nav-logo-img.logo-dark { display: none; }
body.dark .nav-logo-img.logo-light { display: none; }
body.dark .nav-logo-img.logo-dark { display: inline-block; }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.22; min-width: 0; }
/* No `white-space: nowrap` any more: the longest system name here is «مركز خدمات
   وأصول تقنية المعلومات», and on a small phone it has to be allowed to take a
   second line rather than run off the bar. The brand itself still does NOT shrink
   (flex-shrink: 0 above) — letting it shrink squeezed this name into a ~50px
   column of stacked words at tablet widths, which is worse than either. */
.nav-brand-main { font-family: 'Cairo', sans-serif; font-size: 0.95rem; font-weight: 800; color: var(--text); line-height: 1.18; overflow-wrap: break-word; transition: color 0.18s ease; }
.nav-brand-sub { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }
/* ── The section rail ────────────────────────────────────────────────
   The active state is ONE element that slides (.nav-glider) rather than a
   background that blinks on and off each tab: it reads as the same object
   moving, which is what makes the strip feel like a control instead of a row
   of links. Positioned in JS from offsetLeft/offsetWidth — see navMoveGlider().
   Tabs sit above it on z-index and carry no background of their own, so the
   pill is never double-drawn during the transition. */
.nav-tabs { display: flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; gap: 3px; }
.nav-rail {
  position: relative;
  /* The rail gives way before the bar does. Between the 860px drawer breakpoint
     and ~1000px, a long system name plus a fourth IT tab (سجل النشاط) made the
     whole nav wider than the window and pushed the user cluster off-screen.
     min-width:0 lets the rail shrink inside the flex row and scroll its own tabs
     instead; the glider is positioned from offsetLeft inside this box, so it
     still lands on the right tab when scrolled. Scrollbar hidden — it is a
     4-item strip, not a document. */
  min-width: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.nav-rail::-webkit-scrollbar { display: none; }
/* Not enough room for every name (navFitRail): the open tab keeps its name, the rest show their icon; the name is the
   tooltip. */
body.view-only .viewer-hide { display: none !important; }
.nav-rail.tight { gap: 2px; }
.nav-rail.tight .nav-tab:not(.mobile-action) { padding: 8px 10px; gap: 5px; }
.nav-rail.compact { gap: 2px; }
.nav-rail.compact .nav-tab:not(.active):not(.mobile-action) { padding: 8px 9px; gap: 0; }
.nav-rail.compact .nav-tab:not(.active):not(.mobile-action) .nav-tab-label { display: none; }
.nav-glider {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  background: var(--navy); border-radius: 8px; opacity: 0; z-index: 0;
  box-shadow: 0 2px 10px -2px rgba(61,80,110,0.45);
  transition: left 0.32s cubic-bezier(0.4, 0.9, 0.2, 1),
              width 0.32s cubic-bezier(0.4, 0.9, 0.2, 1),
              opacity 0.2s ease;
  pointer-events: none;
}
.nav-tab {
  padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
  color: var(--text-muted); transition: color 0.22s ease; border: none; background: none;
  font-family: 'Tajawal', sans-serif; white-space: nowrap; font-weight: 600;
  display: flex; align-items: center; gap: 7px; text-decoration: none;
  position: relative; z-index: 1;
}
.nav-tab.active { color: #fff; }
.nav-tab:hover:not(.active) { color: var(--text); }
/* Fallback for the moment before the glider is measured, and for reduced motion */
.nav-tabs:not(.nav-rail) .nav-tab.active { background: var(--navy); box-shadow: 0 1px 8px rgba(61,80,110,0.28); }
@media (prefers-reduced-motion: reduce) { .nav-glider { transition: opacity 0.2s ease; } }

/* ── "Where is the work" — live counts on the rail ────────────────────
   Only ever rendered when > 0 (the element carries [hidden] otherwise), so an
   empty queue shows nothing at all rather than a grey zero to scan past. */
.nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
  /* Brand navy, not sand (F, 2026-10-07: the sand read as a brown stain). A fixed
     #3D506E in both themes — dark mode's --navy is the lighter #6E8FBE, which
     would put white digits on a washed-out blue. */
  background: #3D506E; color: #fff;
  font-size: 0.68rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
body.dark .nav-count { box-shadow: 0 0 0 1px rgba(255,255,255,0.22); }
.nav-count[hidden] { display: none; }
.nav-tab.active .nav-count { background: rgba(255,255,255,0.94); color: var(--navy); }
/* Live "new reservation" badge (managers/admins) */
.req-notify-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--alert); color: #fff; font-size: 0.62rem; font-weight: 800;
  margin-right: 5px; vertical-align: middle; box-shadow: 0 0 0 2px var(--bg-card, transparent);
  animation: reqBadgePulse 1.6s ease-in-out infinite;
}
@keyframes reqBadgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
/* Inline SVG icons */
.ico { display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
.ico-host { display: inline-flex; align-items: center; }
.empty-state .ico { opacity: 0.5; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sold-color); display: inline-block; vertical-align: middle; }
.nav-tab.mobile-action { display: none; }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-user { display: flex; align-items: center; gap: 8px; font-size: 0.83rem; color: var(--text-muted); }
.nav-username { display: none; }
@media (min-width: 861px) { .nav-username { display: inline; } }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy), var(--navy-dim));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; color: #fff; font-weight: 700;
}
.nav-role-chip {
  display: none; font-size: 0.65rem; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill);
  border: 1px solid var(--sand-border); color: var(--sand); background: var(--sand-subtle); white-space: nowrap;
}
@media (min-width: 861px) { .nav-role-chip { display: inline-flex; } }
.logout-btn {
  background: none; border: 1px solid var(--border-strong); color: var(--text-muted);
  padding: 7px 12px; border-radius: var(--radius-xs); cursor: pointer; font-size: 0.78rem;
  font-family: 'Tajawal', sans-serif; transition: all 0.2s; white-space: nowrap;
}
.logout-btn:hover { border-color: var(--navy-border); color: var(--navy); }
.theme-btn {
  width: 36px; height: 36px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong);
  background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s; flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--navy-border); color: var(--navy); }

/* ═══ NOTIFICATION BELL ═══ */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative; width: 36px; height: 36px; border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong); background: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.bell-btn:hover { border-color: var(--navy-border); color: var(--navy); }
.bell-badge {
  position: absolute; top: -5px; left: -5px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--alert); color: #fff; font-size: 0.62rem; font-weight: 800;
  box-shadow: 0 0 0 2px var(--bg-card, transparent);
  animation: reqBadgePulse 1.6s ease-in-out infinite;
}
.bell-dropdown {
  display: none; position: absolute; top: calc(100% + 10px); left: 0; width: 340px; max-width: 90vw;
  max-height: 420px; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-modal); z-index: 200; padding: 6px;
}
.bell-dropdown.open { display: block; animation: bellDropIn 0.16s ease; }
@keyframes bellDropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.bell-empty { padding: 22px 12px; text-align: center; color: var(--text-dim); font-size: 0.82rem; }
.bell-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.bell-item:hover { background: var(--bg-hover); }
.bell-item + .bell-item { margin-top: 2px; }
.bell-item.unread { background: var(--navy-subtle); }
.bell-item-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.bell-item.unread .bell-item-title::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--alert); margin-right: 6px; }
.bell-item-body { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.bell-item-time { font-size: 0.68rem; color: var(--text-dim); margin-top: 4px; }
@media (max-width: 600px) {
  .bell-dropdown { position: fixed; top: 60px; left: 8px; right: 8px; width: auto; max-width: none; }
}

/* ═══ USER MENU (avatar/name/role + password/logout tucked behind one trigger,
   instead of 5 separate always-visible nav-right items) ═══ */
.user-menu-wrap { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 6px;
  background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  cursor: pointer; transition: all 0.2s; color: var(--text-muted); flex-shrink: 0;
}
.user-menu-trigger:hover, .user-menu-trigger.open { border-color: var(--navy-border); color: var(--navy); }
.user-menu-chevron { color: var(--text-dim); transition: transform 0.18s ease; }
.user-menu-trigger.open .user-menu-chevron { transform: rotate(180deg); }
.user-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 10px); left: 0; min-width: 210px;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-modal); z-index: 200; padding: 6px;
}
.user-menu-dropdown.open { display: block; animation: bellDropIn 0.16s ease; }
.user-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px;
  border-radius: 8px; border: none; background: none; cursor: pointer; transition: background 0.15s;
  font-family: 'Tajawal', sans-serif; font-size: 0.83rem; font-weight: 600; color: var(--text);
  text-align: right;
}
.user-menu-item:hover { background: var(--bg-hover); }
.user-menu-item + .user-menu-item { margin-top: 2px; }
.user-menu-item.danger { color: #C9384A; }
.user-menu-item.danger:hover { background: rgba(201,56,74,0.1); }
@media (max-width: 600px) {
  .user-menu-dropdown { position: fixed; top: 60px; left: 8px; right: 8px; min-width: 0; }
}

/* ═══ VIEWS ═══ */
.view { display: none; }
.view.active { display: block; }

/* ═══ PAGE HEADER ═══ */
.page-header { padding: 2rem 1.75rem 1.5rem; border-bottom: 1px solid var(--border); }
.page-header h1 { font-family: 'Cairo', sans-serif; font-size: 1.7rem; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -0.02em; }
.page-header p { color: var(--text-muted); font-size: 0.87rem; }
.gold-line { width: 34px; height: 3px; background: var(--sand); border-radius: 2px; margin-bottom: 12px; }
.header-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.header-actions > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
/* رقم القطعة under the building title — a chip, not part of the grey subtitle */
.plot-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 12px; margin: 2px 0 6px; font-size: 0.85rem; }
.plot-chip:empty { display: none; }
.plot-chip .pc-k { color: var(--text-muted); font-size: 0.76rem; }
.plot-chip .pc-v { color: var(--text); font-weight: 800; }

/* ═══ PROJECT CARDS ═══ */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.5rem; padding: 1.75rem; }
.project-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-card);
  transition: transform 0.24s cubic-bezier(.2,.7,.3,1), box-shadow 0.24s, border-color 0.24s;
  display: flex; flex-direction: column;
}
.project-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--navy-border); }
.project-card:focus-visible, .model-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
/* Keyboard users: reveal the (hover-only) edit/delete actions on focus */
.project-card:focus-within .edit-btn, .project-card:focus-within .delete-btn,
.edit-btn:focus-visible, .delete-btn:focus-visible { opacity: 1; }
.project-thumb { height: 178px; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--bg-elevated), var(--bg-hover)); display: flex; align-items: center; justify-content: center; }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.project-card:hover .project-thumb img { transform: scale(1.05); }
.project-thumb-placeholder { font-size: 3rem; opacity: 0.18; }
.project-thumb-overlay { position: absolute; inset: 0; background:
  linear-gradient(to bottom, rgba(15,20,32,0.5) 0%, transparent 30%),   /* top scrim: keeps the status pill + edit icons legible over any image */
  linear-gradient(to top, rgba(15,20,32,0.78) 0%, transparent 55%); }   /* bottom scrim */
.project-status-badge {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  padding: 5px 12px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700;
  background: rgba(255,255,255,0.92); border: 1px solid var(--open-border); color: var(--open-color); backdrop-filter: blur(8px);
}
body.dark .project-status-badge { background: rgba(11,14,22,0.55); }
.project-lock-badge {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700;
  background: rgba(255,255,255,0.94); border: 1px solid var(--sold-border); color: var(--sold-color); backdrop-filter: blur(8px);
}
.project-lock-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
body.dark .project-lock-badge { background: rgba(11,14,22,0.6); }
.lock-banner {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 11px 16px;
  border-radius: var(--radius-sm); background: var(--sold-subtle, var(--bg-elevated));
  border: 1px solid var(--sold-border); color: var(--sold-color); font-size: 0.85rem; font-weight: 700;
}
.lock-banner svg { flex-shrink: 0; }
/* Arrived from Rosow CRM's «احجز وحدة» (app.js renderCrmBanner). */
.crm-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--navy, #3D506E);
  font-size: 0.86rem; font-weight: 600;
}
.crm-banner > span { flex: 1 1 260px; }
.crm-banner svg { flex-shrink: 0; color: var(--navy, #3D506E); }
/* «العميل من رسو CRM» in the reserve form (app.js crmPickerInit). */
.crm-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; margin-top: 6px; }
.crm-pick-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; text-align: start; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated);
  color: inherit; font: inherit; font-size: 0.85rem;
}
.crm-pick-item:hover, .crm-pick-item:focus-visible { border-color: var(--navy, #3D506E); }
.crm-pick-item .crm-pick-meta { flex-basis: 100%; color: var(--text-muted); font-size: 0.76rem; }
.crm-pick-empty { padding: 8px 2px; color: var(--text-muted); font-size: 0.82rem; }
.crm-picked-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--navy, #3D506E); background: var(--bg-elevated); font-size: 0.86rem;
}
.crm-picked-row > span { flex: 1 1 180px; min-width: 0; }
.crm-picked-row svg { flex-shrink: 0; color: var(--navy, #3D506E); }
.project-info { padding: 1.25rem 1.4rem; flex: 1; display: flex; flex-direction: column; }
.project-company { font-size: 0.66rem; color: var(--sand); font-weight: 700; letter-spacing: 0.1em; margin-bottom: 5px; text-transform: uppercase; }
.project-name { font-family: 'Cairo', sans-serif; font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.01em; }
.project-location { display: flex; align-items: center; gap: 5px; color: var(--text-muted); font-size: 0.82rem; margin-bottom: 16px; }

/* occupancy bar (new) */
.occ { margin-top: auto; }
.occ-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--bg-elevated); gap: 2px; }
.occ-bar i { display: block; min-width: 0; }
.occ-bar .o { background: var(--grid-open-ink); }
.occ-bar .r { background: var(--grid-reserved-ink); }
.occ-bar .s { background: var(--grid-sold-ink); }
.occ-bar .c { background: var(--grid-closed-ink); }
.occ-legend { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.occ-legend > div { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.occ-legend b { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.2rem; line-height: 1; }
.occ-legend span { font-size: 0.62rem; color: var(--text-muted); }
.occ-legend .o b { color: var(--grid-open-ink); } .occ-legend .r b { color: var(--grid-reserved-ink); }
.occ-legend .s b { color: var(--grid-sold-ink); } .occ-legend .c b { color: var(--grid-closed-ink); }

/* legacy 4-stat layout (kept in case used) */
.project-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); padding-top: 14px; margin-top: auto; }
.stat { text-align: center; padding: 0 4px; }
.stat + .stat { border-right: 1px solid var(--border); }
.stat-num { font-size: 1.35rem; font-weight: 800; font-family: 'Cairo', sans-serif; }
.stat-label { font-size: 0.62rem; color: var(--text-muted); margin-top: 2px; }
.stat-num.open { color: var(--open-color); } .stat-num.reserved { color: var(--reserved-color); } .stat-num.sold { color: var(--sold-color); }

/* ═══ PROJECT LINKS ═══ */
.project-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; padding: 0 1.75rem 0.5rem; }
.project-link-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-xs);
  border: 1px solid var(--border-strong); color: var(--text-muted); font-size: 0.81rem; text-decoration: none;
  transition: all 0.2s; background: var(--bg-card); font-family: 'Tajawal', sans-serif;
}
.project-link-btn:hover { border-color: var(--navy-border); color: var(--navy); background: var(--navy-subtle); }
.project-link-btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; box-shadow: 0 2px 10px -3px rgba(61,80,110,0.4); }
.project-link-btn.primary:hover { background: var(--navy-light); color: #fff; border-color: var(--navy-light); }
.plan-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.plan-row .plan-name { flex: 1; min-width: 0; }
.plan-row .plan-file { font-size: 0.78rem; color: var(--text-muted); max-width: 190px; }  /* the themed ::file-selector-button needs a little more room than the native one */
.plan-row .plan-view { font-size: 0.8rem; color: var(--navy); text-decoration: none; white-space: nowrap; padding: 0 4px; }
.plan-row .plan-view:hover { text-decoration: underline; }
.plan-row .plan-del { flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--sold-color); cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.plan-row .plan-del:hover { background: var(--sold-bg); border-color: var(--sold-border); }

/* ═══ UNITS / BUILDINGS ═══ */
.back-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--text-muted); font-size: 0.84rem; cursor: pointer; padding: 6px 0; transition: color 0.2s; border: none; background: none; font-family: 'Tajawal', sans-serif; margin-bottom: 8px; }
.back-btn:hover { color: var(--navy); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.79rem; color: var(--text-dim); margin-bottom: 1rem; flex-wrap: wrap; }
.breadcrumb span { color: var(--text-muted); cursor: pointer; transition: color 0.15s; }
.breadcrumb span:hover { color: var(--navy); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.units-header { padding: 1.5rem 1.75rem; border-bottom: 1px solid var(--border); }
.units-header h1 { font-family: 'Cairo', sans-serif; font-size: 1.5rem; font-weight: 700; }
.units-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.5rem; padding: 1.75rem; }
.unit-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1.2rem 1.4rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-card);
}
.unit-card:hover { border-color: var(--navy-border); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.unit-name { font-family: 'Cairo', sans-serif; font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.unit-meta { font-size: 0.78rem; color: var(--text-muted); }
.unit-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.unit-thumb-ph { display: grid; place-items: center; font-size: 1.5rem; background: var(--bg-elevated); }
.unit-file-btn { margin-top: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 7px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; color: var(--text); cursor: pointer; font-family: inherit; }
.unit-file-btn:hover { border-color: var(--navy); }
.unit-arrow { color: var(--navy); font-size: 1.1rem; opacity: 0.7; }

/* ═══ FLOOR PLAN ═══ */
.floor-plan-container { padding: 1.5rem 1.75rem; }
.summary-bar {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 1.25rem;
}
.summary-item { background: var(--bg-card); padding: 1rem 1.1rem; text-align: center; }
.summary-item.total { display: flex; flex-direction: column; justify-content: center; }
.summary-num { font-size: 1.7rem; font-weight: 800; font-family: 'Cairo', sans-serif; line-height: 1; }
.summary-lbl { font-size: 0.66rem; color: var(--text-muted); margin-top: 5px; }
.summary-occ { display: flex; height: 7px; border-radius: 5px; overflow: hidden; background: var(--bg-elevated); gap: 2px; margin-top: 11px; }
.summary-occ i { display: block; }
.summary-occ .o { background: var(--grid-open-ink); } .summary-occ .r { background: var(--grid-reserved-ink); }
.summary-occ .s { background: var(--grid-sold-ink); } .summary-occ .c { background: var(--grid-closed-ink); }
.legend {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-bottom: 1.25rem;
  padding: 11px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.84rem; color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0; display: grid; place-items: center; }
.legend-dot svg { width: 12px; height: 12px; display: block; }
.legend-dot.open { background: var(--grid-open-bg); border: 1px solid var(--grid-open-bd); color: var(--grid-open-tx); } .legend-dot.reserved { background: var(--grid-reserved-bg); border: 1px solid var(--grid-reserved-bd); color: var(--grid-reserved-tx); }
.legend-dot.sold { background: var(--grid-sold-bg); border: 1px solid var(--grid-sold-bd); color: var(--grid-sold-tx); } .legend-dot.closed { background: var(--grid-closed-bg); border: 1px solid var(--grid-closed-bd); color: var(--grid-closed-tx); }
.building-section { margin-bottom: 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-card); }
.section-label { font-size: 0.9rem; font-weight: 800; color: var(--text); letter-spacing: 0.02em; margin-bottom: 14px; padding-bottom: 9px; border-bottom: 2px solid var(--navy); font-family: 'Cairo', sans-serif; display: inline-flex; align-items: center; gap: 8px; }
/* Each floor is its own banded card, and a wide floor WRAPS inside it.
   The BAND is the divider: a tinted card with its own border and a floor-number
   plate at both ends, so a floor that takes two or three lines still reads as one
   block and it stays obvious where الدور ١٢ ends and الدور ١١ begins.
   Two rejected attempts, both worth not repeating (F, 2026-09-16):
     • a `1px dashed` rule between rows — «the divider is too tiny it doesnt
       really solve the issue»;
     • nowrap + a sideways-scrolling rail — «they dont need to be in a single
       line, they can take more than 1 line i dont want scrolling».
   So: never scroll horizontally, let the units wrap, and carry the grouping
   entirely in the band. */
.floors-grid { display: flex; flex-direction: column; gap: 10px; }
.floor-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
}
/* A compact badge, centred against however many lines the floor wraps onto —
   stretching it turned a 3-line floor's plate into a tall empty white bar. */
.floor-label {
  width: 34px; height: 26px; flex-shrink: 0; align-self: center;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; color: var(--text-muted);
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  font-variant-numeric: tabular-nums;
}
/* flex:1 makes the units block absorb the slack, which parks the trailing plate
   at the far end on EVERY floor. Without it a short floor (a roof of 2 ملاحق over
   floors of 12) left its closing number stranded in the middle of the band.
   The same `gap` is the row-gap, so wrapped lines breathe. */
.floor-apartments { display: flex; gap: 7px; flex-wrap: wrap; flex: 1 1 auto; align-content: center; }
.col-header {
  width: 56px; min-width: 56px; max-width: 56px; height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 0.62rem; font-weight: 800; color: var(--text); padding: 4px 3px;
  background: var(--bg-elevated); border-radius: var(--radius-xs); border: 1px solid var(--border-strong);
  text-align: center; overflow: hidden; word-break: break-word; line-height: 1.3;
}
.col-header .col-header-type { font-size: 0.58rem; color: var(--text-muted); font-weight: 500; }
/* Fixed height, not min-height. .floor-apartments is a flex row, so a min-height
   tile stretches to whatever the tallest cell in the row needs — one unit with a
   long نموذج name used to inflate every plain tile beside it into a big empty box
   holding a single number. A fixed height makes every tile in the building identical. */
.apt-cell {
  height: 74px; width: 118px; flex: 0 0 118px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: var(--radius-xs); font-weight: 800; cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, filter 0.14s; border: 1px solid; padding: 5px 6px; position: relative;
}
.apt-cell::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(160deg, rgba(255,255,255,0.10), transparent 60%); pointer-events: none; }
.apt-cell.open { background: var(--grid-open-bg); border-color: var(--grid-open-bd); color: var(--grid-open-tx); }
.apt-cell.reserved { background: var(--grid-reserved-bg); border-color: var(--grid-reserved-bd); color: var(--grid-reserved-tx); }
.apt-cell.sold { background: var(--grid-sold-bg); border-color: var(--grid-sold-bd); color: var(--grid-sold-tx); }
.apt-cell.closed { background: var(--grid-closed-bg); border-color: var(--grid-closed-bd); color: var(--grid-closed-tx); }
/* An OPEN unit under a locked project/building — display-only, apartments.status
   stays 'open' underneath. Deliberately its own colour (sand/gold), not the grey
   .closed uses, so it never reads as "this specific unit was closed". */
.apt-cell.open.locked-scope { background: var(--sand-subtle); border-color: var(--sand-border); border-style: dashed; color: var(--sand); }
.apt-cell:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow-hover); filter: brightness(1.05); z-index: 1; }
.apt-cell:active { transform: scale(0.95); }
.apt-cell:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; z-index: 2; }
/* Shape marker (color-blind-safe status, redundant with color) */
.apt-mark { position: absolute; top: 3px; left: 4px; width: 12px; height: 12px; opacity: 0.92; pointer-events: none; }
.apt-mark svg { width: 100%; height: 100%; display: block; }
/* An apartment number is an identifier, not prose: isolate it LTR so a mixed
   number like «1-أ» or «1-B» renders exactly as it was typed instead of being
   reordered by the surrounding RTL paragraph. */
.apt-no { position: relative; z-index: 1; font-size: 0.9rem; font-weight: 800; line-height: 1.15; direction: ltr; unicode-bidi: isolate; }
/* Price tier as a corner letter (A/B/C…), mirroring .apt-mark on the other side.
   The tier's full description and the نموذج name are in the tile's tooltip. */
.apt-tier {
  position: absolute; top: 3px; right: 4px; z-index: 1;
  font-size: 0.56rem; font-weight: 800; line-height: 1; padding: 2px 4px;
  border-radius: 6px; background: rgba(255,255,255,0.28); opacity: 0.8;
  unicode-bidi: plaintext; pointer-events: none;
}
body.dark .apt-tier { background: rgba(255,255,255,0.14); }
/* The نموذج stays ON the tile — moving it to the tooltip made it invisible in
   practice (F, 2026-09-16: «you made النموذج on it not obvious like it used to
   be»). One line, ellipsised: what made the old tile look bad was not the name,
   it was tiles of four text rows at disagreeing heights. Fixed size fixes that,
   and the full name is still in the tooltip when a long one is cut. */
.apt-model {
  font-size: 0.62rem; font-weight: 700; opacity: 0.88; line-height: 1.25;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  unicode-bidi: plaintext;
}
.apt-price { font-size: 0.7rem; font-weight: 700; opacity: 0.72; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: 0.01em; }
/* Roomier, more legible tiles on desktop (mobile keeps the compact sizes above) */
@media (min-width: 768px) {
  .apt-cell { width: 130px; flex-basis: 130px; height: 78px; }
  .apt-no { font-size: 1.15rem; }
  .apt-tier { font-size: 0.62rem; padding: 2px 5px; }
  .apt-model { font-size: 0.68rem; }
  .apt-price { font-size: 0.78rem; }
}
/* Hug the grid instead of always painting a 1400px card: مساب جاردن is 4 units
   wide, and a fixed-width card left ~900px of dead space inside every floor band.
   fit-content resolves to min(max-content, available): a narrow building hugs its
   units, a wide one takes the available width and its floors wrap inside the band. */
.building-section.single { width: fit-content; max-width: 1400px; margin: 0 auto; }
/* 180px could not hold one price line — «289,000 ريال» + the grade badge + the
   position label + the كروكي button, and the label was the piece that got
   ellipsised away (F, 2026-09-16: «details like 289,000 ريالABامامية are lost on
   the cards since they're too small to fit»). Widen the track and let the line
   wrap (see .model-tier-line) so nothing is dropped. */
.models-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.model-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem; cursor: pointer; transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s; box-shadow: var(--shadow-card); }
.model-card:hover { border-color: var(--navy-border); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.model-title { font-weight: 800; font-family: 'Cairo', sans-serif; margin-bottom: 6px; font-size: 0.98rem; }
.model-rooms, .model-size { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; }
.model-price { color: var(--navy); font-weight: 800; font-size: 0.88rem; margin-top: 8px; }
.model-price span { color: var(--text-muted); font-size: 0.72rem; font-weight: 400; margin-right: 4px; }

/* Model price tiers — list on the card / view (matches the printed price sheet) */
.model-tier-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
/* Wraps rather than truncates. The label used to be nowrap+ellipsis, so on a
   narrow card «امامية» was clipped to nothing and the line read as a bare price.
   Letting it wrap costs a second line only when it actually needs one. */
.model-tier-line { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 7px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; }
.model-tier-line .mtl-price { color: var(--navy); font-weight: 800; font-size: 0.82rem; white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.model-tier-line .mtl-label { color: var(--text-muted); font-size: 0.74rem; margin-inline-start: auto; text-align: end; flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.tier-grade-badge { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--sand-subtle); border: 1px solid var(--sand-border); color: var(--sand); font-size: 0.66rem; font-weight: 800; }
.model-tier-list-view { max-width: 340px; margin-inline: auto; }

/* Model tier editor rows */
.model-tiers-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.model-tiers-hint { font-size: 0.72rem; color: var(--text-muted); margin: 4px 0 8px; }
.model-tiers { display: flex; flex-direction: column; gap: 8px; }
/* Group the rows in a soft panel so the optional section reads as one block */
.model-tiers:not(:empty) { padding: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
/* 5 columns now: فئة · سعر · وصف · كروكي · حذف. Each tier carries its own drawing. */
.model-tier-row { display: grid; grid-template-columns: 66px 118px 1fr 96px 34px; gap: 8px; align-items: end; }
.model-tier-row .ttf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.model-tier-row .ttf > label { font-size: 0.64rem; font-weight: 700; color: var(--text-muted); }
.model-tier-row .form-input { min-height: 38px; padding: 6px 9px; font-size: 0.84rem; width: 100%; }
.model-tier-row .tier-price, .model-tier-row .tier-grade { text-align: center; }
.tier-remove { align-self: end; width: 34px; height: 38px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--sold-color); border-radius: var(--radius-xs); cursor: pointer; font-size: 0.85rem; }
.tier-remove:hover { border-color: var(--sold-border); background: var(--sold-bg); }
/* Per-tier كروكي picker. One file per tier — image or PDF, whichever was chosen last. */
.model-tier-row .ttf-kroki { position: relative; }
.tier-kroki {
  width: 100%; height: 38px; padding: 0 6px; border: 1px dashed var(--border-strong);
  background: var(--bg-card); color: var(--text-muted); border-radius: var(--radius-xs);
  cursor: pointer; font-family: inherit; font-size: 0.7rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .15s, color .15s;
}
.tier-kroki:hover { border-color: var(--navy); color: var(--navy); }
.tier-kroki.has-file { border-style: solid; border-color: var(--open-border); color: var(--open-color); background: var(--open-bg); }
.tier-kroki-view { display: block; margin-top: 2px; font-size: 0.62rem; color: var(--navy-light); text-align: center; }
/* Open-this-tier's-كروكي button on a price line (model card + model view) */
.mtl-kroki {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--navy);
}
.mtl-kroki:hover { border-color: var(--navy); background: var(--navy-subtle); }
.mtl-kroki svg { width: 12px; height: 12px; display: block; }
/* Model view: one labelled كروكي block per tier */
.model-kroki-list { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.model-kroki-item { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.model-kroki-head { font-size: 0.76rem; font-weight: 800; color: var(--text); font-family: 'Cairo', sans-serif; }
/* Narrow: description on its own line, then price · grade · كروكي · remove */
@media (max-width: 560px) {
  .model-tier-row { grid-template-columns: 1fr 84px 34px; grid-template-areas: "label label label" "kroki kroki kroki" "price grade remove"; }
  .model-tier-row .ttf-label { grid-area: label; }
  .model-tier-row .ttf-price { grid-area: price; }
  .model-tier-row .ttf-grade { grid-area: grade; }
  .model-tier-row .ttf-kroki { grid-area: kroki; }
  .model-tier-row .tier-remove { grid-area: remove; }
}

/* Tile tier label in the bulk grid */
.bulk-cell-tier { font-size: 0.52rem; font-weight: 700; color: var(--navy); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }

/* Bulk tier picker */
.bulk-tier-opts { display: flex; flex-direction: column; gap: 8px; }
.bulk-tier-opt { display: flex; align-items: center; gap: 9px; width: 100%; text-align: start; padding: 11px 13px; border: 1px solid var(--border-strong); background: var(--bg-elevated); border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; color: var(--text); transition: border-color .12s, background .12s; }
.bulk-tier-opt:hover { border-color: var(--navy); background: var(--navy-subtle); }
.bulk-tier-opt b { color: var(--navy); font-weight: 800; font-size: 0.92rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bulk-tier-opt span:last-child { color: var(--text-muted); font-size: 0.8rem; margin-inline-start: auto; text-align: end; }

/* Models collapsible — desktop: always open, summary hidden; mobile: tap to expand */
.models-box { margin-bottom: 1.5rem; }
.models-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  list-style: none; cursor: pointer; padding: 12px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 0.92rem; color: var(--text);
  box-shadow: var(--shadow-card);
}
.models-summary::-webkit-details-marker { display: none; }
.models-summary .ico { color: var(--navy); vertical-align: -2px; }
.models-count { font-size: 0.72rem; font-weight: 700; color: var(--navy); background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: var(--radius-pill); padding: 1px 9px; margin-right: 6px; }
.models-chev { color: var(--text-muted); transition: transform 0.2s; font-size: 1rem; }
details.models-box[open] .models-chev { transform: rotate(180deg); }
details.models-box[open] > .models-row { margin-top: 12px; }
@media (min-width: 769px) {
  .models-summary { display: none; }
  .models-box > .models-row { display: grid !important; }
}
@media (max-width: 768px) {
  /* Collapsed by default; the summary toggles it */
  .models-box:not([open]) > .models-row { display: none; }
}

/* ═══ MODAL ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,22,40,0.55); z-index: 200; display: none; align-items: center; justify-content: center; padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(5px); }
body.dark .modal-overlay { background: rgba(0,0,0,0.75); }
.modal-overlay.open { display: flex; animation: modalFade 0.18s ease; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius); width: 100%; max-width: 480px; box-shadow: var(--shadow-modal); max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
.modal.wide { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.4rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.modal-title { font-family: 'Cairo', sans-serif; font-size: 1.05rem; font-weight: 700; }
.modal-close { width: 34px; height: 34px; border-radius: var(--radius-xs); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex: none; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 1.4rem; }
.apt-status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 700; margin-bottom: 1.1rem; border: 1px solid; }
.apt-status-badge.open { background: var(--grid-open-bg); border-color: var(--grid-open-bd); color: var(--grid-open-tx); }
.apt-status-badge.reserved { background: var(--grid-reserved-bg); border-color: var(--grid-reserved-bd); color: var(--grid-reserved-tx); }
.apt-status-badge.sold { background: var(--grid-sold-bg); border-color: var(--grid-sold-bd); color: var(--grid-sold-tx); }
.apt-status-badge.closed { background: var(--grid-closed-bg); border-color: var(--grid-closed-bd); color: var(--grid-closed-tx); }
.apt-status-badge.locked-scope { background: var(--sand-subtle); border-color: var(--sand-border); color: var(--sand); margin-inline-start: 8px; }

/* Manager quick-status changer (apartment detail) */
.apt-quick-status { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.1rem; }
.aqs-opt { padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); font-family: 'Tajawal', sans-serif; font-size: 0.76rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.aqs-opt:hover { border-color: var(--navy); color: var(--navy); }
.aqs-opt.active.open { background: var(--grid-open-bg); border-color: var(--grid-open-bd); color: var(--grid-open-tx); }
.aqs-opt.active.reserved { background: var(--grid-reserved-bg); border-color: var(--grid-reserved-bd); color: var(--grid-reserved-tx); }
.aqs-opt.active.sold { background: var(--grid-sold-bg); border-color: var(--grid-sold-bd); color: var(--grid-sold-tx); }
.aqs-opt.active.closed { background: var(--grid-closed-bg); border-color: var(--grid-closed-bd); color: var(--grid-closed-tx); }
.aqs-opt.active { cursor: default; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 1rem; }
.info-item { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 10px 12px; border: 1px solid var(--border); }
.info-label { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 3px; }
.info-value { font-size: 0.93rem; font-weight: 600; }
.info-value.price { color: var(--navy); }
.modal-hero { display: flex; flex-direction: column; align-items: stretch; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 14px 16px; margin: 10px 0 12px; }
.modal-hero-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-hero-model { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.modal-hero-img { max-width: 100%; max-height: 34vh; border-radius: 10px; object-fit: contain; cursor: pointer; margin: 12px auto 0; display: block; border: 1px solid var(--border); }
/* Content images (croquis / model plans / receipts) are often transparent PNGs.
   Force a white backing so transparent areas stay white instead of turning dark
   with the theme — architectural line-art must always read on white. */
.modal-hero-img,
.model-view-content img,
.lightbox img,
#reserve-croqui img,
.req-attachments img { background: #fff; }
.modal-hero-price { font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }

/* ═══ BUTTONS ═══ */
.btn { padding: 11px 22px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 700; cursor: pointer; border: none; font-family: 'Tajawal', sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.18s; min-height: 44px; white-space: nowrap; }
.btn-gold { background: var(--navy); color: #fff; box-shadow: 0 2px 10px -2px rgba(61,80,110,0.4); }
.btn-gold:hover { background: var(--navy-light); transform: translateY(-1px); box-shadow: 0 6px 18px -4px rgba(61,80,110,0.5); }
.btn-gold:active { transform: translateY(0); }
.btn-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--navy-border); color: var(--navy); }
.btn-ghost { background: var(--navy-subtle); border: 1px solid var(--navy-border); color: var(--navy); }
.btn-ghost:hover { background: var(--navy-border); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; min-height: 38px; }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 1rem; }
.form-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; display: block; font-weight: 600; }
.form-input, .form-select {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 13px; color: var(--text); font-size: 0.9rem; font-family: 'Tajawal', sans-serif; outline: none; min-height: 44px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
.form-select { cursor: pointer; }
.form-select option,
.filter-select option,
.status-select option,
#reserve-data-source option {
  background: var(--bg-card);
  color: var(--text);
}
/* The file picker is the ONE control the browser draws itself, and left native it
   renders a beveled grey chip that matches nothing else on the page. Styling
   ::file-selector-button pulls it into the same pill language as .filter-chip:
   the field carries .form-input's bg + border, the button carries the navy.
   Scoped to the element, not a class, so every visible picker in the app gets
   it -- the hidden ones (.upload-zone, style="display:none") are unaffected. */
input[type=file] {
  min-width: 0; padding: 5px 6px; cursor: pointer;
  font-size: 0.74rem; font-family: 'Tajawal', sans-serif; color: var(--text-dim);
  background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type=file]:hover { background: var(--bg-hover); border-color: var(--navy-border); }
input[type=file]:focus-visible { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
input[type=file]::file-selector-button {
  font-family: 'Tajawal', sans-serif; font-size: 0.72rem; font-weight: 700; line-height: 1;
  color: var(--navy); background: var(--navy-subtle);
  border: 1px solid var(--navy-border); border-radius: var(--radius-xs);
  padding: 6px 13px; margin-inline-end: 9px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
input[type=file]:hover::file-selector-button { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Ticks were the OS blue everywhere except the two IT rules that set this by
   hand. One declaration means every checkbox and radio in the app is navy. */
input[type=checkbox], input[type=radio] { accent-color: var(--navy); }

/* شركة التشغيل + «تباع أيضاً عبر» in the project form */
.proj-tenant-note { font-size: .74rem; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.proj-seller-ticks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.proj-seller-tick { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; cursor: pointer; min-height: 36px; }
.proj-seller-tick input { width: 18px; height: 18px; margin: 0; }   /* a finger-sized target on a phone */
.proj-seller-tick[hidden] { display: none; }
.proj-seller-tick input:disabled + span { color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* A neutral spec pill (unit specs sheet) and the image preview thumb -- both
   were repeated as inline style blobs in app.js rather than named once. */
.spec-chip { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 0.85rem; }
.img-preview { border-radius: var(--radius-xs); border: 1px solid var(--border); object-fit: contain; }
.img-preview-name { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* A horizontal action row. .modal-actions is the COLUMN variant; this pairing
   was written out inline seven times because the row version had no name. */
.modal-actions.row { flex-direction: row; gap: 8px; margin-top: 6px; }

/* ═══ REQUESTS PAGE ═══ */
.requests-container { padding: 1.5rem 1.75rem; }
.requests-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 1.25rem; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.filter-chip { padding: 7px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; cursor: pointer; border: none; background: none; color: var(--text-muted); font-family: 'Tajawal', sans-serif; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.filter-chip:hover { color: var(--text); }
.filter-chip.active { background: var(--navy); color: #fff; }
.filter-chip .cnt { font-size: 0.7rem; opacity: 0.8; background: rgba(0,0,0,0.12); padding: 0 6px; border-radius: 10px; }
.filter-chip.active .cnt { background: rgba(255,255,255,0.22); }
.filter-select { min-width: 160px; min-height: 40px; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.84rem; cursor: pointer; }
.search-box { position: relative; flex: 1; min-width: 200px; }
/* Search input + explicit "search"/"clear" buttons (no per-keystroke query) */
.search-group { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; }
.search-group .search-box { min-width: 0; }
.search-group .btn { flex-shrink: 0; white-space: nowrap; }
.search-box input { width: 100%; min-height: 40px; padding: 8px 38px 8px 12px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.86rem; outline: none; }
.search-box input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
.search-box::before { content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; background: var(--text-muted); -webkit-mask: var(--ico-search) center/contain no-repeat; mask: var(--ico-search) center/contain no-repeat; opacity: 0.75; pointer-events: none; }
.requests-table-wrap { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }

/* ── Reservation request cards ───────────────────────────────── */
/* minmax(0, ...) and min-width:0 stop a wide child (e.g. the stage bar) from
   forcing the track wider than its own container — `1fr` alone means
   `minmax(auto, 1fr)`, whose auto floor is the item's min-content width. */
/* auto-FIT, not auto-fill: auto-fill keeps the empty tracks it created, so a
   single request sat in a ~360px track with four blank tracks beside it and
   three quarters of the row empty. auto-fit collapses the empties and the real
   cards take the space — capped by .req-card's max-width so one request grows to
   a readable card instead of one 1800px ribbon. */
.req-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.req-card { min-width: 0; }
/* Cards fill their tracks so a row lines up edge-to-edge with the filter bar
   above it. With max-width 620 on every card, two cards sat in two ~930px tracks
   with a ~160px hole between them and the second one floating off the edge. Only
   a lone request is capped, so it doesn't become one 1800px ribbon. */
.req-cards:has(> .req-card:only-child) { grid-template-columns: minmax(0, 620px); }
.req-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 16px; border-right: 4px solid var(--border); }
.req-card.s-pending  { border-right-color: var(--grid-sold-ink); }
.req-card.s-approved { border-right-color: var(--grid-open-ink); }
.req-card.s-rejected { border-right-color: var(--grid-reserved-ink); }
.req-card.s-expired  { border-right-color: var(--text-dim); }
.req-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 13px; }
.req-card-title { font-weight: 700; font-size: 0.92rem; color: var(--text); line-height: 1.4; }
.req-card-price { color: var(--grid-sold-ink); font-weight: 700; font-size: 0.88rem; margin-top: 3px; }
.req-card-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; }
.req-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 13px; }
.req-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rf-label { font-size: 0.68rem; color: var(--text-muted); }
.rf-val { font-size: 0.86rem; color: var(--text); font-weight: 600; word-break: break-word; }
.rf-val.ltr { direction: ltr; text-align: right; unicode-bidi: plaintext; }
.req-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; flex-wrap: wrap; }
.req-attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.req-attach-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px 12px; font-size: 0.8rem; cursor: pointer; color: var(--text); font-family: inherit; font-weight: 600; transition: border-color 0.15s; }
.req-attach-btn:hover { border-color: var(--navy); }
.req-card-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 8px; }
@media (max-width: 420px) { .req-card-grid { grid-template-columns: 1fr; } }
.requests-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.requests-table th { text-align: right; padding: 13px 14px; font-size: 0.72rem; color: var(--text-muted); font-weight: 700; letter-spacing: 0.03em; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.requests-table td { padding: 12px 14px; font-size: 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.requests-table tr:last-child td { border-bottom: none; }
.requests-table tbody tr:hover td { background: var(--bg-elevated); }
.req-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.71rem; font-weight: 700; border: 1px solid; }
.req-badge.pending { background: var(--reserved-bg); border-color: var(--reserved-border); color: var(--reserved-color); }
.req-badge.approved { background: var(--open-bg); border-color: var(--open-border); color: var(--open-color); }
.req-badge.rejected { background: var(--closed-bg); border-color: var(--closed-border); color: var(--closed-color); }
.req-badge.expired { background: var(--closed-bg); border-color: var(--closed-border); color: var(--closed-color); }
.req-badge.sold { background: var(--sold-bg); border-color: var(--sold-border); color: var(--sold-color); }
.req-badge.cancelled { background: var(--cancel-bg); border-color: var(--cancel-border); color: var(--cancel-color); }
.req-card.s-sold { border-right-color: var(--sold-color); }
.req-card.s-cancelled { border-right-color: var(--cancel-color); }
.req-btn.sold { background: var(--sold-bg); border-color: var(--sold-border); color: var(--sold-color); }
.req-btn.cancel { background: var(--cancel-bg); border-color: var(--cancel-border); color: var(--cancel-color); }
.req-btn.revert { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-muted); }
.req-btn.upgrade { background: var(--open-bg); border-color: var(--open-border); color: var(--open-color); }
.req-btn.sold:hover, .req-btn.cancel:hover, .req-btn.revert:hover, .req-btn.upgrade:hover { filter: brightness(0.97); }
.cancelled-note { color: var(--cancel-color); display: block; width: 100%; clear: both; margin-top: 10px; padding: 8px 11px; border-radius: var(--radius-xs); background: var(--cancel-bg); border: 1px solid var(--cancel-border); line-height: 1.5; }
.req-date-filter { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-muted); }
.req-date-filter label { white-space: nowrap; }

/* Custom date picker — readonly input (Latin ISO value) + calendar icon */
.bsh-date {
  min-height: 40px; padding: 8px 12px 8px 34px;
  background-color: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; direction: ltr; text-align: left; caret-color: transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a94a6' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.6'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 11px center;
}
.bsh-date:hover { border-color: var(--navy-border); }
.bsh-date:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
.bsh-date::placeholder { color: var(--text-dim); letter-spacing: 0.04em; }

.bsh-cal-backdrop { position: fixed; inset: 0; background: rgba(6,10,18,0.6); z-index: 999; display: none; }
.bsh-cal-backdrop.open { display: block; }
.bsh-cal {
  position: fixed; z-index: 1000; width: 300px; display: none; padding: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-modal);
}
.bsh-cal.open { display: block; animation: bshCalIn 0.14s ease; }
@keyframes bshCalIn { from { opacity: 0; } to { opacity: 1; } }
.bsh-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bsh-cal-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1rem; color: var(--text); letter-spacing: -0.01em; }
.bsh-cal-nav { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; font-size: 1.1rem; line-height: 1; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.bsh-cal-nav:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-subtle); transform: translateY(-1px); }
.bsh-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.bsh-cal-wd { margin-bottom: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.bsh-cal-wdname { text-align: center; font-size: 0.6rem; color: var(--text-dim); font-weight: 800; letter-spacing: 0.02em; }
.bsh-cal-empty { aspect-ratio: 1; }
.bsh-cal-day { position: relative; aspect-ratio: 1; border: none; background: none; border-radius: 10px; color: var(--text); cursor: pointer; font-family: 'Tajawal', sans-serif; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; transition: background 0.12s, color 0.12s; }
.bsh-cal-day:hover { background: var(--navy-subtle); color: var(--navy); }
.bsh-cal-day.today { color: var(--navy); font-weight: 800; }
.bsh-cal-day.today::after { content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--navy); }
.bsh-cal-day.sel { background: var(--navy); color: #fff; font-weight: 800; box-shadow: 0 4px 12px -3px var(--navy); }
.bsh-cal-day.sel::after { background: #fff; }
.bsh-cal-day.sel:hover { background: var(--navy); color: #fff; }
.bsh-cal-foot { display: flex; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.bsh-cal-btn { flex: 1; padding: 9px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); cursor: pointer; font-family: 'Tajawal', sans-serif; font-size: 0.8rem; font-weight: 700; transition: all 0.15s; }
.bsh-cal-btn:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-subtle); }
.bsh-cal-btn.clear:hover { border-color: var(--sold-border); color: var(--sold-color); background: var(--sold-bg); }
.req-date-filter .bsh-date { min-width: 130px; }
.req-date-clear { border: none; background: none; color: var(--navy); cursor: pointer; font-size: 0.78rem; font-weight: 700; font-family: inherit; }
.req-action-btns { display: flex; gap: 6px; }
.req-btn { padding: 6px 13px; border-radius: var(--radius-xs); font-size: 0.76rem; font-weight: 700; cursor: pointer; border: 1px solid; font-family: 'Tajawal', sans-serif; transition: all 0.15s; min-height: 32px; }
.req-btn.approve { background: var(--open-bg); border-color: var(--open-border); color: var(--open-color); }
.req-btn.approve:hover { filter: brightness(0.97); }
.req-btn.reject { background: var(--sold-bg); border-color: var(--sold-border); color: var(--sold-color); }
.req-btn.reject:hover { filter: brightness(0.97); }
.req-btn.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-color); }
.req-btn.info:hover { filter: brightness(0.97); }

/* ═══ REQUEST CARD → clickable, + detail sheet ═══ */
.req-card.clickable { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
@media (hover: hover) {
  .req-card.clickable:hover { border-color: var(--navy-border); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
}
.req-card-sub-line { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.req-attach-btn.ghost { border-style: dashed; color: var(--navy); background: transparent; }
.req-attach-btn.ghost:hover { background: var(--navy-subtle); }

.req-detail-modal { max-width: 640px; width: 100%; }
.rd-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.rd-head .rd-print { margin-inline-start: auto; }
/* The print button is taller than the badges; without this the row stretches every
   badge to its height and .req-type-badge's text sits at the top (F, 2026-10-13). */
.rd-head { align-items: center; }
.req-type-badge { display: inline-flex; align-items: center; line-height: 1.5; }
.rd-section { margin-top: 18px; }
.rd-section:first-of-type { margin-top: 8px; }
.rd-section-title { display: flex; align-items: center; gap: 7px; font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 0.92rem; color: var(--navy); margin: 0 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.rd-section-title .ico { color: var(--navy); }
.rd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 18px; }
.rd-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rd-label { font-size: 0.7rem; color: var(--text-dim); font-weight: 800; letter-spacing: 0.01em; }
.rd-val { font-size: 0.9rem; color: var(--text); font-weight: 600; word-break: break-word; }
.rd-val.ltr { direction: ltr; text-align: right; unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
.rd-notes { margin-top: 12px; padding: 10px 13px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rd-notes p { margin: 4px 0 0; font-size: 0.86rem; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.rd-notes.cancelled { background: var(--sold-bg); border-color: var(--sold-border); }
.rd-notes.cancelled .rd-label { color: var(--sold-color); }
.rd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.rd-actions .req-btn { font-size: 0.82rem; padding: 9px 18px; min-height: 40px; flex: 1 1 auto; }

.req-attach-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.req-attach-tile { width: 140px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; background: var(--bg-elevated); display: flex; flex-direction: column; align-items: stretch; padding: 0; font-family: inherit; text-align: center; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
@media (hover: hover) { .req-attach-tile:hover { border-color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow-hover); } }
.req-attach-tile img { width: 100%; height: 100px; object-fit: cover; background: #fff; display: block; }
.req-attach-tile figcaption { font-size: 0.74rem; padding: 7px 6px; font-weight: 700; color: var(--text-muted); }
.req-attach-tile.pdf { min-height: 130px; justify-content: center; align-items: center; gap: 6px; color: var(--navy); padding: 14px 8px; }
.req-attach-tile.pdf .ico { color: var(--navy); }
.req-attach-tile.pdf span { font-size: 0.8rem; font-weight: 800; color: var(--text); }
.req-attach-tile.pdf em { font-size: 0.68rem; color: var(--text-dim); font-style: normal; }
.req-detail-empty { padding: 16px; text-align: center; color: var(--text-dim); font-size: 0.85rem; background: var(--bg-elevated); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
@media (max-width: 560px) { .rd-grid { grid-template-columns: 1fr; } .req-attach-tile { width: calc(50% - 6px); } }

/* ═══ ADMIN ═══ */
.admin-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 1.75rem; }
@media (max-width: 800px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card); }
.admin-section.full { grid-column: 1 / -1; }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.admin-section-title { font-family: 'Cairo', sans-serif; font-size: 0.95rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.admin-section-title .icon { width: 30px; height: 30px; background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; color: var(--navy); flex-shrink: 0; }
.admin-section-body { padding: 1.4rem; }
.audit-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 1rem; }
.audit-list { display: flex; flex-direction: column; gap: 7px; }
.audit-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated); }
.audit-op { flex-shrink: 0; font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid; min-width: 48px; text-align: center; }
.audit-op.op-add { background: var(--open-bg); border-color: var(--open-border); color: var(--open-color); }
.audit-op.op-edit { background: var(--info-bg); border-color: var(--info-border); color: var(--info-color); }
.audit-op.op-del { background: var(--sold-bg); border-color: var(--sold-border); color: var(--sold-color); }
.audit-main { flex: 1; min-width: 0; }
.audit-line { font-size: 0.86rem; color: var(--text); }
.audit-type { font-size: 0.7rem; font-weight: 700; color: var(--navy); background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.audit-detail { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; word-break: break-word; }
.audit-time { flex-shrink: 0; font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }
@media (max-width: 560px) { .audit-row { flex-wrap: wrap; } .audit-time { width: 100%; } }
.audit-row { cursor: pointer; }
.audit-row.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-color: var(--navy-border); }
.audit-day { font-size: 0.78rem; font-weight: 800; color: var(--text-muted); margin: 14px 2px 6px; }
.audit-day:first-child { margin-top: 0; }
.audit-actor { background: none; border: 0; padding: 0; font: inherit; font-weight: 800; color: var(--navy); cursor: pointer; }
.audit-actor:hover { text-decoration: underline; }
.audit-expand { display: none; padding: 10px 12px 12px; border: 1px solid var(--navy-border); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--bg); margin-bottom: 7px; }
.audit-expand.open { display: block; }
.audit-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.audit-table th, .audit-table td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--border); word-break: break-word; }
.audit-table th { font-size: 0.72rem; color: var(--text-dim); font-weight: 700; }
.audit-table td:first-child { color: var(--text-muted); white-space: nowrap; width: 1%; }
.audit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.audit-summary { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); margin-inline-start: 8px; }
.audit-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; padding: 4px 12px; margin-bottom: 10px; border-radius: var(--radius-pill); background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-color); }
.audit-chip button { background: none; border: 0; cursor: pointer; color: inherit; font: inherit; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elevated); transition: border-color 0.15s; flex-wrap: wrap; }
.user-row:hover { border-color: var(--navy-border); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.71rem; color: var(--text-muted); margin-top: 1px; }
.role-badge { padding: 3px 9px; border-radius: var(--radius-pill); font-size: 0.67rem; font-weight: 700; white-space: nowrap; border: 1px solid; }
.role-badge.admin { background: var(--navy-subtle); color: var(--navy); border-color: var(--navy-border); }
.role-badge.reservation_manager { background: var(--open-bg); color: var(--open-color); border-color: var(--open-border); }
.role-badge.team_leader { background: var(--info-bg); color: var(--info-color); border-color: var(--info-border); }
.role-badge.sales_manager { background: var(--info-color); color: var(--bg-card); border-color: var(--info-color); }
.role-badge.seller { background: var(--sand-subtle); color: var(--sand); border-color: var(--sand-border); }
.role-badge.pending { background: var(--reserved-bg); color: var(--reserved-color); border-color: var(--reserved-border); }
.admin-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 1.5rem; }
.admin-stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; text-align: center; box-shadow: var(--shadow-card); }
.admin-stat-num { font-size: 1.6rem; font-weight: 800; font-family: 'Cairo', sans-serif; font-variant-numeric: tabular-nums; }
.admin-stat-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; }
.status-select { background: var(--bg-input); border: 1px solid var(--border-strong); color: var(--text); border-radius: var(--radius-xs); padding: 5px 9px; font-size: 0.8rem; font-family: 'Tajawal', sans-serif; cursor: pointer; min-height: 34px; }

/* ═══ COUNTDOWN ═══ */
.countdown { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; color: var(--text-muted); }
.countdown.urgent { color: var(--sold-color); font-weight: 700; }

/* ═══ UPLOAD ZONES ═══ */
.file-upload-zone, .upload-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--bg-elevated); }
.file-upload-zone:hover, .upload-zone:hover, .upload-zone.dragover { border-color: var(--navy); background: var(--navy-subtle); }
.upload-zone { position: relative; }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone-icon { font-size: 1.5rem; margin-bottom: 5px; opacity: 0.5; }
.upload-zone-text { font-size: 0.82rem; color: var(--text-muted); }
.upload-zone-text strong { color: var(--navy); }
.upload-preview { margin-top: 10px; border-radius: var(--radius-sm); overflow: hidden; position: relative; display: none; }
.upload-preview img { width: 100%; max-height: 180px; object-fit: cover; display: block; border-radius: var(--radius-sm); }
.upload-preview-name { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; text-align: center; }
.upload-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; display: none; }
.upload-progress-bar { height: 100%; background: var(--navy); border-radius: 2px; transition: width 0.3s ease; width: 0%; }
.arboon-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; cursor: pointer; border: 1px solid var(--border-strong); transition: transform 0.15s; }
.arboon-thumb:hover { transform: scale(1.1); }
.arboon-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; color: var(--navy); text-decoration: none; padding: 5px 10px; border-radius: var(--radius-xs); border: 1px solid var(--navy-border); background: var(--navy-subtle); transition: all 0.15s; cursor: pointer; font-family: 'Tajawal', sans-serif; }
.arboon-link:hover { filter: brightness(0.97); }
.model-view-content { padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.model-view-content img { max-width: 100%; max-height: 60vh; border-radius: 8px; object-fit: contain; }
.model-view-content iframe { width: 100%; height: 60vh; border: none; border-radius: 8px; }
.model-view-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ═══ LIGHTBOX ═══ */
.lightbox { position: fixed; inset: 0; background: rgba(10,14,22,0.94); z-index: 500; display: none; align-items: center; justify-content: center; padding: 1rem; cursor: zoom-out; backdrop-filter: blur(8px); }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 90vh; max-height: 90dvh; border-radius: var(--radius); box-shadow: 0 0 60px rgba(0,0,0,0.6); cursor: default; }
.lightbox-close { position: absolute; top: 1rem; left: 1rem; background: rgba(255,255,255,0.14); border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.lightbox-close:hover { background: rgba(255,255,255,0.26); }

/* ═══ TOAST ═══ */
.toast { opacity: 0; visibility: hidden; position: fixed; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%) translateY(90px); background: var(--bg-card); border: 1px solid var(--border-strong); color: var(--text); padding: 11px 22px; border-radius: 40px; font-size: 0.85rem; z-index: 999; transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1), opacity 0.2s, visibility 0s linear 0.3s; pointer-events: none; width: max-content; max-width: min(92vw, 460px); text-align: center; line-height: 1.55; box-shadow: var(--shadow-modal); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; transition-delay: 0s; pointer-events: auto; cursor: pointer; }
.toast.success { border-color: var(--open-border); color: var(--open-color); }
.toast.error { border-color: var(--sold-border); color: var(--sold-color); }

/* ═══ LOADING / EMPTY ═══ */
.loading { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.spinner { display: inline-block; width: 26px; height: 26px; border: 2.5px solid var(--border); border-top-color: var(--navy); border-radius: 50%; animation: spin 0.7s linear infinite; margin-bottom: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.25; }
.empty-state p { font-size: 0.9rem; }

/* ═══ DELETE / EDIT BUTTONS ═══ */
/* Edit/delete on cards: always visible, frosted chip with a clear colored icon */
.edit-btn, .delete-btn {
  position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; z-index: 2; border: 1px solid;
  background: rgba(255,255,255,0.94); backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(20,30,55,0.28);
  transition: opacity 0.18s, transform 0.15s, background 0.2s, box-shadow 0.2s;
}
/* Desktop: reveal the edit/delete actions only on card hover — declutters the grid */
@media (hover: hover) {
  .project-card:hover .edit-btn, .project-card:hover .delete-btn { opacity: 1; }
}
/* Touch: no hover, so keep them visible (delete is still confirmed) */
@media (hover: none) {
  .edit-btn, .delete-btn { opacity: 0.9; }
}
.edit-btn { border-color: var(--navy-border); color: var(--navy); }
.delete-btn { border-color: var(--sold-border); color: var(--sold-color); }
.edit-btn:hover { background: #fff; transform: scale(1.1); box-shadow: 0 4px 12px rgba(20,30,55,0.35); }
.delete-btn:hover { background: #fff; transform: scale(1.1); box-shadow: 0 4px 12px rgba(201,56,74,0.4); }
.edit-btn:focus-visible, .delete-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Project/building "lock" toggle — third icon button beside edit/delete. Sits at
   `left:46px` (delete then shifts to `left:84px`) so all three line up in a row. */
.lock-btn { position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; z-index: 2; border: 1px solid var(--navy-border); color: var(--navy);
  background: rgba(255,255,255,0.94); backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(20,30,55,0.28);
  transition: opacity 0.18s, transform 0.15s, background 0.2s, box-shadow 0.2s; }
.lock-btn.active { border-color: var(--sold-border); color: var(--sold-color); }
@media (hover: hover) { .project-card:hover .lock-btn { opacity: 1; } }
@media (hover: none) { .lock-btn { opacity: 0.9; } }
.lock-btn:hover { background: #fff; transform: scale(1.1); box-shadow: 0 4px 12px rgba(20,30,55,0.35); }
.lock-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.project-card:focus-within .lock-btn, .lock-btn:focus-visible { opacity: 1; }

/* Styled delete confirmation */
/* The delete confirmation is always a SECOND-level modal — it is raised from
   inside another one (إدارة الشقق, the apartment editor, the model editor). Every
   .modal-overlay shares z-index 200 and they are all direct <body> children, so
   the winner was whichever got appended last. #confirm-danger-modal is built
   lazily and reused forever, so once any earlier delete had created it, it sat
   EARLIER in the DOM than a bulk modal opened afterwards and rendered behind it —
   the manager clicked حذف and the warning appeared underneath «إدارة الشقق»
   (F, 2026-09-16). Give it its own level so nesting order stops deciding.
   Stays below .lightbox (500) and the toast (999). */
#confirm-danger-modal { z-index: 400; }
/* The price-change reason prompt opens over the unit / model editor. */
#price-reason-modal { z-index: 400; }
/* The price a reservation was filed at, when the unit's price changed since. */
.rq-price-old { color: var(--text-muted); font-weight: 400; font-size: .85em; margin-inline-end: 4px; }
.confirm-danger-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--sold-bg); border: 1px solid var(--sold-border); color: var(--sold-color); }
.confirm-danger-title { font-family: 'Cairo', sans-serif; font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.confirm-danger-msg { color: var(--text-muted); font-size: 0.88rem; line-height: 1.75; }
.confirm-danger-msg strong { color: var(--sold-color); }
.edit-btn-inline { border: none; background: var(--navy-subtle); color: var(--navy); font-size: 0.8rem; cursor: pointer; border-radius: var(--radius-xs); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; opacity: 0.6; transition: opacity 0.2s, background 0.2s; }
.unit-card:hover .edit-btn-inline { opacity: 1; }
.edit-btn-inline:hover { background: var(--navy-border); }
.delete-btn-inline { position: static; opacity: 0.5; border-radius: var(--radius-xs); width: 28px; height: 28px; }
.unit-card:hover .delete-btn-inline { opacity: 1; }
.btn-danger { background: var(--sold-bg); color: var(--sold-color); border: 1px solid var(--sold-border); }
.btn-danger:hover { filter: brightness(0.97); }
/* A square icon-only button for table rows -- the counterpart to the round
   .edit-btn/.delete-btn that float over card images. Was defined only inside
   it/index.html despite the entirely generic name. */
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-muted); cursor: pointer; transition: all 0.14s; }
.icon-btn:hover { color: var(--navy); border-color: var(--navy-border); background: var(--bg-hover); }
.icon-btn.del:hover { color: var(--sold-color); border-color: var(--sold-border); background: var(--sold-bg); }
/* Sequential row number -- continues across pages (page*size + i + 1). */
.user-num { flex-shrink: 0; min-width: 30px; height: 26px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.74rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.live-indicator { font-size: 0.7rem; color: var(--sold-color); letter-spacing: 0.03em; opacity: 0.85; animation: livePulse 2s ease-in-out infinite; }
/* «مباشر» keeps its space while off: it used to be display:none, so the moment
   realtime connected it widened the user cluster and shoved the centred tab rail
   sideways — and the rail sat in a different spot on live vs non-live pages. */
.live-indicator:not(.on) { visibility: hidden; }
@keyframes livePulse { 0%,100% { opacity: 0.85; } 50% { opacity: 0.4; } }

/* ═══ MOBILE ═══ */
.pager { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.pager-inner { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pager-btn { min-width: 36px; height: 36px; padding: 0 11px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.18s; }
.pager-btn:hover:not(:disabled):not(.active) { border-color: var(--navy-border); color: var(--navy); background: var(--navy-subtle); }
.pager-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-gap { color: var(--text-dim); align-self: center; padding: 0 2px; }
.pager-info { font-size: 0.74rem; color: var(--text-muted); }
.mobile-menu-btn { display: none; }
/* Tablet + mobile: collapse the whole nav into the hamburger (≤860) to avoid crowding */
@media (max-width: 860px) {
  nav { height: 58px; padding: 0 1rem; }
  .nav-tabs { display: none; }
  nav .theme-btn,
  nav .live-indicator,
  nav .nav-user .logout-btn,
  nav .user-menu-wrap { display: none; }
  .nav-brand-sub { display: none; }
  .nav-tabs.mobile-open { display: flex; flex-direction: column; position: fixed; top: 58px; right: 0; left: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0.6rem; padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px)); gap: 4px; z-index: 99; box-shadow: var(--shadow-modal); animation: mobileMenuIn 0.18s ease; }
  .nav-tabs.mobile-open .mobile-action { display: flex; }
  .nav-tabs.mobile-open .mobile-action:first-of-type { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 14px; }
  .nav-tabs.mobile-open .nav-tab { text-align: right; padding: 12px 16px; border-radius: var(--radius-xs); font-size: 0.92rem; width: 100%; }
  .nav-tabs.mobile-open .nav-tab.active { background: var(--navy-subtle); color: var(--navy); border: 1px solid var(--navy-border); box-shadow: none; }
  .nav-glider { display: none; }
  /* Sections live in the bottom bar on mobile — listing them in the drawer too
     would be the same two-taps-to-switch problem, twice. The drawer keeps the
     rare actions only, so its first item no longer needs a separator above it. */
  .nav-tabs.mobile-open .nav-tab:not(.mobile-action) { display: none; }
  .nav-tabs.mobile-open .mobile-action:first-of-type { margin-top: 0; border-top: none; padding-top: 12px; }
  .nav-tabs.mobile-open .nav-count { margin-inline-start: auto; }
  .mobile-menu-btn { display: flex !important; width: 38px; height: 38px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; align-items: center; justify-content: center; transition: all 0.2s; }
  .mobile-menu-btn:hover, .mobile-menu-btn.open { border-color: var(--navy-border); color: var(--navy); background: var(--navy-subtle); }
}
@keyframes mobileMenuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 640px) {
  .projects-grid { grid-template-columns: 1fr; padding: 1rem; gap: 1rem; }
  .units-grid { grid-template-columns: 1fr; padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .models-row { grid-template-columns: repeat(2, 1fr); }
  .summary-bar { grid-template-columns: 1fr 1fr; }
  .summary-item.total { grid-column: 1 / -1; }
  .admin-layout { padding: 1rem; }
  .admin-stats-row { grid-template-columns: repeat(2, 1fr); }
  .page-header { padding: 1.25rem 1rem 1rem; }
  .page-header h1 { font-size: 1.45rem; }
  .units-header { padding: 1rem; }
  /* Put the apartment grid first; demote the (tall) model cards below it */
  .floor-plan-container { padding: 1rem; display: flex; flex-direction: column; }
  .floor-plan-container > .summary-bar { order: 1; }
  .floor-plan-container > .legend { order: 2; }
  .floor-plan-container > #floor-plan-content { order: 3; }
  .floor-plan-container > #models-section { order: 4; margin-top: 1.5rem; }
  .building-section { padding: 1rem; }
  .requests-container { padding: 1rem; }
  .req-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  /* Floor plan → clean horizontal-scroll rail (columns stay aligned, label pinned) */
  /* Floor bands carry the grouping here too; mobile only tightens the sizes.
     Two tiles a line on a phone, wrapping inside the band — never a side-scroll. */
  .floors-grid { gap: 8px; }
  .floor-row { padding: 7px 8px; gap: 8px; }
  .floor-label { width: 26px; font-size: 0.68rem; }
  .apt-cell { height: 66px; width: 104px; flex-basis: 104px; }
  .apt-cell .apt-no { font-size: 0.92rem; }
  .apt-cell .apt-model { font-size: 0.58rem; }
  .apt-cell .apt-price { font-size: 0.64rem; }
  .col-header { min-width: 84px; max-width: 84px; width: 84px; font-size: 0.52rem; height: 52px; }
  .logout-btn { font-size: 0; padding: 6px 9px; }
  .logout-btn::before { content: '↩'; font-size: 1rem; }
  .filter-select, .search-box { width: 100%; }
  /* Reservations toolbar: stack, full-width controls, single scrollable chip row */
  .requests-toolbar { gap: 10px; }
  .filter-chips { width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .filter-chips::-webkit-scrollbar { display: none; }
  /* The row scrolls sideways; fade the clipped edge so it reads as scrollable, not cut off. */
  .filter-chips { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 26px); mask-image: linear-gradient(to right, transparent 0, #000 26px); }
  .filter-chip { white-space: nowrap; flex-shrink: 0; }
  .req-date-filter { width: 100%; justify-content: space-between; }
  .req-date-filter .bsh-date { flex: 1 1 0; min-width: 0; }
  .req-action-btns { width: 100%; flex-wrap: wrap; }
  .req-action-btns .req-btn { flex: 1; min-width: 108px; }
  /* Audit toolbar: full-width controls */
  .audit-toolbar { gap: 8px; }
  .audit-toolbar .filter-select, .audit-toolbar .req-date-filter { width: 100%; }
  .audit-toolbar .req-date-filter .bsh-date { flex: 1 1 0; min-width: 0; }
  /* Admin user rows: keep controls from overflowing */
  .user-row { flex-direction: column; align-items: stretch; gap: 9px; padding: 12px; }
  .user-row .user-info { width: 100%; }
  .user-row .user-name { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
  .user-row .user-email { word-break: break-all; }
  .user-row .role-badge { align-self: flex-start; }
  .user-row > span:last-child { align-self: flex-start; }
  .user-row .req-btn,
  .user-row .status-select { width: 100%; flex: none; min-width: 0; margin: 0 !important; font-size: 0.82rem; min-height: 40px; }
  /* Headers */
  .header-actions { gap: 10px; }
  .header-actions h1 { font-size: 1.25rem; }
  .header-actions > div:last-child { width: 100%; }
  .header-actions > div:last-child .btn { flex: 1 1 auto; }
  .nav-brand-main { font-size: 0.86rem; }
}
@media (max-width: 480px) {
  /* The longest system name needs the smaller step to stay on one line beside the
     logo on a 360px phone; everything shorter simply gets a little more room. */
  .nav-brand-main { font-size: 0.8rem; max-width: 170px; }
  .req-card-grid { grid-template-columns: 1fr; }
  .req-card-head { flex-wrap: wrap; gap: 8px; }
  .req-card-title { font-size: 0.9rem; }
  .models-row { grid-template-columns: 1fr; }
  .admin-stats-row { grid-template-columns: 1fr 1fr; }
  nav { padding: 0 0.75rem; gap: 8px; }
  .nav-avatar { width: 30px; height: 30px; }
  .modal-overlay { padding: 0.5rem; }
  .modal { max-height: 94vh; max-height: 94dvh; }
  .page-header h1 { font-size: 1.3rem; }
  .btn { padding: 10px 14px; }
}

/* ════════════════════════════════════
   REPORTS  (التقارير)
   ════════════════════════════════════ */
.rep-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 1rem; margin-bottom: 1.75rem;
}
.rep-kpi {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.rep-kpi::before { content: ""; position: absolute; top: 0; right: 0; width: 3px; height: 100%; background: var(--sand); }
.rep-kpi.accent-sold::before { background: var(--sold-color); }
.rep-kpi.accent-open::before { background: var(--open-color); }
.rep-kpi.accent-reserved::before { background: var(--reserved-color); }
.rep-kpi-icon { color: var(--text-muted); margin-bottom: 8px; }
.rep-kpi-num { font-family: 'Cairo', sans-serif; font-size: 1.65rem; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.rep-kpi-num small { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-right: 3px; }
.rep-kpi-lbl { font-size: 0.74rem; color: var(--text-muted); margin-top: 6px; }

/* Averages strip */
.rep-avgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.rep-avg-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rep-avg-icon { flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--navy-subtle); color: var(--navy); }
.rep-avg-num { font-family: 'Cairo', sans-serif; font-size: 1.2rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.rep-avg-num small { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-right: 3px; }
.rep-avg-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }

.rep-section {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow-card); margin-bottom: 1.5rem;
}
.rep-section-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 1.2rem; justify-content: space-between;
  font-family: 'Cairo', sans-serif; font-size: 1rem; font-weight: 800; color: var(--text);
  padding-bottom: 11px; border-bottom: 2px solid var(--navy);
}
.rep-section-head .rep-section-title { display: inline-flex; align-items: center; gap: 8px; }
.rep-section-head .ico { color: var(--navy); }

/* Export button */
.rep-export-btn {
  display: inline-flex; align-items: center; gap: 6px; font-family: 'Tajawal', sans-serif;
  font-size: 0.76rem; font-weight: 700; color: var(--text-muted); cursor: pointer;
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  padding: 6px 11px; transition: all 0.15s; white-space: nowrap;
}
.rep-export-btn:hover { color: var(--navy); border-color: var(--navy-border); }
.rep-export-btn .ico { color: inherit; }
.rep-export-group { display: inline-flex; gap: 6px; }
.rep-toolbar-export { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-right: auto; }
#rep-refresh-btn.rep-spinning .ico { animation: spin 0.7s linear infinite; }

/* Horizontal bar list (trend, data source) */
.rep-bars { display: flex; flex-direction: column; gap: 11px; }
.rep-bar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; }
.rep-bar-label { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-bar-track { height: 22px; background: var(--bg-elevated); border-radius: 6px; overflow: hidden; position: relative; }
.rep-bar-fill { height: 100%; background: linear-gradient(90deg, var(--navy-light), var(--navy)); border-radius: 6px; min-width: 2px; transition: width 0.4s ease; }
.rep-bar-fill.sold { background: linear-gradient(90deg, var(--sold-color), color-mix(in srgb, var(--sold-color) 70%, #000)); }
.rep-bar-val { font-size: 0.82rem; font-weight: 700; color: var(--text); white-space: nowrap; min-width: 42px; text-align: left; }
.rep-bar-val small { color: var(--text-muted); font-weight: 600; font-size: 0.72rem; }

/* Tables (marketers, inventory) */
.rep-table-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--navy) transparent; }
.rep-table-wrap::-webkit-scrollbar, .rep-cols::-webkit-scrollbar { height: 7px; }
.rep-table-wrap::-webkit-scrollbar-track, .rep-cols::-webkit-scrollbar-track { background: var(--bg-elevated); border-radius: 4px; }
.rep-table-wrap::-webkit-scrollbar-thumb, .rep-cols::-webkit-scrollbar-thumb { background: var(--navy); border-radius: 4px; }
.rep-cols { scrollbar-width: thin; scrollbar-color: var(--navy) transparent; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.rep-table th, .rep-table td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rep-table th { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rep-table td { color: var(--text); }
.rep-table tbody tr:hover { background: var(--bg-elevated); }
.rep-table tbody tr:last-child td { border-bottom: none; }
.rep-table .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.rep-table .muted { color: var(--text-muted); font-weight: 600; }
.rep-table tfoot td { font-weight: 800; color: var(--text); border-top: 2px solid var(--border-strong); }
.rep-pill { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700; min-width: 26px; text-align: center; }
.rep-zero { color: var(--text-dim); font-weight: 700; }
.rep-empty { text-align: center; padding: 2.5rem 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); margin-bottom: 1.5rem; }
.rep-empty-icon { color: var(--text-dim); margin-bottom: 12px; }
.rep-empty-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--text); margin-bottom: 6px; }
.rep-empty-sub { font-size: 0.84rem; color: var(--text-muted); max-width: 420px; margin: 0 auto; line-height: 1.6; }
.rep-pill.sold { background: var(--sold-bg); color: var(--sold-color); border: 1px solid var(--sold-border); }
.rep-pill.open { background: var(--open-bg); color: var(--open-color); border: 1px solid var(--open-border); }
.rep-pill.reserved { background: var(--reserved-bg); color: var(--reserved-color); border: 1px solid var(--reserved-border); }

/* Mini stacked inventory bar inside a table cell */
.rep-stack { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: var(--bg-elevated); min-width: 90px; }
.rep-stack i { display: block; height: 100%; }
.rep-stack .open { background: var(--open-color); }
.rep-stack .reserved { background: var(--reserved-color); }
.rep-stack .sold { background: var(--sold-color); }
.rep-stack .closed { background: var(--text-dim); }

/* Two-up grid for the overview donuts */
.rep-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Donut charts */
.rep-donut-wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.rep-donut { width: 150px; height: 150px; flex-shrink: 0; }
.rep-donut circle { transition: stroke-dasharray 0.5s ease; }
.rep-donut-num { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 24px; fill: var(--text); }
.rep-donut-sub { font-size: 10px; fill: var(--text-muted); }
.rep-legend { display: flex; flex-direction: column; gap: 9px; min-width: 150px; }
.rep-legend-item { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; color: var(--text-muted); }
.rep-legend-item b { color: var(--text); margin-right: auto; font-variant-numeric: tabular-nums; }
.rep-legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

/* Vertical column chart (monthly trend) */
.rep-cols { display: flex; align-items: flex-end; gap: 10px; min-height: 200px; padding-top: 8px; overflow-x: auto; }
.rep-col { flex: 1; min-width: 40px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.rep-col-v { font-size: 0.72rem; font-weight: 700; color: var(--text); margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.rep-col-bar { width: 64%; max-width: 44px; background: linear-gradient(180deg, var(--navy-light), var(--navy)); border-radius: 6px 6px 0 0; position: relative; min-height: 3px; }
.rep-col-bar .sold { position: absolute; bottom: 0; left: 0; right: 0; background: var(--sold-color); border-radius: 6px 6px 0 0; }
.rep-col-x { font-size: 0.66rem; color: var(--text-muted); margin-top: 8px; text-align: center; line-height: 1.5; white-space: nowrap; }
.rep-chart-legend { display: flex; gap: 16px; justify-content: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rep-chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--text-muted); }
.rep-chart-legend i { width: 11px; height: 11px; border-radius: 3px; }

/* Sales (counted from the unit — see reports.js header) */
.rep-kpi-sub { font-size: 0.68rem; color: var(--text-dim); margin-top: 4px; }
.rep-notes { display: flex; flex-direction: column; gap: 6px; margin: -0.5rem 0 1.5rem; }
.rep-note { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; padding: 8px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-right: 3px solid var(--sand); border-radius: var(--radius-sm); }
.rep-legend-values { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rep-col-bar.sales { background: var(--sold-color); }
.rep-col-bar .sys { position: absolute; bottom: 0; left: 0; right: 0; background: var(--navy); border-radius: 6px 6px 0 0; }
.rep-bar-fill.muted { background: var(--text-dim); }
.rep-subhead { font-size: 0.78rem; font-weight: 800; color: var(--text-muted); margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.rep-foot { font-size: 0.74rem; color: var(--text-muted); margin-top: 10px; }
.rep-chan { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; border: 1px solid var(--border); color: var(--text-muted); }
.rep-chan.system { color: var(--navy); border-color: var(--navy-border); background: var(--navy-subtle); }
.rep-chan.direct { color: var(--sand); border-color: color-mix(in srgb, var(--sand) 45%, transparent); background: color-mix(in srgb, var(--sand) 12%, transparent); }
.rep-table tbody tr.rep-row-direct td { color: var(--text-muted); font-style: italic; }

@media (max-width: 760px) {
  .rep-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .rep-bar-row { grid-template-columns: 96px 1fr auto; gap: 8px; }
  .rep-bar-label { font-size: 0.76rem; }
  .rep-section { padding: 1.1rem 1rem; }
  .rep-export-btn { font-size: 0.72rem; padding: 5px 9px; }
  .rep-toolbar-export { display: flex; width: 100%; margin-right: 0; }
  .rep-toolbar-export > .btn { flex: 1 1 auto; justify-content: center; }
  #rep-refresh-btn { flex: 1 1 100%; justify-content: center; }
}

/* ════════════════════════════════════
   BULK APARTMENT EDITOR  (إدارة شقق العمارة)
   ════════════════════════════════════ */
.bulk-modal { max-width: min(980px, 96vw); width: 980px; }

/* Controls — grouped into a soft panel */
.bulk-controls { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: end; padding: 14px 16px; margin-bottom: 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bulk-controls label { display: flex; flex-direction: column; gap: 6px; font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.bulk-controls input, .bulk-controls select { min-height: 40px; padding: 7px 11px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 700; transition: border-color .15s, box-shadow .15s; }
.bulk-controls input:focus, .bulk-controls select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
/* The two shape boxes are type="text" + inputmode="numeric" (so the Arabic digit
   mask can run), which the old type="number" selector never matched — they were
   stretching to the label's full width and stacking. */
.bulk-controls input[type="number"], #bulk-floors, #bulk-perfloor { width: 96px; text-align: center; }
.bulk-cap-hint { align-self: end; margin-inline-start: auto; padding: 6px 13px; border-radius: var(--radius-pill); background: var(--sand-subtle); border: 1px solid var(--sand-border); color: var(--sand); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }

/* Split phone input: [+][country code][national number] */
.phone-field { display: flex; align-items: stretch; gap: 6px; }
.phone-field .phone-plus { display: flex; align-items: center; color: var(--text-muted); font-weight: 700; padding: 0 2px; }
.phone-field .phone-cc { width: 68px; flex: 0 0 auto; text-align: center; }
.phone-field .phone-nat { flex: 1 1 auto; min-width: 0; }

/* Model palette */
.bulk-palette-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 11px 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; }
.bulk-palette-label { font-size: 0.78rem; font-weight: 800; color: var(--text); }
.bulk-models { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; }
.bulk-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: var(--radius-pill); border: 1px solid color-mix(in srgb, var(--c, var(--border-strong)) 55%, transparent); background: color-mix(in srgb, var(--c, var(--navy)) 12%, var(--bg-card)); color: var(--text); font-family: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.bulk-chip:hover { transform: translateY(-1px); box-shadow: 0 5px 14px -6px color-mix(in srgb, var(--c, var(--navy)) 60%, transparent); }
.bulk-chip:active { transform: translateY(0); }
.bulk-chip-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--navy)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--navy)) 22%, transparent); }
.bulk-chip-none { border-style: dashed; color: var(--text-muted); background: none; }
.bulk-chip-none:hover { box-shadow: none; border-color: var(--navy-border); color: var(--navy); }
.bulk-nomodels { font-size: 0.82rem; color: var(--sold-color); font-weight: 600; }
.bulk-selcount { font-size: 0.75rem; font-weight: 800; color: var(--navy); white-space: nowrap; padding: 5px 11px; background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: var(--radius-pill); }
.bulk-selcount:empty { display: none; }
.bulk-hint { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 10px; }

/* Grid canvas */
.bulk-gridwrap { overflow: auto; max-height: 54vh; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg-card); box-shadow: inset 0 1px 4px rgba(0,0,0,.06); }
.bulk-grid-inner { display: inline-flex; flex-direction: column; gap: 7px; min-width: 100%; }
.bulk-row { display: flex; align-items: stretch; gap: 7px; }
.bulk-cells { display: flex; gap: 7px; }

.bulk-corner, .bulk-colhead, .bulk-floorlabel { flex-shrink: 0; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); font-family: inherit; font-weight: 800; font-size: 0.72rem; cursor: pointer; border-radius: var(--radius-xs); transition: all 0.15s; }
.bulk-corner { width: 36px; }
.bulk-floorlabel { width: 36px; }
.bulk-colhead { width: 78px; height: 28px; }
.bulk-corner:hover, .bulk-colhead:hover, .bulk-floorlabel:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-subtle); }
/* Keep row/column headers in view while scrolling a large grid */
.bulk-colhead   { position: sticky; top: -12px; z-index: 3; }
.bulk-floorlabel{ position: sticky; right: -12px; z-index: 3; }
.bulk-corner    { position: sticky; top: -12px; right: -12px; z-index: 5; }

.bulk-cell { width: 78px; min-height: 56px; border-radius: var(--radius-xs); border: 1px solid color-mix(in srgb, var(--c, var(--border-strong)) 42%, var(--border)); background: color-mix(in srgb, var(--c, var(--bg-elevated)) 9%, var(--bg-elevated)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; user-select: none; padding: 9px 4px 5px; transition: box-shadow .12s, transform .12s, border-color .12s; position: relative; overflow: hidden; }
.bulk-cell::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 4px; background: var(--c, transparent); opacity: .95; }
.bulk-cell:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c, var(--navy)) 70%, transparent); box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--c, #1c2740) 75%, transparent); }
/* Editable apartment number. Chromeless until hovered/focused so the grid still
   reads as tiles rather than a form, but it is a real input — numbers are free
   text (1، 1-A، 1-ب، C), not just digits. */
.bulk-cell-no {
  font-weight: 800; font-size: 0.9rem; color: var(--text); font-variant-numeric: tabular-nums;
  line-height: 1; width: 100%; max-width: 68px; text-align: center; padding: 2px 3px; direction: ltr;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  font-family: inherit; unicode-bidi: plaintext; transition: background .12s, border-color .12s;
}
.bulk-cell-no:hover:not([readonly]) { background: var(--bg-input); border-color: var(--border-strong); }
.bulk-cell-no:focus { outline: none; background: var(--bg-input); border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy-subtle); cursor: text; }
.bulk-cell-no[readonly] { cursor: not-allowed; }
.bulk-cell-model { font-size: 0.58rem; font-weight: 600; color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-cell.nomodel { border-style: dashed; border-color: var(--sold-border); background: var(--bg-elevated); }
.bulk-cell.nomodel::before { display: none; }
.bulk-cell.nomodel .bulk-cell-model { color: var(--sold-color); }
.bulk-cell.just-set { animation: bulk-just-set 1.6s ease-out; }
@keyframes bulk-just-set { 0%, 35% { box-shadow: 0 0 0 3px var(--open-color); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .bulk-cell.just-set { animation: none; box-shadow: 0 0 0 3px var(--open-color); } }
.bulk-cell.selected { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy), 0 10px 20px -10px var(--navy); transform: translateY(-2px); z-index: 1; }
.bulk-cell.locked { opacity: .6; cursor: not-allowed; filter: saturate(.65); }
.bulk-cell.locked::after { content: ""; position: absolute; top: 3px; left: 4px; width: 10px; height: 10px; background: var(--text-muted); -webkit-mask: var(--ico-lock) center/contain no-repeat; mask: var(--ico-lock) center/contain no-repeat; opacity: 0.8; pointer-events: none; }
.bulk-cell.locked:hover { transform: none; box-shadow: none; border-color: color-mix(in srgb, var(--c, var(--border-strong)) 42%, var(--border)); }

.bulk-warning { margin-top: 14px; padding: 11px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 800; text-align: center; letter-spacing: .01em; }
.bulk-warning:empty { display: none; }
.bulk-warning.ok { background: var(--grid-open-bg); border: 1px solid var(--grid-open-bd); color: var(--grid-open-tx); }
.bulk-warning.bad { background: var(--sold-bg); border: 1px solid var(--sold-border); color: var(--sold-color); }
.bulk-warning.info { background: var(--reserved-bg, var(--navy-subtle)); border: 1px solid var(--reserved-border, var(--navy-border)); color: var(--reserved-color, var(--navy)); font-weight: 700; }
.apt-nomodel-note { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px dashed var(--border-strong); color: var(--text-muted); font-size: 0.82rem; font-weight: 600; line-height: 1.5; }

@media (max-width: 600px) {
  .bulk-cell, .bulk-colhead { width: 64px; }
  .bulk-cell { min-height: 52px; }
  .bulk-controls input[type="number"], #bulk-floors, #bulk-perfloor { width: 78px; }
  .bulk-rowcount, .bulk-delfloor { min-height: 52px; }
  .bulk-rowcount { width: 38px; }
  .bulk-delfloor { width: 26px; }
  .bulk-rowtools { gap: 4px; padding-inline-start: 6px; }
  .bulk-rowtools-head { width: 74px; }
}

/* Inline add / remove controls */
.bulk-cell-x { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; line-height: 1; border-radius: 50%; border: none; background: color-mix(in srgb, var(--sold-color) 92%, #000); color: #fff; font-size: 0.6rem; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 2; padding: 0; box-shadow: 0 2px 6px -1px rgba(0,0,0,.4); transition: transform .1s; }
.bulk-cell-x:hover { transform: scale(1.15); }
.bulk-cell:hover .bulk-cell-x { display: flex; }
.bulk-addcell { width: 42px; align-self: stretch; min-height: 56px; border: 1px dashed var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); border-radius: var(--radius-xs); font-size: 1.15rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.bulk-addcell:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-subtle); }
.bulk-addcell-head { width: 42px; flex-shrink: 0; }
/* Per-floor tools, pinned to the far end of each floor row: how many units this
   floor holds, and a delete for the whole floor. The header row carries a spacer
   of the same width so the column heads stay over their columns. */
.bulk-rowtools { display: flex; align-items: center; gap: 5px; flex-shrink: 0; padding-inline-start: 8px; }
.bulk-rowtools-head { width: 85px; flex-shrink: 0; }
.bulk-rowcount { width: 44px; align-self: stretch; min-height: 56px; text-align: center; padding: 4px; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-xs); color: var(--text); font-family: inherit; font-size: 0.85rem; font-weight: 800; transition: border-color .15s, box-shadow .15s; }
.bulk-rowcount:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-subtle); }
.bulk-delfloor { width: 30px; align-self: stretch; min-height: 56px; border: 1px dashed var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); border-radius: var(--radius-xs); font-family: inherit; font-size: 0.85rem; font-weight: 800; cursor: pointer; transition: all 0.15s; }
.bulk-delfloor:hover { border-color: #C9384A; color: #C9384A; background: color-mix(in srgb, #C9384A 12%, transparent); }
.bulk-addfloor { border: 1px dashed var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); border-radius: var(--radius-xs); font-family: inherit; font-size: 0.8rem; font-weight: 800; padding: 9px 18px; cursor: pointer; transition: all 0.15s; }
.bulk-addfloor:hover { border-color: var(--navy); color: var(--navy); background: var(--navy-subtle); }

/* Model card edit/delete actions */
.model-card { position: relative; }
.model-card.has-actions { padding-top: 2.9rem; }
.model-card-actions { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.model-act { width: 28px; height: 28px; border-radius: var(--radius-xs); border: 1px solid var(--navy-border); background: var(--bg-card); color: var(--navy); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-card); transition: all 0.15s; }
.model-act:hover { background: var(--navy-subtle); }
.model-act.del { border-color: var(--sold-border); color: var(--sold-color); }
.model-act.del:hover { background: var(--sold-bg); }

/* Reservation type selector (segmented) */
.reserve-type-seg { display: flex; gap: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.rt-opt { flex: 1; padding: 9px 8px; border: none; background: none; border-radius: var(--radius-xs); font-family: 'Tajawal', sans-serif; font-size: 0.84rem; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all 0.15s; }
.rt-opt:hover { color: var(--text); }
.rt-opt.active { background: var(--navy); color: #fff; box-shadow: 0 1px 6px rgba(61,80,110,0.3); }
.reserve-type-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 8px; line-height: 1.6; min-height: 1.2em; }

/* Reserve modal: read-only unit summary card (not clickable/focusable) */
.reserve-unit-card { background: linear-gradient(135deg, var(--navy-subtle), transparent), var(--bg-elevated); border: 1px solid var(--navy-border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 1.25rem; user-select: none; }
.reserve-unit-card .ruc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.reserve-unit-card .ruc-project { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--text); }
.reserve-unit-card .ruc-price { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.reserve-unit-card .ruc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reserve-unit-card .ruc-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 11px; font-size: 0.78rem; }
.reserve-unit-card .ruc-k { color: var(--text-muted); font-size: 0.72rem; }
.reserve-unit-card .ruc-v { color: var(--text); font-weight: 800; }
.reserve-unit-card .ruc-croqui { margin-top: 12px; text-align: center; }
.reserve-unit-card .ruc-croqui:empty { display: none; }

/* Reserve modal: section dividers + required-field star */
.reserve-section-label { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; color: var(--navy); text-transform: none; margin: 1.4rem 0 0.7rem; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.req-star { color: var(--sold-color); }

/* Reservation: holding state + type badge */
.req-card.s-holding { border-right-color: var(--navy); }
.req-badge.holding { background: var(--navy-subtle); border-color: var(--navy-border); color: var(--navy); }
.req-type-badge { font-size: 0.68rem; font-weight: 700; color: var(--sand); background: var(--sand-subtle); border: 1px solid var(--sand-border); border-radius: var(--radius-pill); padding: 2px 9px; white-space: nowrap; }

/* Manager queue: "waiting since" + 3-day escalation */
.req-wait-badge { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 9px; white-space: nowrap; }
.req-wait-badge.escalated { color: var(--alert); background: color-mix(in srgb, var(--alert) 12%, transparent); border-color: color-mix(in srgb, var(--alert) 40%, transparent); }
.req-card.escalated { border-right-color: var(--alert); box-shadow: 0 0 0 1px color-mix(in srgb, var(--alert) 28%, transparent); }

/* ── Salesforce customer verification (reserve modal) ─────────────
   The rep proves the customer is theirs before the unit can be reserved;
   see supabase/functions/sf-customer-lookup. */
.btn-verify { margin-top: 8px; width: 100%; font-size: 0.82rem; padding: 8px 12px; }
.reserve-sf-status {
  margin-top: 8px; border-radius: 8px; padding: 9px 12px;
  font-size: 0.79rem; line-height: 1.7; border: 1px solid transparent;
}
.reserve-sf-status.ok {
  color: var(--open-color); background: var(--open-bg); border-color: var(--open-border);
}
.reserve-sf-status.bad {
  color: var(--sold-color); background: var(--sold-bg); border-color: var(--sold-border);
}
.reserve-sf-status.busy {
  color: var(--text-muted); background: var(--bg-hover); border-color: var(--border);
}
/* Salesforce unreachable: the reservation is allowed through, but this must not
   look like a clean ✓ — it is an amber "proceeded without verification". */
.reserve-sf-status.warn {
  color: var(--reserved-color); background: var(--reserved-bg); border-color: var(--reserved-border);
}
.reserve-sf-status b { font-weight: 700; }
/* ── Four-part customer name requirement ──────────────────────────
   The reservation is contract paperwork; the name must match the national ID
   exactly. Salesforce usually supplies only two parts, so the rep completes it
   and needs to see that state live rather than discovering it at submit. */
.name-hint {
  margin-top: 6px; font-size: 0.74rem; line-height: 1.6; color: var(--text-muted);
}
.name-hint.short { color: var(--reserved-color); font-weight: 600; }
.name-hint.ok    { color: var(--open-color);     font-weight: 600; }
.form-input.input-invalid {
  border-color: var(--reserved-border);
  box-shadow: 0 0 0 2px rgba(183,121,31,0.14);
}

/* ══ Reservation path (مسار الحجز) — Salesforce-style stage bar ══
   Reads RIGHT-TO-LEFT: stage 1 is the rightmost chevron and every tip points
   LEFT, into the notch of the stage that follows it. */
.req-path { display: flex; direction: rtl; list-style: none; margin: 12px 0 2px; padding: 0; overflow-x: auto; scrollbar-width: none; }
.req-path::-webkit-scrollbar { display: none; }
.req-path .rp-step {
  /* Share the row proportionally so all stages are always visible. The bar must
     never scroll: hiding stages behind a drag inside a card is worse than any
     amount of tightness. */
  position: relative; flex: 1 1 auto; min-width: min-content;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  /* Clear BOTH cut-outs: the 9px notch on the right and the 9px tip on the
     left. The old 5px right padding let the notch slice the first letter of
     every label («دفعة كاملة», «عربون» — F, 2026-10-13). */
  padding: 6px 12px 6px 11px; margin-left: -8px;
  font-size: 0.66rem; font-weight: 700; line-height: 1.25; text-align: center;
  /* A two-word label wraps to two lines when the card is narrow instead of
     being clipped; min-content keeps every word whole. */
  white-space: normal; overflow: hidden;
  background: var(--bg-elevated); color: var(--text-dim);
  clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 9px 100%, 0 50%);
}
.req-path .rp-step:last-child { margin-left: 0; }
/* Earlier stages paint above later ones so each tip sits over the next notch. */
.req-path .rp-step:nth-child(1) { z-index: 8; }
.req-path .rp-step:nth-child(2) { z-index: 7; }
.req-path .rp-step:nth-child(3) { z-index: 6; }
.req-path .rp-step:nth-child(4) { z-index: 5; }
.req-path .rp-step:nth-child(5) { z-index: 4; }
.req-path .rp-step:nth-child(6) { z-index: 3; }
.req-path .rp-step:nth-child(7) { z-index: 2; }
.req-path .rp-step:nth-child(8) { z-index: 1; }
/* The stage word in the header, colour-matched to the bar so the two read as
   one unit — and so state is never encoded by colour alone. */
.rq-stage { margin-top: 7px; font-size: 0.75rem; font-weight: 800; color: var(--text-muted); }
.rq-stage.s-pending  { color: var(--reserved-color); }
.rq-stage.s-approved { color: var(--open-color); }
.rq-stage.s-sold     { color: var(--open-color); }
.rq-stage.s-holding  { color: var(--navy); }
.rq-stage.s-cancelled, .rq-stage.s-rejected, .rq-stage.s-expired { color: var(--sold-color); }

/* المالية — the two signatures a payment needs, on the card. Deliberately quiet:
   this reports state, it is not something you click. The rejected variant is the
   loud one because it is the only state that needs somebody to act. */
.rq-fin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rq-sig { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; font-weight: 700; border-radius: var(--radius-pill); padding: 2px 9px; border: 1px solid var(--border); color: var(--text-muted); }
.rq-sig.ok { border-color: var(--open-border); background: var(--open-bg); color: var(--open-color); }
.rq-fin.rejected { display: block; font-size: 0.72rem; font-weight: 700; line-height: 1.5; border-radius: 8px; padding: 6px 9px; border: 1px solid var(--sold-border); background: var(--sold-bg); color: var(--sold-color); }
.rq-fin-hint { display: block; font-weight: 600; opacity: 0.85; margin-top: 2px; }

/* The 5am sweep, stated on the card. Muted by default — it is a standing fact,
   not an alarm — and only picks up colour once someone has acted on it. */
.rq-clock { margin-top: 6px; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); }
.rq-clock.extended { color: var(--open-color); }

/* Shown to a بائع in the reserve form: their submission is a request, not a
   hold. Amber rather than red — it is a condition of the flow, not an error. */
.reserve-leader-note { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 0.76rem; line-height: 1.6;
  border: 1px solid var(--reserved-border); background: var(--reserved-bg); color: var(--reserved-color); }

/* ── طلبات الحجز: sections, next step, and what changed ──────────────────
   The list is split into «يحتاج إجراءك» and the rest. Only the first section is
   loud: it is the only one that asks anything of the reader. Everything else
   stays in the existing quiet register so the page still reads as one list. */
.req-sec-head { display: flex; align-items: center; gap: 8px; margin: 18px 2px 10px; flex-wrap: wrap; }
.req-sec-head:first-child { margin-top: 4px; }
.req-sec-title { font-size: 0.92rem; font-weight: 800; color: var(--text); }
.req-sec-count { font-size: 0.7rem; font-weight: 800; min-width: 20px; text-align: center;
  padding: 1px 7px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-muted); }
.req-sec-hint { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.req-sec-head.act .req-sec-title { color: var(--reserved-color); }
.req-sec-head.act .req-sec-count { background: var(--reserved-bg); border-color: var(--reserved-border); color: var(--reserved-color); }
/* The all-clear. Worth its own line: "nothing is waiting on me" is an answer,
   and an empty space is not. */
.req-sec-clear { margin: 4px 2px 14px; padding: 9px 12px; border-radius: 10px; font-size: 0.8rem; font-weight: 700;
  border: 1px solid var(--open-border); background: var(--open-bg); color: var(--open-color); }

/* The next step, in words. `mine` is the only variant that raises its voice. */
.rq-next { display: flex; align-items: baseline; gap: 6px; margin-top: 7px; font-size: 0.75rem; line-height: 1.5; }
.rq-next-k { flex: none; font-weight: 800; font-size: 0.66rem; padding: 1px 7px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); color: var(--text-muted); }
.rq-next-v { font-weight: 600; color: var(--text-muted); }
.rq-next.mine .rq-next-k { background: var(--reserved-bg); border-color: var(--reserved-border); color: var(--reserved-color); }
.rq-next.mine .rq-next-v { color: var(--text); font-weight: 700; }
.rq-next.closed { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }

/* A card waiting on YOU gets a ring — deliberately an `outline`, not a border or
   a box-shadow. `.req-card` already spends its leading edge on the STATUS colour
   (`border-right`, which is the leading edge in RTL) and `.escalated` already
   spends the box-shadow on its red ring; using either here would have traded one
   piece of information for another. `outline` collides with neither and costs no
   layout. Subtle on purpose: the section heading and the «عليك الآن» pill are
   what actually say it. */
.req-card.is-mine { outline: 1px solid var(--reserved-border); outline-offset: -1px; }
.rq-new { display: inline-block; margin-inline-end: 6px; font-size: 0.62rem; font-weight: 800; vertical-align: middle;
  padding: 1px 6px; border-radius: var(--radius-pill); background: var(--navy-subtle); color: var(--navy); border: 1px solid var(--navy-border); }

/* ── التوقيع الإلكتروني ─────────────────────────────────────────────────
   The pad is a HAND-OVER screen: the seller passes the phone to a customer who
   has never seen this app. Big target, high contrast, one instruction. */
/* 190px was too small to sign in (F, 2026-09-13). Deliberately NOT a vh/dvh
   height: the backing store is sized ONCE in contractSignPad(), so a height that
   changes with the viewport — a phone rotating, or the keyboard opening under
   the typed tab — would leave the canvas scaled wrong and the ink offset from
   the finger. A fixed px height per breakpoint keeps drawing correct no matter
   what the viewport does mid-signature. `.modal` is already
   `max-height:90dvh; overflow-y:auto`, so the taller pad scrolls instead of
   pushing the confirm button off a small screen. */
.sig-canvas { display: block; width: 100%; height: 300px; border-radius: 10px; cursor: crosshair;
  background: #fff; border: 2px dashed var(--border); touch-action: none; }
.sig-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.sig-tip { font-size: 0.74rem; color: var(--text-muted); }
.sig-who { font-size: 0.9rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.sig-typed-input { font-size: 1.3rem; font-weight: 700; text-align: center; padding: 14px 12px; }

/* Phone portrait: narrower box, so it needs to be TALLER to hold a signature at
   a natural hand size, not shorter. */
@media (max-width: 560px) {
  .sig-canvas { height: 340px; }
}
/* Phone LANDSCAPE is the one case where vertical room is genuinely scarce — the
   pad must still fit beside its header and buttons, and a wide short box is the
   better shape for a signature anyway. */
@media (max-height: 500px) and (orientation: landscape) {
  .sig-canvas { height: 200px; }
  .sig-typed-input { font-size: 1.15rem; padding: 10px 12px; }
}

/* The two steps inside the issued contract. */
.es-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 8px; }
.es-cell { border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; background: var(--bg-soft, transparent); }
.es-k { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); margin-bottom: 7px; }
.es-done { font-size: 0.78rem; font-weight: 700; color: var(--open-color); line-height: 1.5; }
.es-wait { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); line-height: 1.5; }
/* per-party signing (2026-10-07): the two ways to sign sit side by side */
.es-opts { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 6px; }
.es-cell .btn-sm { margin-top: 6px; }

/* وسائل السداد — one card per instrument, each with its own receipt.
   FLEX-WRAP, not a fixed grid: this renders in two containers of very different
   widths (the wide reqDialog on طلبات الحجز and the narrower reserve modal on
   المشاريع), and a fixed 5-column grid squeezed the fields to ~40px in the
   narrow one — «الراجحي» rendered as «الرا». A viewport media query cannot fix
   that, because what is narrow is the CONTAINER, not the screen. */
.rq-pay-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.rq-pay-row > .form-input, .rq-pay-row > .form-select { flex: 1 1 130px; min-width: 108px; font-size: 0.8rem; padding: 7px 9px; }
.rq-pay-del { flex: 0 0 auto; border: 1px solid var(--sold-border); background: var(--sold-bg); color: var(--sold-color);
  border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-weight: 800; line-height: 1; }
/* The receipt always gets its own full-width line — a file input next to text
   inputs is the first thing to get crushed. */
/* Who actually paid. Its own full-width line rather than a 5th cell in the
   instrument row: it holds a FOUR-PART name, and squeezed into the 130px
   basis the other fields use it would show about one name. */
.rq-pay-payer { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rq-pay-payer label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); flex: 0 0 auto; }
.rq-pay-payer > .form-select { flex: 0 1 140px; font-size: 0.8rem; padding: 7px 9px; }
.rq-pay-payer > .form-input { flex: 1 1 220px; min-width: 160px; font-size: 0.8rem; padding: 7px 9px; }
/* أكثر من مشترٍ (2026-10-18): one compact card per extra buyer (supabase.js coBuyersHtml). */
.cob-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.cob-card .form-group { margin-bottom: 6px; }
.cob-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
  font-size: 0.78rem; font-weight: 800; color: var(--text-muted); }
.cob-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cob-grid > .form-input, .cob-grid > .form-select { flex: 1 1 130px; min-width: 108px; font-size: 0.8rem; padding: 7px 9px; }
.cob-add { margin-bottom: 4px; }
.rq-cust-more { font-weight: 700; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.rq-pay-file { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px dashed var(--border); padding-top: 7px; margin-top: 1px; }
.rq-pay-file label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); flex: 0 0 auto; }
.rq-pay-file input[type=file] { flex: 1 1 200px; }
.rq-pay-fline { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rq-pay-fname { font-size: 0.72rem; color: var(--open-color); font-weight: 700; flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* طلب البائع — the review stage. Same quiet register as .rq-fin. */
.rq-returned { display: block; margin-top: 6px; padding: 6px 9px; border-radius: 8px; font-size: 0.72rem; font-weight: 700; line-height: 1.5;
  border: 1px solid var(--reserved-border); background: var(--reserved-bg); color: var(--reserved-color); }

.req-path .rp-step.done    { background: var(--open-bg); color: var(--open-color); }
.req-path .rp-step.skipped { background: var(--bg-elevated); color: var(--text-dim); opacity: 0.72; }
.req-path .rp-step.todo    { background: var(--bg-elevated); color: var(--text-dim); }
.req-path .rp-step.dead    { background: var(--sold-bg); color: var(--sold-color); }
/* "You are here" on an already-signed-off stage: a deeper fill, NOT an inset
   ring — clip-path cuts the ring's angled edges and leaves stray lines. */
.req-path .rp-step.current.done { background: var(--open-border); }
.req-path .rp-step.awaiting { background: var(--reserved-bg); color: var(--reserved-color); animation: rpPulse 2s ease-in-out infinite; }
/* Live stage that needs no approval (the 30-minute hold). */
.req-path .rp-step.current:not(.done):not(.awaiting):not(.dead) { background: var(--navy-subtle); color: var(--navy); }
.req-path.is-dead .rp-step.todo { opacity: 0.5; }

@keyframes rpPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.78; } }
@media (prefers-reduced-motion: reduce) { .req-path .rp-step.awaiting { animation: none; } }

@media (max-width: 640px) {
  .req-path .rp-step { padding: 5px 11px 5px 10px; font-size: 0.6rem; }
}

/* Approve-this-stage button — sits beside the existing .req-btn variants. */


/* ══ Reservation card — redesigned ══════════════════════════════════════════
   Ranked, not listed. The stage bar is the status, so the status badge and the
   reservation-type badge are gone; only urgency survives in the header. The
   six-cell customer grid collapses to a name plus one muted line (the rest is
   in the detail sheet). Files are quiet chips; actions are one dominant button
   plus a ghost, pinned to the bottom so cards in a row line up. */
.req-card { display: flex; flex-direction: column; }

.rq-top { display: flex; align-items: flex-start; gap: 10px; }
.rq-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 0.92rem;
            color: var(--text); line-height: 1.45; flex: 1; min-width: 0; }
.rq-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; }
.rq-price { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.12rem;
            color: var(--sold-color); margin-top: 6px; font-variant-numeric: tabular-nums; }
.rq-urgent { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
             border-radius: var(--radius-pill); font-size: 0.68rem; font-weight: 800; white-space: nowrap;
             background: var(--sold-bg); color: var(--sold-color); border: 1px solid var(--sold-border); }
.rq-wait { flex: none; font-size: 0.68rem; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
.rq-wait.urgent { color: var(--sold-color); }

.rq-who { margin-top: 11px; }
.rq-cust { font-weight: 800; font-size: 0.9rem; color: var(--text); }
.rq-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; line-height: 1.6; }

.rq-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px;
            padding-top: 10px; border-top: 1px dashed var(--border); }
.rq-file { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
           border-radius: var(--radius-xs); font-size: 0.71rem; font-weight: 700;
           background: transparent; color: var(--text-muted); border: 1px solid var(--border);
           cursor: pointer; font-family: inherit; }
.rq-file:hover { background: var(--bg-elevated); color: var(--text); }

.rq-note { margin-top: 10px; font-size: 0.74rem; color: var(--text-muted);
           background: var(--bg-elevated); border-radius: var(--radius-xs); padding: 8px 10px; line-height: 1.6; }

/* margin-top:auto pins the actions to the bottom, which is what makes a row of
   cards line up instead of ending wherever their content happens to stop. */
/* flex-wrap + a min-width of the label's own width: four buttons (an admin on a
   «على دفعات» card) used to squeeze the primary into a 5-line column and push the
   row out past the card's edge. Now they wrap onto a second line instead. */
.rq-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; }
.rq-actions .rq-btn, .rd-actions .rq-btn { min-width: -moz-fit-content; min-width: fit-content; }
.rq-btn { flex: 1; padding: 9px 12px; border-radius: var(--radius-xs); font-size: 0.79rem;
          font-weight: 800; border: 1px solid transparent; cursor: pointer; font-family: inherit;
          transition: filter .15s ease, background .15s ease; }
.rq-btn:hover { filter: brightness(1.06); }
.rq-btn:disabled { opacity: .55; cursor: default; }
.rq-btn.primary { background: var(--open-color); color: #fff; }
.rq-btn.sell    { background: var(--sold-color); color: #fff; }
.rq-btn.ghost   { flex: 0 0 auto; background: transparent; color: var(--text-muted);
                  border-color: var(--border-strong); }
.rq-btn.ghost:hover { background: var(--bg-elevated); color: var(--text); }

/* Same buttons inside the detail sheet. */
.rd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-actions .rq-btn { flex: 1; }
.rd-actions .rq-btn.ghost { flex: 0 0 auto; }

@media (max-width: 640px) {
  .rq-title { font-size: 0.88rem; }
  .rq-price { font-size: 1.05rem; }
  .rq-actions { padding-top: 10px; }
}


/* ══ Touch targets ══════════════════════════════════════════════════════════
   Everything tappable reaches the 44px guideline on a phone. Kept at desktop
   sizes on pointer devices so the UI doesn't turn chunky on a monitor. */
@media (max-width: 640px) {
  .modal-close { width: 44px; height: 44px; }
  .rq-btn { min-height: 44px; }
  .rq-file { min-height: 44px; padding: 10px 12px; }
  .req-attach-btn { min-height: 44px; }
  .pager-btn { min-width: 44px; height: 44px; }
  /* height, not min-height: .filter-chip's own padding otherwise wins */
  .filter-chip { min-height: 44px; height: 44px; }
}

/* ── عقود: contract issue modal ──────────────────────────────
   Print styling lives in contracts.js (contractPrintCss) because it is
   injected into an isolated print iframe, not into this page. These rules
   only dress the issue/reprint modal. */
.c-gaps { background: var(--sand-subtle); border: 1px solid var(--sand-border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.82rem; line-height: 1.8; }
.c-gaps ul { margin: 6px 18px 0 0; padding: 0; }
.c-words { margin-top: 6px; font-size: 0.82rem; color: var(--navy); font-weight: 700; min-height: 1.2em; }
.c-issued { text-align: center; padding: 18px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; line-height: 2; }
.c-issued-no { font-size: 1.15rem; font-weight: 800; color: var(--navy); letter-spacing: 0.03em; }
.c-inst-row { align-items: flex-end; gap: 8px; }
.c-inst-row .btn { margin-bottom: 2px; }
.c-signed-badge { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: var(--radius-pill); font-size: 0.78rem; font-weight: 800; color: var(--open-color); background: var(--open-bg); border: 1px solid var(--open-border); }

/* ── العقود page list ────────────────────────────────────────
   The queue view on contracts.html. Chips/search reuse the requests-page
   toolbar classes; only the row itself is new. */
.ct-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ct-search { max-width: 320px; }
/* Date / project / company / type filters (2026-11-08) — a second row under the stage chips. */
.ct-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: -4px 0 14px; }
.ct-filters .filter-select { min-width: 150px; }
.ct-result-count { font-size: 0.78rem; color: var(--text-muted); margin: -6px 0 10px; }
.ct-list { display: flex; flex-direction: column; gap: 8px; }
.ct-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-right: 3px solid var(--navy); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.ct-row:hover { border-color: var(--sand-border); transform: translateX(-2px); }
.ct-row:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; }
.ct-main { min-width: 0; }
.ct-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.ct-no { font-size: 0.74rem; font-weight: 800; color: var(--navy); letter-spacing: 0.02em; }
.ct-customer { font-weight: 700; font-size: 0.92rem; }
/* The unit is the thing being sold — it reads at full contrast, one step below
   the customer name. The project/building sits under it as context, muted. */
.ct-unit { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-top: 3px; }
.ct-place { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.ct-side { display: flex; align-items: center; gap: 12px; flex: none; }
.ct-price { font-size: 0.85rem; font-weight: 800; color: var(--sand); white-space: nowrap; }
.ct-when { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }
.ct-badge { font-size: 0.68rem; font-weight: 800; border-radius: var(--radius-pill); padding: 2px 9px; white-space: nowrap; }
.ct-badge.awaiting { color: var(--sand); background: var(--sand-subtle); border: 1px solid var(--sand-border); }
.ct-badge.unsigned { color: var(--navy); background: var(--navy-subtle); border: 1px solid var(--navy-border); }
.ct-badge.signed   { color: var(--open-color); background: var(--open-bg); border: 1px solid var(--open-border); }
.ct-badge.voided   { color: var(--sold-color); background: var(--sold-bg); border: 1px solid var(--sold-border); }
@media (max-width: 640px) {
  .ct-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .ct-side { justify-content: space-between; }
  .ct-search { max-width: none; width: 100%; }
  .ct-filters { gap: 8px; }
  .ct-filters .filter-select { flex: 1 1 calc(50% - 4px); min-width: 0; width: auto; }
  .ct-filters .req-date-filter { width: 100%; }
  .ct-filters .req-date-filter .bsh-date { flex: 1 1 0; min-width: 0; }
}
.ct-subnav { display: inline-flex; margin-bottom: 14px; }

/* ── Deed coverage panel (edit-project modal) ──────────────────
   Answers "are these fields empty because nobody filled them, or because this
   project's deeds live on its buildings?" — the two look identical otherwise. */
.deed-status { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-hover); }
.deed-status.ok   { border-color: var(--open-border); background: var(--open-bg); }
.deed-status.warn { border-color: var(--sand-border); background: var(--sand-subtle); }
.deed-status.bad  { border-color: var(--sold-border); background: var(--sold-bg); }
.deed-status-head { font-size: 0.82rem; font-weight: 700; line-height: 1.7; }
.deed-status-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.deed-b { font-size: 0.72rem; padding: 2px 8px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); }
.deed-b.ok { color: var(--open-color); border-color: var(--open-border); }
.deed-status-foot { font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; }

/* ── System switcher (⊞) ─────────────────────────────────────
   Injected into every nav by setupSystemSwitcher(). Sits between the brand and
   the section tabs: brand = which system you're in, ⊞ = go to another one,
   tabs = pages within this one. */
.sys-switch-wrap { position: relative; flex: none; }
.sys-switch-btn { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.sys-switch-btn:hover { color: var(--text); border-color: var(--sand-border); }
.sys-switch-btn:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; }
.sys-switch-dropdown { position: absolute; top: calc(100% + 8px); right: 0; min-width: 280px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 18px 44px -18px rgba(0,0,0,0.5); padding: 6px; z-index: 1200; display: none; }
.sys-switch-dropdown.open { display: block; }
.sys-switch-head { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); padding: 6px 10px 8px; }
.sys-switch-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.sys-switch-item:hover { background: var(--bg-hover); }
.sys-switch-item.active { background: var(--navy-subtle); }
.ssi-ico { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--navy-subtle); border: 1px solid var(--navy-border); color: var(--navy); }
.sys-switch-item.active .ssi-ico { background: var(--navy); border-color: var(--navy); color: #fff; }
.ssi-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ssi-label { font-weight: 700; font-size: 0.86rem; }
.ssi-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.5; }
.dash-secs { margin-top: 8px; font-size: 0.72rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 8px; }
@media (max-width: 640px) {
  .sys-switch-dropdown { position: fixed; top: 64px; right: 10px; left: 10px; min-width: 0; }
}

/* ── Contract issue: form + live preview side by side ────────
   The preview iframe renders the REAL contract through the same pipeline as
   printing. `zoom` (not transform:scale) so the scrollbars and layout box
   match what's drawn — a scaled transform leaves the original box behind and
   the stage scrolls wrong. */
#contract-modal .modal.wide:has(.ci-grid) { max-width: 1200px; }
.ci-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.ci-form { min-width: 0; }
.ci-preview { min-width: 0; }
.ci-pv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 0.78rem; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.ci-pv-hint { font-weight: 600; color: var(--text-muted); font-size: 0.72rem; }
.ci-pv-stage { height: 58vh; overflow: auto; background: #e9e9ec; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.ci-pv-stage iframe { width: 794px; min-height: 1123px; border: 0; background: #fff; display: block; margin: 0 auto; box-shadow: 0 1px 10px rgba(0,0,0,0.22); zoom: 0.52; }
@media (min-width: 1024px) {
  .ci-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .ci-preview { position: sticky; top: 0; }
  .ci-pv-stage { height: 64vh; }
}
@media (max-width: 1023px) {
  /* Stacked on smaller screens: the form comes first, preview is a check at the end. */
  .ci-pv-stage { height: 44vh; }
  .ci-pv-stage iframe { zoom: 0.42; }
}

/* ── Contract preview controls + review loop ─────────────────
   The preview opens at 70% because the old 52% was unreadable; ± and
   full-screen let the reader judge a long contract properly. */
.ci-pv-head { align-items: center; }
.ci-pv-tools { display: inline-flex; align-items: center; gap: 4px; }
.ci-pv-btn { min-width: 26px; height: 26px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted); font-size: 0.8rem; font-weight: 800; cursor: pointer; font-family: 'Tajawal', sans-serif; }
.ci-pv-btn:hover { color: var(--text); border-color: var(--sand-border); }
.ci-pv-btn.wide { padding: 0 10px; font-size: 0.72rem; font-weight: 700; }
.ci-pv-zoom { font-size: 0.72rem; color: var(--text-muted); min-width: 34px; text-align: center; }
.ci-preview .ci-pv-hint { margin-top: 6px; display: block; }

/* Full-screen preview: the document takes the whole modal, form steps aside. */
#contract-modal .modal.pv-full { max-width: 98vw; }
.modal.pv-full .ci-grid { grid-template-columns: minmax(0, 1fr); }
.modal.pv-full .ci-form { display: none; }
.modal.pv-full .ci-pv-stage { height: 82vh; }

.c-issued-tags { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.ct-badge.reviewed { color: var(--sand); background: var(--sand-subtle); border: 1px solid var(--sand-border); }
.ct-badge.generated { color: var(--text-muted); background: var(--bg-hover); border: 1px solid var(--border); }
.ci-review-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ci-reviewed-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 8px 12px; border-radius: 8px; background: var(--sand-subtle); border: 1px solid var(--sand-border); font-size: 0.8rem; }

/* Contract state on a reservation card — the same contract, visible from both
   sides of the workflow. */
/* `align-self` is load-bearing: .req-card is a flex COLUMN, so an inline-flex
   child is still stretched to the full card width by the default
   `align-items: stretch` — the chip rendered as a 306px grey bar that read as a
   broken button rather than a pill. Pre-existing; found while reworking the
   queue layout. */
.req-contract-chip { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 700; border-radius: var(--radius-pill); padding: 2px 10px; cursor: pointer; border: 1px solid var(--navy-border); background: var(--navy-subtle); color: var(--navy); }
.req-contract-chip.signed { border-color: var(--open-border); background: var(--open-bg); color: var(--open-color); }
.req-contract-chip.none { border-color: var(--sand-border); background: var(--sand-subtle); color: var(--sand); }
.req-contract-chip.voided { border-color: var(--sold-border); background: var(--sold-bg); color: var(--sold-color); }
.req-contract-chip.static { cursor: default; }
.req-contract-chip:hover { filter: brightness(1.12); }

/* ── Contract wording-edit steps ─────────────────────────────
   Numbered so the order is obvious: download, edit, upload. */
.ci-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ci-step { display: flex; align-items: flex-start; gap: 10px; }
.ci-step-n { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; background: var(--navy-subtle); border: 1px solid var(--navy-border); color: var(--navy); margin-top: 6px; }
.ci-step-body { min-width: 0; }
.ci-step-body .btn { display: inline-flex; align-items: center; gap: 7px; }
.ci-step-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }
.ci-which { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-hover); font-size: 0.82rem; }
.ci-which > div { flex: 1; min-width: 0; }
.ci-which.is-reviewed { border-color: var(--sand-border); background: var(--sand-subtle); }
.ci-which.is-voided { border-color: var(--sold-border); background: var(--sold-bg); color: var(--sold-color); }
.ci-which.is-voided .ico-host { color: var(--sold-color); }
.ci-signing { display: grid; gap: 8px; margin-bottom: 4px; }
.ci-signopt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-hover); font-size: 0.85rem; cursor: pointer; }
.ci-signopt > div { flex: 1; min-width: 0; }
.ci-signopt input { margin-top: 3px; }
.ci-signopt:has(input:checked) { border-color: var(--sand-border); background: var(--sand-subtle); }
.ct-badge.paper { color: var(--sand-text, var(--text-muted)); background: var(--sand-subtle); border: 1px solid var(--sand-border); }


/* ── Mobile bottom tab bar ──────────────────────────────────────────────
   Desktop keeps the rail; this only ever exists below the same 860px
   breakpoint the drawer uses. */
.nav-bottom { display: none; }
@media (max-width: 860px) {
  .nav-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
    background: var(--bg-card); border-top: 1px solid var(--border);
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 26px -14px rgba(0,0,0,0.55);
    /* This IS a <nav>, so the base `nav` rule applies to it too. Those four
       resets are load-bearing: `top: 0` from that rule beats `bottom: 0` on a
       fixed box (top wins when both are set and height is auto), which pinned
       the bar to the TOP of the screen. height/border-bottom/justify-content
       come from the same place. */
    top: auto; height: auto; border-bottom: none; justify-content: stretch;
  }
  .nav-bottom .nb-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    padding: 7px 2px; border: none; background: none; cursor: pointer;
    color: var(--text-muted); text-decoration: none; border-radius: 10px;
    font-family: 'Tajawal', sans-serif; font-size: 0.67rem; font-weight: 700;
    position: relative; transition: color 0.18s ease, background 0.18s ease;
  }
  .nav-bottom .nb-item.active { color: var(--navy); background: var(--navy-subtle); }
  body.dark .nav-bottom .nb-item.active { color: #fff; background: rgba(255,255,255,0.09); }
  .nav-bottom .nb-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-bottom .nav-count { position: absolute; top: 1px; inset-inline-end: 14px; }
  /* More than five tabs (/it/ for مسؤول النظام has eight): the bar scrolls sideways and every label is shown whole. */
  .nav-bottom.many { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .nav-bottom.many::-webkit-scrollbar { display: none; }
  .nav-bottom.many .nb-item { flex: 0 0 auto; min-width: 72px; padding-inline: 8px; }
  .nav-bottom.many .nb-label { overflow: visible; text-overflow: clip; }
  /* keep page content and the toast clear of the bar */
  body.has-bottom-nav { padding-bottom: 66px; }
  body.has-bottom-nav .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}


/* ═══ النسخ الاحتياطي (in-app database export) ═══ */
.it-bk-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; max-width: 720px; }
.it-bk-lead { font-size: 0.88rem; line-height: 1.7; margin-bottom: 10px; }
.it-bk-note { font-size: 0.8rem; line-height: 1.7; color: var(--text-muted); margin-bottom: 14px; }
.it-bk-check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.83rem; margin-bottom: 14px; cursor: pointer; }
.it-bk-check input { margin-top: 3px; flex: none; }
.it-bk-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.it-bk-log { margin-top: 14px; max-height: 260px; overflow-y: auto; font-size: 0.78rem; line-height: 1.9;
             font-family: ui-monospace, monospace; direction: ltr; text-align: right;
             background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 10px; }
.it-bk-log:empty { display: none; }
.it-bk-good { color: var(--open-color); font-weight: 700; }
.it-bk-bad  { color: var(--sold-color); font-weight: 700; }

/* A frozen account: kept in the list, visibly unable to sign in. Deliberately
   reads as a state, not an error — the account is intact and one click from
   working again. */
.ts-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--radius-pill); margin-inline-start: 6px;
  background: var(--open-bg); border: 1px solid var(--open-border);
  color: var(--open-color); font-size: 0.66rem; font-weight: 800; vertical-align: middle;
}
.frozen-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--radius-pill); margin-inline-start: 6px;
  background: var(--sold-bg); border: 1px solid var(--sold-border);
  color: var(--sold-color); font-size: 0.66rem; font-weight: 800; vertical-align: middle;
}

/* Salesforce says this person is gone, but nobody has frozen them yet. Amber,
   not red: it is a prompt to decide, not a state the account is already in --
   the freeze button sits right beside it. Hidden once actually frozen, since
   .frozen-badge then says the stronger thing. */
.left-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--radius-pill); margin-inline-start: 6px;
  background: var(--reserved-bg); border: 1px solid var(--reserved-border);
  color: var(--reserved-color); font-size: 0.66rem; font-weight: 800; vertical-align: middle;
}


/* Voiding is destructive-ish but reversible in spirit (the record survives), so it
   reads as a quiet secondary, never as the dominant action. */
.btn-void { color: var(--sold-color); border-color: var(--sold-border); }
.btn-void:hover { background: var(--sold-bg); border-color: var(--sold-color); }

/* "These companies would print a blank الطرف الأول" — shown on the عقود queue,
   where contracts are actually issued, not hidden inside الجهات الموقّعة. */
.ct-warn {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin: 0 0 12px; border-radius: var(--radius-sm);
  background: var(--reserved-bg); border: 1px solid var(--reserved-border);
  color: var(--text);
}
.ct-warn > .ico-host { color: var(--sand); margin-top: 2px; }
.ct-warn > div { flex: 1; min-width: 0; }
.ct-warn strong { font-size: 0.9rem; }
.ct-warn-sub { color: var(--text-muted); font-size: 0.8rem; line-height: 1.7; margin-top: 2px; }
@media (max-width: 600px) { .ct-warn { flex-wrap: wrap; } .ct-warn .btn { width: 100%; } }

/* ── Icon marks that replaced decorative emoji (2026-09-14) ──────── */
/* A modal that opens with a 2rem emoji reads as a toy. These give the same vertical anchor with the app's own stroke icons. */
.modal-mark { display: flex; justify-content: center; margin-bottom: 10px; color: var(--navy); }
.modal-mark .ico { width: 26px; height: 26px; }
.c-empty-mark { display: flex; justify-content: center; margin-bottom: 18px; color: var(--text-muted); opacity: 0.7; }

/* Long system names («مركز خدمات وأصول تقنية المعلومات») pushed the hamburger 14px
   off the left edge of a phone. The brand may shrink here — and only here; at
   tablet widths it must not (it squeezed the name into stacked words). */
@media (max-width: 480px) {
  .nav-brand { flex-shrink: 1; min-width: 0; }
  .nav-brand-main { font-size: 0.82rem; }
}

/* -- Reservation cards: breathing room (2026-09-30) ------------------------
   The stacked status lines under a card (stage, finance signatures, deadline,
   next step, returned/notes) sat 6-7px apart with tight line heights, so their
   borders and text visibly touched. Only vertical spacing and line-height are
   raised here, by a few px; no colour, size or layout changes. Kept as ONE block
   at the end so the whole pass can be tuned or removed in one place. */
.req-cards { gap: 16px; }
.req-card { padding: 18px; }
.rq-top { gap: 12px; }
.rq-meta, .rq-sub { line-height: 1.7; }
.rq-who { margin-top: 14px; }
.rq-files { margin-top: 14px; gap: 8px; }
.rq-note { margin-top: 13px; line-height: 1.7; }
.req-path { margin: 16px 0 4px; }
.rq-stage { margin-top: 11px; line-height: 1.6; }
.rq-fin { gap: 8px; margin-top: 10px; }
.rq-sig { padding: 3px 10px; }
.rq-fin.rejected { margin-top: 10px; line-height: 1.7; padding: 8px 11px; }
.rq-clock { margin-top: 10px; line-height: 1.7; }
.rq-next { margin-top: 11px; gap: 8px; line-height: 1.7; }
.rq-returned { margin-top: 10px; padding: 8px 11px; line-height: 1.7; }
.rq-actions { padding-top: 16px; gap: 10px; }

/* -- Arabic descenders clipped in filter boxes (2026-09-30) ----------------
   ع and و (and ي، ق، ج) drop well below the baseline in Tajawal. The filter
   selects, chips and search box set a font-size but NO line-height, so the
   browser used `normal`, which is shorter than the glyphs need, and a form
   control clips whatever overflows its inner box. Fix: an explicit line-height
   plus a little vertical padding, with the min-heights kept so nothing gets
   taller than before at rest. */
.form-input, .form-select,
.filter-select, .search-box input { line-height: 1.7; }
.filter-select { padding-top: 9px; padding-bottom: 9px; min-height: 42px; }
.search-box input { padding-top: 9px; padding-bottom: 9px; min-height: 42px; }
.filter-chip { line-height: 1.7; padding-top: 6px; padding-bottom: 6px; }

/* -- «تنتهي اليوم» + المالية decides the دفعة كاملة (management, 2026-10-07) ----
   The deadline line turns red on the day the ٥ مساءً sweep will actually cancel
   it; managers get one banner with the count and a chip to list them. The
   manager's cell on a دفعة كاملة is marked optional (dashed) until signed. */
.rq-clock.urgent { color: var(--sold-color); }
.rq-sig.opt { border-style: dashed; color: var(--text-dim); font-weight: 600; }
.filter-chip.expiring:not(.active) { color: var(--sold-color); }
.req-expiring-banner { display: flex; align-items: center; gap: 8px; width: 100%; margin: 4px 0 14px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--sold-border); background: var(--sold-bg);
  color: var(--sold-color); font-family: 'Tajawal', sans-serif; font-size: 0.85rem; font-weight: 700;
  line-height: 1.6; text-align: start; cursor: pointer; }
.req-expiring-banner:hover { filter: brightness(1.04); }
.req-expiring-go { margin-inline-start: auto; text-decoration: underline; white-space: nowrap; }

/* -- دفعة كاملة «على دفعات» (management, 2026-10-07) ------------------------
   One compact block on the card and in the detail sheet: the مشرف's decision,
   a progress bar of what المالية confirmed against the unit price, then one line
   per part with its own verdict. The parts' receipts stay in the card's file
   chips (one per part) rather than repeating here. */
.rq-parts { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated); }
.rq-parts-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rq-parts-title { font-size: 0.78rem; font-weight: 800; color: var(--text); }
.rq-parts-bar { height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; }
.rq-parts-bar span { display: block; height: 100%; background: var(--open-color); }
.rq-parts-sum { margin: 6px 0 4px; font-size: 0.74rem; font-weight: 700; color: var(--text-muted); line-height: 1.7; }
.rq-part { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--border);
  font-size: 0.74rem; line-height: 1.7; }
.rq-part-n { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-subtle); color: var(--text); font-size: 0.68rem; font-weight: 800; }
.rq-part-amt { font-weight: 800; direction: ltr; unicode-bidi: isolate; }
.rq-part-kind { color: var(--text-muted); }
.rq-part-st { margin-inline-start: auto; font-weight: 700; }
.rq-part-st.ok { color: var(--open-color); }
.rq-part-st.bad { color: var(--sold-color); }
.rq-part-st.wait { color: var(--text-dim); }
.rq-sig.bad { border-color: var(--sold-border); background: var(--sold-bg); color: var(--sold-color); }
.rq-part-sum { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elevated);
  font-size: 0.82rem; line-height: 1.9; }
.rq-part-note { margin: 0 0 10px; font-size: 0.8rem; font-weight: 700; color: var(--open-color); line-height: 1.7; }
.rq-part-final { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.82rem; font-weight: 700; cursor: pointer; }

/* ── Site dropdown (.bsh-dd) — 2026-10-07 ─────────────────────────────────
   The site's own list in place of a <select>'s native popup (ddOpen() in
   supabase.js). The native one was drawn with a band over its right edge on
   F's machine, hiding where Arabic starts. A direct <body> child: z-index sits
   above modals (200) and the danger confirm (400), below the lightbox (500)
   and the toast (999). It must stay in the dark-mode exclusion list above, or
   it stops being fixed. */
.bsh-dd {
  position: fixed; z-index: 450;
  box-sizing: border-box; max-width: calc(100vw - 16px);
  padding: 4px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  font-family: inherit; font-size: 0.9rem; text-align: right; direction: rtl;
}
.bsh-dd-opt {
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  white-space: nowrap; line-height: 1.7;
}
.bsh-dd-opt.active   { background: var(--bg-elevated); }
.bsh-dd-opt.selected { font-weight: 700; color: var(--sand); }
.bsh-dd-opt.disabled { opacity: 0.45; cursor: default; }
.bsh-dd-group { padding: 8px 14px 2px; font-size: 0.75rem; color: var(--text-muted); }

/* ── المرفقات by sender, in the detail sheet only (2026-10-15) ─────────────── */
.req-attach-group + .req-attach-group { margin-top: 16px; }
.req-attach-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 9px;
                  padding-inline-start: 9px; border-inline-start: 3px solid var(--border-strong); }
.req-attach-who b { font-size: 0.84rem; font-weight: 800; color: var(--text); }
.req-attach-who span { font-size: 0.72rem; color: var(--text-muted); }
.req-attach-group.seller .req-attach-who  { border-color: var(--navy); }
.req-attach-group.finance .req-attach-who { border-color: var(--open-color); }
/* المالية's dialog: several receipts */
.req-fin-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.req-fin-list:empty { display: none; }
.req-fin-item { display: flex; align-items: center; gap: 7px; padding: 6px 10px; font-size: 0.78rem;
                background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xs); }
.req-fin-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-fin-item button:not(.fp-view) { border: 0; background: transparent; color: var(--sold-color); cursor: pointer;
                       font-size: 0.9rem; min-width: 32px; min-height: 32px; font-family: inherit; }
.req-fin-hint { margin-top: 6px; font-size: 0.72rem; color: var(--text-muted); }

/* ── File preview (filePreview() in supabase.js): open a picked file before it is uploaded ── */
.fp-overlay { z-index: 600; }
.fp-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-modal);
          width: min(920px, 100%); max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; }
.fp-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.fp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; font-weight: 700; color: var(--text); }
.fp-name .ico { vertical-align: -2px; }
.fp-open { font-size: 0.78rem; font-weight: 700; color: var(--navy-light); white-space: nowrap; }
.fp-x { border: 0; background: var(--bg-elevated); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: 0 0 auto; font-size: 0.95rem; }
.fp-body { flex: 1; overflow: auto; padding: 12px; background: var(--bg-elevated); display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 220px; }
.fp-body img, .fp-body canvas { max-width: 100%; height: auto; display: block; border-radius: var(--radius-xs); box-shadow: 0 1px 6px rgba(0,0,0,0.18); background: #fff; }
.fp-body iframe { width: 100%; height: 75vh; height: 75dvh; border: 0; background: #fff; border-radius: var(--radius-xs); }
.fp-msg { font-size: 0.82rem; color: var(--text-muted); text-align: center; margin: 24px 0; }
.fp-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.fp-foot .btn { flex: 1 1 160px; }
.fp-note { flex: 1 1 100%; margin: 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }
/* What the system found in the file, before anyone approves it (contracts, 2026-11-09). */
.fp-checks { flex: 1 1 100%; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.8rem; font-weight: 600; }
.fp-checks .ok { color: var(--open-color); }
.fp-checks .bad { color: var(--sold-color); }
.fp-checks .info { color: var(--text-muted); font-weight: 500; }
/* A paper-signing button takes a dropped PDF too. */
.c-drop-on { outline: 2px dashed var(--gold, #c9a227); outline-offset: 3px; }
.fp-view { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 3px 10px; border: 1px solid var(--border-strong);
           border-radius: 20px; background: var(--bg-card); color: var(--navy-light); font: inherit; font-size: 0.74rem; font-weight: 700;
           cursor: pointer; white-space: nowrap; vertical-align: middle; }
.fp-view:hover { border-color: var(--navy-light); }

/* ── التقارير 2026-10-22: filter panel, tabs, sortable/paged tables (reports.js) ── */
.rep-filters { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); margin-bottom: 1rem; }
.rep-filters-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; user-select: none; }
.rep-filters-head::-webkit-details-marker { display: none; }
.rep-filters-title { display: inline-flex; align-items: center; gap: 8px; font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 0.92rem; color: var(--text); }
.rep-filters-title .ico { color: var(--navy); }
.rep-filter-count { font-family: 'Tajawal', sans-serif; font-size: 0.72rem; font-weight: 700; color: var(--navy); background: var(--navy-subtle); border: 1px solid var(--navy-border); border-radius: var(--radius-pill); padding: 1px 9px; }
.rep-filter-count:empty { display: none; }
.rep-filters-toggle { font-size: 0.74rem; color: var(--text-muted); font-weight: 700; }
.rep-filters-body { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.rep-period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.rep-presets { flex-wrap: wrap; }
.rep-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; }
.rep-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rep-field > span { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); }
.rep-field .filter-select { min-width: 0; width: 100%; }
.rep-field-search { grid-column: span 2; }
.rep-field-search .search-group { min-width: 0; }
.rep-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.76rem; }
.rep-active:empty { display: none; }
.rep-fchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 11px; border-radius: var(--radius-pill); background: var(--navy-subtle); color: var(--text-muted); border: 1px solid var(--navy-border); font-weight: 600; max-width: 100%; }
.rep-fchip b { color: var(--text); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-fchip button { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.rep-fchip button:hover { color: var(--sold-color); }
.rep-clear-all { border: none; background: none; color: var(--sold-color); font-weight: 800; cursor: pointer; font-family: 'Tajawal', sans-serif; font-size: 0.76rem; padding: 3px 6px; }
.rep-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 1.25rem; }
.rep-tabs .filter-chip .ico { color: inherit; }
.rep-section-head { flex-wrap: wrap; }
.rep-section-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rep-sec-note { font-size: 0.76rem; color: var(--text-muted); line-height: 1.6; margin: -4px 0 12px; }
.rep-table th.sortable { cursor: pointer; user-select: none; }
.rep-table th.sortable:hover { color: var(--text); }
.rep-table th .rep-sort { display: inline-block; margin-right: 4px; opacity: 0.3; font-size: 0.7rem; }
.rep-table th.sorted { color: var(--navy); }
.rep-table th.sorted .rep-sort { opacity: 1; }
.rep-table tbody tr.rep-link { cursor: pointer; }
.rep-table tbody tr.rep-link:hover td:first-child { box-shadow: inset -3px 0 0 var(--navy); }
.rep-table td.ltr { direction: ltr; unicode-bidi: isolate; text-align: right; }
.rep-pill.navy { background: var(--navy-subtle); color: var(--navy); border: 1px solid var(--navy-border); }
.rep-pill.muted { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.rep-tag { display: inline-block; margin-right: 4px; padding: 0 7px; border-radius: var(--radius-pill); font-size: 0.66rem; font-weight: 800; color: var(--sand); border: 1px solid color-mix(in srgb, var(--sand) 45%, transparent); background: color-mix(in srgb, var(--sand) 12%, transparent); vertical-align: middle; }
.rep-pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--text-muted); }
.rep-pager-btns { display: inline-flex; align-items: center; gap: 10px; }
.rep-pager-btns b { color: var(--text); font-variant-numeric: tabular-nums; }
.rep-pager button { padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.76rem; font-weight: 700; cursor: pointer; }
.rep-pager button:disabled { opacity: 0.4; cursor: default; }
.rep-busy { opacity: 0.7; pointer-events: none; }
.rep-busy .ico { animation: spin 0.9s linear infinite; }
@media (max-width: 640px) {
  .rep-filters-head { padding: 11px 12px; }
  .rep-filters-body { padding: 10px 12px 12px; }
  .rep-filter-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rep-field-search { grid-column: 1 / -1; }
  .rep-period { flex-direction: column; align-items: stretch; }
  .rep-bar .rep-tabs { width: 100%; }
}
/* 8 KPI cards: a clean 4 × 2 grid instead of 7 + 1 */
.rep-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .rep-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; } }

/* brief flash on a picker that just received a pasted file (supabase.js pasteFilesInto) */
.file-pasted { outline: 2px solid #16a34a; outline-offset: 2px; transition: outline-color 0.3s; }

/* Two-step: the week before it is required (supabase.js twoStepNudge, 2026-11-11) — under the nav on every page. */
.ts-nudge { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 12px auto 0; max-width: 1400px; width: calc(100% - 32px);
  padding: 12px 16px; border: 1px solid var(--reserved-border); border-radius: 12px; background: var(--reserved-bg); color: var(--text); }
.ts-nudge-ic { flex: none; color: var(--reserved-color); display: inline-flex; }
.ts-nudge-t { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.86rem; line-height: 1.7; }
.ts-nudge-t b { font-size: 0.92rem; }
.ts-nudge-left { display: inline-block; align-self: flex-start; padding: 0 10px; border-radius: 20px; background: var(--reserved-color); color: #fff; font-size: 0.76rem; font-weight: 700; }
.ts-nudge-s { color: var(--text-muted); }
.ts-nudge-a { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) { .ts-nudge-a { width: 100%; } .ts-nudge-a > * { flex: 1; min-height: 44px; } }

/* ── تقارير الحجوزات 2026-11-15: grouped filters, company filters, numbered pages (reports.js) ── */
.rep-scope-line { margin-top: 4px; font-size: 0.8rem; font-weight: 700; color: var(--navy); }
.rep-scope-line:empty { display: none; }
.rep-scope-note { display: flex; align-items: center; gap: 8px; margin: 0 0 0.8rem; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--navy-subtle); border: 1px solid var(--navy-border); color: var(--text); font-size: 0.82rem; }
.rep-scope-note .ico { color: var(--navy); flex: none; }
.rep-fg { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rep-fg-period { padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.rep-fgh { font-size: 0.72rem; font-weight: 800; color: var(--text-dim); }
.rep-period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.rep-period .rep-presets { flex: 1 1 480px; }
.rep-fgroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 14px 22px; }
.rep-fgroups .rep-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rep-field.on .filter-select { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.rep-field.on > span { color: var(--navy); }
.rep-field-search { max-width: 560px; }
.rep-pager.pager { flex-direction: column; justify-content: center; align-items: center; gap: 8px; }

/* ── Company switcher (company split 4b) — only rendered when the split is on and the person has several companies ── */
.co-switch-btn { width: auto; max-width: 190px; padding: 0 10px; gap: 6px; font: inherit; font-size: 0.8rem; font-weight: 700; }
.co-switch-btn.on { color: var(--text); border-color: var(--sand-border); }
.co-switch-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-switch-item { width: 100%; border: 0; background: none; font: inherit; text-align: right; cursor: pointer; align-items: center; }
.co-switch-item:focus-visible { outline: 2px solid var(--sand); outline-offset: -2px; }
@media (max-width: 900px) {
  .co-switch-btn { width: 38px; padding: 0; position: relative; }
  .co-switch-label { display: none; }
  .co-switch-btn.on[data-letter]:not([data-letter=""])::after {
    content: attr(data-letter); position: absolute; top: -6px; left: -6px; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 9px; background: var(--sand); color: #10151f; font-size: 0.68rem; font-weight: 800; line-height: 18px;
    text-align: center; box-shadow: 0 0 0 2px var(--bg);
  }
}

/* ── Reservation age colour (2026-11-17): green < 24h, orange 24–48h, red ≥ 48h since filed ──
   The card's RIGHT edge is its status colour, so age takes the LEFT edge + a chip. */
.req-card.age-g { border-left: 4px solid var(--open-color); }
.req-card.age-o { border-left: 4px solid var(--reserved-color); }
.req-card.age-r { border-left: 4px solid var(--sold-color); }
.rq-agechip { display: inline-flex; align-items: center; gap: 5px; margin-inline-end: 8px; padding: 1px 8px 1px 9px;
  border-radius: 999px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; border: 1px solid; vertical-align: 1px; }
.rq-agechip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rq-agechip.age-g, .req-age-chip.age-g { color: var(--open-color);     background: var(--open-bg);     border-color: var(--open-border); }
.rq-agechip.age-o, .req-age-chip.age-o { color: var(--reserved-color); background: var(--reserved-bg); border-color: var(--reserved-border); }
.rq-agechip.age-r, .req-age-chip.age-r { color: var(--sold-color);     background: var(--sold-bg);     border-color: var(--sold-border); }
.req-age-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; }
.req-age-lbl { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); margin-inline-end: 2px; }
.req-age-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; border: 1px solid;
  font: inherit; font-size: 0.74rem; font-weight: 700; cursor: pointer; opacity: 0.78; transition: opacity 0.15s, box-shadow 0.15s; }
.req-age-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.req-age-chip .cnt { font-variant-numeric: tabular-nums; opacity: 0.85; }
.req-age-chip:hover { opacity: 1; }
.req-age-chip.active { opacity: 1; box-shadow: 0 0 0 2px currentColor; }

/* ── التقارير 2026-11-17: ranking bars, age summary, day/month toggle ── */
.rep-rank .rep-bar-label { display: flex; align-items: center; gap: 7px; }
.rep-rank-n { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800; background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.rep-rank .rep-bar-row:nth-child(1) .rep-rank-n { background: var(--sand); color: #1a1a1a; border-color: var(--sand); }
.rep-age-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rep-age-card { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; font-size: 0.85rem; font-weight: 700; }
.rep-age-card b { font-size: 1.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.rep-age-card .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.rep-age-card.open { color: var(--open-color); background: var(--open-bg); border-color: var(--open-border); }
.rep-age-card.reserved { color: var(--reserved-color); background: var(--reserved-bg); border-color: var(--reserved-border); }
.rep-age-card.sold { color: var(--sold-color); background: var(--sold-bg); border-color: var(--sold-border); }
.rep-grain { display: inline-flex; gap: 4px; margin-inline-end: 6px; }
.rep-export-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.rep-grid2 > [id^="rep-sec-"] { min-width: 0; }
@media (max-width: 640px) {
  .rep-age-cards { grid-template-columns: 1fr; gap: 8px; }
  .rep-age-card { padding: 10px 14px; }
}

/* تاريخ الصك (2026-11-17): what the contract prints, under the هجري | ميلادي pair */
.name-hint.deed-print { margin: -4px 0 12px; font-weight: 600; color: var(--text-muted); }
.name-hint.deed-print.bad { color: var(--sold-color); }

/* ── التقارير: pick a report (2026-11-17) ── */
.rep-cat { display: flex; flex-direction: column; gap: 22px; }
.rep-cat-h { font-size: 0.95rem; font-weight: 800; color: var(--text); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.rep-cat-h::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rep-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 4px; align-items: start;
  text-align: start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); font: inherit; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.rep-card:hover { border-color: var(--navy-border, var(--navy)); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.rep-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.rep-card-ic { grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy-subtle, var(--bg-elevated)); color: var(--navy); }
.rep-card-t { font-weight: 800; font-size: 0.92rem; line-height: 1.4; }
.rep-card-d { font-size: 0.8rem; color: var(--text-muted); line-height: 1.6; }
.rep-head { margin-bottom: 14px; }
.rep-back { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 700;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; margin-bottom: 10px; }
.rep-back:hover { border-color: var(--navy); color: var(--navy); }
.rep-head-group { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; color: var(--sand); }
.rep-head-t { font-size: 1.25rem; font-weight: 800; margin: 2px 0 4px; }
.rep-head-d { color: var(--text); margin: 0 0 6px; max-width: 70ch; }
.rep-how { margin: 0; padding-inline-start: 18px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.7; max-width: 80ch; }
@media (max-width: 640px) { .rep-cards { grid-template-columns: 1fr; } .rep-head-t { font-size: 1.1rem; } }
.rep-filters[hidden], .rep-fg[hidden], .rep-field[hidden], .rep-fg-period[hidden] { display: none !important; }

/* «العقد — كيف تمّ؟» (2026-11-18): issue here, or upload a contract signed outside */
.c-start { display: flex; flex-direction: column; gap: 10px; }
.c-start-who { margin: 0 0 4px; color: var(--text-muted); font-size: 0.88rem; }
.c-start-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: start;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card);
  color: inherit; font: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.c-start-opt:hover, .c-start-opt:focus-visible { border-color: var(--navy); background: var(--bg-hover); outline: none; }
.c-start-t { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.98rem; }
.c-start-d { color: var(--text-muted); font-size: 0.82rem; line-height: 1.7; }
.c-out-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; color: var(--text-muted); font-size: 0.82rem; }

/* ── التقارير 2026-11-29: «لوحة المبيعات» + 10 ready reports, the CRM's filter bar ── */
body.rep-home .rep-tabs { display: flex; }
.rep-bar .rep-tabs .cnt { font-size: 0.7rem; }
.rep-filters { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.rep-mainbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.rep-mainbar .rep-fg-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0; border: 0; min-width: 0; }
.rep-mainbar .rep-presets { flex: 0 1 auto; }
.rep-mainbar .req-date-filter { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rep-mainbar .req-date-filter .bsh-date { width: 128px; }
.rep-opco[hidden], .rep-now-chip[hidden], .rep-more[hidden], .rep-more-btn[hidden] { display: none !important; }
.rep-field-project { flex-direction: row; align-items: center; gap: 8px; }
.rep-field-project .filter-select { min-width: 170px; max-width: 260px; }
.rep-more-btn { margin-inline-start: auto; }
.rep-more-btn[aria-expanded="true"] { border-color: var(--navy); color: var(--navy); }
.rep-more-count { font-weight: 800; color: var(--navy); }
.rep-more { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); }
.rep-now-chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); color: var(--text-muted); font-size: 0.78rem; font-weight: 700; }
.rep-co-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; vertical-align: 0; margin-inline-end: 6px; }
.filter-chip .rep-co-dot { margin-inline-end: 0; }

/* «عرض حسب» + the «خلال فترة / الآن» tag */
.rep-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 10px; }
.rep-views > span { font-size: 0.76rem; font-weight: 800; color: var(--text-muted); }
.rep-when { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 800; background: var(--navy-subtle); color: var(--navy); border: 1px solid var(--navy-border); white-space: nowrap; letter-spacing: 0; }
.rep-when.now { background: color-mix(in srgb, var(--open-color) 12%, transparent); color: var(--open-color); border-color: color-mix(in srgb, var(--open-color) 40%, transparent); }
.rep-head-board .rep-head-t { margin-top: 0; }

/* The ready list */
.rep-ready { display: flex; flex-direction: column; gap: 12px; }
.rep-ready-table td { vertical-align: top; white-space: normal; }
.rep-ready-table .rep-ready-cell, .rep-ready-table .rep-ready-cell * { white-space: normal; overflow: visible; text-overflow: clip; }
.rep-ready-t { display: flex; gap: 10px; align-items: flex-start; white-space: normal; }
.rep-ready-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rep-ready-cell b { font-size: 0.92rem; color: var(--text); }
.rep-ready-cell span { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }
.rep-ready-cell .rep-ready-by { font-size: 0.72rem; color: var(--text-dim); }
.rep-ready-go { text-align: left; }
.rep-star { border: 0; background: none; font-size: 1.15rem; line-height: 1; padding: 2px; cursor: pointer; color: var(--text-dim); font-family: inherit; }
.rep-star.on { color: var(--sand); }
.rep-star:hover { color: var(--sand); }
.rep-ready-rules { font-size: 0.78rem; }

/* Board tiles: the label sits above the number (the CRM's tiles) */
.rep-board-tiles .rep-kpi-lbl-top { margin: 0 0 6px; font-weight: 700; }
.rep-board-tiles .rep-kpi-num .rep-dl { font: inherit; color: inherit; }
.rep-board-tiles .rep-kpi-sub { font-size: 0.74rem; color: var(--text-muted); line-height: 1.6; }
.rep-up { color: var(--open-color); font-weight: 800; }
.rep-down { color: var(--sold-color); font-weight: 800; }
/* A number that opens its rows */
.rep-dl { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--navy); cursor: pointer; text-decoration: underline; text-decoration-color: var(--navy-border); text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.rep-dl:hover, .rep-dl:focus-visible { text-decoration-color: var(--navy); }
.rep-share { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.rep-share i { display: block; height: 8px; max-width: 70px; border-radius: 4px; background: var(--navy); min-width: 2px; }
.rep-share span { font-size: 0.74rem; color: var(--text-muted); }

/* 8-week chart */
.rep-wk svg { width: 100%; height: auto; max-height: 300px; display: block; direction: ltr; }
.rep-wk text { fill: var(--text-muted); font-family: 'Tajawal', sans-serif; font-size: 11px; }
.rep-wk .rep-wk-tot { fill: var(--text); font-weight: 800; }
.rep-wk-grid { stroke: var(--border); stroke-width: 1; }
.rep-wk-bar { cursor: pointer; }
.rep-wk-bar:hover rect, .rep-wk-bar:focus rect { opacity: 0.8; }
.rep-wk-bar:focus { outline: none; }
.rep-wk-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.74rem; color: var(--text-muted); margin-top: 6px; }
.rep-wk-legend > span { display: inline-flex; align-items: center; }
.rep-bar-label small { color: var(--text-dim); font-weight: 600; }
.rep-howcount { font-size: 0.78rem; color: var(--text-muted); line-height: 1.7; margin-top: 0.5rem; }
.rep-howcount ul { margin: 4px 0 0; padding-inline-start: 18px; }

@media (max-width: 640px) {
  .rep-filters { padding: 8px; }
  .rep-mainbar { gap: 8px; }
  .rep-mainbar .rep-fg-period, .rep-mainbar .rep-presets, .rep-opco { width: 100%; }
  .rep-mainbar .req-date-filter { width: 100%; }
  .rep-mainbar .req-date-filter .bsh-date { flex: 1 1 0; width: auto; min-width: 0; }
  .rep-field-project { width: 100%; }
  .rep-field-project .filter-select { flex: 1 1 auto; max-width: none; min-width: 0; }
  .rep-more-btn { width: 100%; justify-content: center; margin-inline-start: 0; }
  .rep-more { padding: 10px; }
  .rep-views .filter-chips { width: 100%; }
  .rep-ready-table .rep-ready-set { display: none; }
  .rep-ready-go { display: none; }
  .rep-board-tiles .rep-kpi-num { font-size: 1.4rem; }
  .rep-share { min-width: 80px; }
  .rep-share i { max-width: 40px; }
  .rep-wk text { font-size: 19px; }
  .rep-wk-legend { font-size: 0.7rem; }
}
