  :root {
    --primary: #0a2540;
    --primary-2: #1a3a5c;
    --accent: #00d4aa;
    --accent-2: #635bff;
    --gold: #f4b942;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #3b82f6;
    --page: #e6ecf3;   /* the page behind the white cards: plain blue-grey */
    --bg: #f6f8fb;
    --bg-2: #eef2f7;
    --card: #ffffff;
    --text: #0a2540;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #d3dce7;
    --border-strong: #cbd5e1;
    /* card header bands — the card's meaning (white text on each: 4.5:1 or more) */
    --tone-navy: #0a2540;   /* totals */
    --tone-ok: #1b7f63;     /* done / active */
    --tone-warn: #9a6412;   /* waiting / needs a look */
    --tone-bad: #a33a2c;    /* problem / expired */
    --tone-info: #2f5d8a;   /* information */
    --tone-vio: #5d4e8c;    /* special states */
    --tone-mute: #5f6d7e;   /* unchanged */
    /* the dashboard's command strip and towers (30-9-2026) */
    --dx-mint: #00b894;          /* the identity's mint line */
    --dx-strip-label: #b9c7d8;
    --dx-strip-sub: #8599b2;
    --dx-strip-strong: #dfe7f1;
    --dx-strip-foot: #9fb0c6;
    --dx-strip-date: #c3cfdd;
    --dx-num-warn: #f4b942;
    --dx-num-bad: #fca5a5;
    --dx-win-empty: #d3dce7;
    --dx-row-hover: #eef3f8;
    --dx-proj: #3c4f66;
    --dx-bar-prev: #9fb0c6;
    --dx-bar-bg: #e6ecf3;
    --dx-unit-bg: #eef2f7;
    --sidebar-w: 260px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(10,37,64,0.08);
    --shadow-lg: 0 12px 40px rgba(10,37,64,0.15);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  html, body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    background: var(--page);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-x: clip;   /* "hidden" can still be scrolled by code (a focused box past the edge slid the whole page); "clip" cannot */
  }

  button { font-family: inherit; }

  /* ======= GEAR LOGO (letterhead, sidebar, page loading) ======= */
  /* The two gears turn while something loads or saves (class "spin"); "hover-spin" turns them slowly under the mouse */
  .gear-emb {
    width: 42px; height: 42px; flex: none;
    border-radius: 3px;
    background: #00b894;
    display: flex; align-items: center; justify-content: center;
  }
  .gear-emb svg { width: 34px; height: 34px; overflow: visible; }
  .gear-emb path { fill: #fff; fill-rule: evenodd; transform-box: fill-box; transform-origin: center; }
  .gear-emb .g2 { fill: rgba(255,255,255,0.82); }
  .gear-emb.hover-spin:hover .g1 { animation: gear-cw 3s linear infinite; }
  .gear-emb.hover-spin:hover .g2 { animation: gear-ccw 2s linear infinite; }
  .gear-emb.spin .g1 { animation: gear-cw 1.4s linear infinite; }
  .gear-emb.spin .g2 { animation: gear-ccw 0.95s linear infinite; }
  @keyframes gear-cw { to { transform: rotate(360deg); } }
  @keyframes gear-ccw { to { transform: rotate(-360deg); } }

  /* Page loading: only the gear, turning, until the login screen or the app shows (no text) */
  .app-splash {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #051226 0%, #0a2540 55%, #071b34 100%);
  }
  .app-splash.hide { display: none; }
  .gear-emb.gear-xl { width: 84px; height: 84px; border-radius: 20px; }
  .gear-emb.gear-xl svg { width: 68px; height: 68px; }

  /* ======= LOGIN — Automated Operations (dark technical background, solid surfaces) ======= */
  .login-screen {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column;
    overflow-x: hidden; overflow-y: auto;
    color: #fff;
    background:
      radial-gradient(1000px 620px at 18% 28%, rgba(0,212,170,0.13), transparent 60%),
      radial-gradient(900px 700px at 88% 92%, rgba(15,108,189,0.24), transparent 62%),
      radial-gradient(600px 420px at 80% 12%, rgba(99,91,255,0.12), transparent 60%),
      linear-gradient(160deg, #051226 0%, #0a2540 55%, #071b34 100%);
  }
  .login-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
  .login-grid {
    position: absolute; inset: 0;
    background:
      linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px) 0 0 / 56px 56px,
      linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px) 0 0 / 56px 56px,
      linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px) 0 0 / 14px 14px,
      linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px) 0 0 / 14px 14px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 35%, transparent 85%);
            mask-image: radial-gradient(ellipse at center, #000 35%, transparent 85%);
  }
  .login-gear { position: absolute; }
  .login-gear path { fill: rgba(255,255,255,0.025); stroke: rgba(255,255,255,0.09); stroke-width: 1.2; fill-rule: evenodd; }
  .login-gear.lg2 path, .login-gear.lg3 path { stroke: rgba(0,212,170,0.13); }
  .login-gear.lg1 { width: 560px; height: 560px; bottom: -200px; inset-inline-start: -170px; animation: gear-cw 90s linear infinite; }
  .login-gear.lg2 { width: 340px; height: 340px; bottom: 170px; inset-inline-start: 260px; animation: gear-ccw 60s linear infinite; }
  .login-gear.lg3 { width: 420px; height: 420px; top: -150px; inset-inline-end: -120px; animation: gear-ccw 80s linear infinite; }
  .login-scan {
    position: absolute; top: 34%; inset-inline-start: -40%;
    width: 40%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0,212,170,0.55), transparent);
    animation: login-scan 9s linear infinite;
  }
  .login-scan.s2 { top: 71%; animation-delay: 4.5s; background: linear-gradient(90deg, transparent, rgba(0,153,204,0.5), transparent); }
  @keyframes login-scan { to { inset-inline-start: 140%; } }

  /* Letterhead */
  .login-head {
    position: relative; z-index: 1; flex: none;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    height: 68px; padding: 0 28px;
    background: #061529; border-bottom: 1px solid #17314f;
  }
  .login-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .login-name { font-size: 18px; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap; }
  .login-tools { display: flex; align-items: center; gap: 18px; }
  .login-clock { text-align: end; line-height: 1.35; }
  .login-time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
  .login-date { font-size: 11.5px; color: rgba(255,255,255,0.58); }
  .login-lang {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: inherit; font-size: 13px; font-weight: 500; color: #fff;
    background: #10294a; border: 1px solid #22446b; border-radius: 3px;
    padding: 6px 12px; cursor: pointer; transition: background 0.2s, border-color 0.2s;
  }
  .login-lang:hover { background: #163661; border-color: #00b894; }
  .login-lang svg { width: 16px; height: 16px; }

  /* Card */
  .login-main { position: relative; z-index: 1; flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 36px 20px; }
  .login-card {
    position: relative; width: 440px; max-width: 100%;
    background: #fff; color: #14212f;
    border-radius: 3px; overflow: hidden;
    padding: 40px 44px 26px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.4);
  }
  .login-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: #00b894; }
  /* Checking / loading: dots run along the top of the card */
  .login-progress { position: absolute; top: 4px; left: 0; right: 0; height: 4px; display: none; }
  .login-progress.show { display: block; }
  [dir="rtl"] .login-progress { transform: scaleX(-1); }
  .login-progress i { position: absolute; top: 0; left: -2%; width: 4px; height: 4px; border-radius: 50%; background: #00b894; opacity: 0; animation: login-dot 2.6s infinite ease-in-out; }
  .login-progress i:nth-child(2) { animation-delay: 0.16s; }
  .login-progress i:nth-child(3) { animation-delay: 0.32s; }
  .login-progress i:nth-child(4) { animation-delay: 0.48s; }
  .login-progress i:nth-child(5) { animation-delay: 0.64s; }
  @keyframes login-dot { 0% { left: -2%; opacity: 0; } 8% { opacity: 1; } 35% { left: 44%; } 65% { left: 56%; } 92% { opacity: 1; } 100% { left: 102%; opacity: 0; } }
  .login-title { font-size: 24px; font-weight: 700; line-height: 1.3; color: #0a2540; margin-bottom: 4px; }
  .login-sub { font-size: 14px; color: #5b6b7c; margin-bottom: 18px; }
  .login-error-msg { display: none; color: #c50f1f; font-size: 14px; line-height: 1.55; margin-bottom: 10px; }
  .login-error-msg a { color: inherit; }
  .login-input {
    display: block; width: 100%; height: 40px;
    border: 0; border-bottom: 1.5px solid #c3ccd6; border-radius: 0;
    background: transparent; outline: 0;
    font-family: inherit; font-size: 15px; color: #14212f;
    padding: 6px 0;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .login-input:hover { border-bottom-color: #8795a4; }
  .login-input:focus { border-bottom-color: #00b894; box-shadow: 0 1.5px 0 0 #00b894; }
  .login-input:disabled { color: #8a97a5; }
  .login-input::placeholder { color: #8a97a5; }
  .login-pw { position: relative; margin-top: 14px; }
  .login-pw .login-input { padding-inline-end: 38px; }
  .login-eye {
    position: absolute; top: 6px; inset-inline-end: 0;
    width: 32px; height: 28px; border: 0; border-radius: 3px;
    background: transparent; color: #6b7a89; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .login-eye:hover { background: #eef2f6; color: #0a2540; }
  .login-eye svg { width: 18px; height: 18px; }
  .login-eye .eye-off, .login-eye.on .eye-on { display: none; }
  .login-eye.on .eye-off { display: block; }
  .login-caps { display: none; margin-top: 8px; font-size: 13px; color: #8a5300; }
  .login-caps.show { display: block; }
  .login-links { margin-top: 16px; }
  .login-link { font-family: inherit; font-size: 13.5px; color: #0b6fa8; background: none; border: 0; padding: 0; cursor: pointer; text-align: start; }
  .login-link:hover { text-decoration: underline; }
  .login-help {
    display: none; margin-top: 10px; padding: 8px 12px;
    font-size: 13px; line-height: 1.75; color: #3d4b59;
    background: #f3f6f9; border-inline-start: 3px solid #00b894;
    border-start-end-radius: 3px; border-end-end-radius: 3px;
  }
  .login-help.show { display: block; }
  .login-actions { display: flex; justify-content: flex-end; margin-top: 26px; }
  .login-submit {
    min-width: 132px; height: 38px; padding: 0 16px;
    border: 1px solid #0a2540; border-radius: 3px;
    background: #0a2540; color: #fff;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.15s, transform 0.15s;
  }
  .login-submit:hover:not(:disabled) { background: #12365c; transform: translateY(-1px); }
  .login-submit:disabled { opacity: 0.75; cursor: wait; }
  .login-note { display: flex; align-items: center; gap: 7px; margin-top: 26px; padding-top: 12px; border-top: 1px solid #edf1f4; font-size: 12.5px; color: #5b6b7c; }
  .login-note svg { width: 15px; height: 15px; flex: none; color: #00b894; }

  /* Status bar */
  .login-foot {
    position: relative; z-index: 1; flex: none;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 28px; font-size: 12px; color: rgba(255,255,255,0.62);
    background: #061529; border-top: 1px solid #17314f;
  }
  .login-foot .sec { display: inline-flex; align-items: center; gap: 6px; }
  .login-foot .sec i { width: 7px; height: 7px; border-radius: 50%; background: #00d4aa; }
  .login-foot .links { display: flex; gap: 18px; }

  @media (max-width: 760px) {
    .login-head { height: 60px; padding: 0 14px; }
    .login-clock { display: none; }
    .login-name { font-size: 15.5px; }
    .login-head .gear-emb { width: 36px; height: 36px; }
    .login-head .gear-emb svg { width: 29px; height: 29px; }
    .login-main { align-items: flex-start; padding: 22px 12px; }
    .login-card { padding: 32px 22px 20px; }
    .login-foot { flex-direction: column; gap: 6px; padding: 12px 14px; text-align: center; }
    .login-gear.lg2 { display: none; }
  }

  /* ======= AUTO SIGN-OUT WARNING ======= */
  .idle-warn {
    position: fixed; inset: 0; z-index: 100000;
    display: none; align-items: center; justify-content: center;
    padding: 16px; background: rgba(5,18,38,0.6);
  }
  .idle-warn.show { display: flex; }
  .idle-warn-card {
    width: 380px; max-width: 100%;
    background: #fff; border-radius: 3px; border-top: 4px solid #00b894;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    padding: 26px 26px 22px; text-align: center;
  }
  .idle-warn-card .gear-emb { margin: 0 auto 14px; }
  .idle-warn-title { font-size: 19px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
  .idle-warn-text { font-size: 14px; line-height: 1.7; color: var(--text-muted); }
  .idle-warn-count { margin: 8px 0 18px; font-size: 15px; color: var(--text-muted); }
  .idle-warn-count #idle-warn-count { font-size: 30px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }

  /* ======= BUSY OVERLAY: the page dims (no clicks) and the gear turns in the middle ======= */
  /* Above the app windows, below the toasts, the confirm dialog and the auto sign-out warning */
  .busy-overlay {
    position: fixed; inset: 0; z-index: 950;
    display: none; align-items: center; justify-content: center;
    background: rgba(6,21,41,0.38); cursor: progress;
  }
  .busy-overlay.show { display: flex; flex-direction: column; gap: 16px; }
  /* An import (contracts, finance, platform payments): the gear turns red with "PROCESSING" under it — fixed English in
     both languages, like "CRITICAL STEP" (the import's own look); no numbers (29-9-2026). Screen readers: #busy-sr. */
  .busy-overlay.busy-import .gear-emb { background: var(--tone-bad); }
  .busy-label {
    display: none; direction: ltr; color: #fff;
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: 3px;
    text-shadow: 0 1px 3px rgba(6,21,41,0.75);   /* readable over the light, dimmed page (no box — user's choice) */
  }
  .busy-overlay.busy-import .busy-label { display: block; }
  .busy-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* In-page loading places (activity log, finance) use the turning gear too */
  .inpage-loading { text-align: center; padding: 40px; color: var(--text-muted); }
  .inpage-loading .gear-emb, .inpage-gear .gear-emb { margin: 0 auto 14px; }

  /* Phone: the gear next to the menu button (the sidebar is hidden there) */
  .topbar-gear { display: none; width: 34px; height: 34px; border-radius: 3px; }
  .topbar-gear svg { width: 27px; height: 27px; }
  @media (max-width: 900px) { .topbar-gear { display: flex; } }

  @media (prefers-reduced-motion: reduce) {
    .login-gear, .login-scan, .login-progress i, .gear-emb path { animation: none !important; }
    .login-progress.show i { opacity: 1; }
    .gear-emb.spin { animation: gear-pulse 1.2s ease-in-out infinite; }
  }
  @keyframes gear-pulse { 50% { opacity: 0.55; } }

  .form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--text);
    outline: none;
    transition: all 0.2s;
    background: #fff;
  }
  .form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,170,0.12); }

  /* ===== Custom Confirm Modal ===== */
  .cm-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    padding: 20px;
  }
  .cm-overlay.show { opacity: 1; pointer-events: auto; }
  /* A navy box, sharp corners, no title and no icon: the question, then the buttons at the end of the line */
  .cm-modal {
    background: var(--primary);
    border: 1px solid #1d3a5c;
    border-radius: 3px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4);
    width: 420px;
    max-width: 100%;
    padding: 22px 22px 18px;
    text-align: start;
    transform: scale(0.96) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
  }
  .cm-overlay.show .cm-modal { transform: scale(1) translateY(0); }
  /* the question (never ".cm-message": the cookie-notice filter lists hide that class on every site) */
  .aq-confirm-text {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.7;
    margin-bottom: 20px;
  }
  .aq-confirm-text b, .aq-confirm-text strong { color: #fff; }
  /* the import question (tone 'critical'): the red of the import windows, a white "import" button */
  .cm-modal.cm-critical { background: var(--tone-bad); border-color: #7f2a1f; }
  .cm-modal.cm-critical .aq-confirm-text { color: #fff; }
  .cm-modal.cm-critical .cm-btn-cancel { color: #fff; border-color: rgba(255,255,255,0.6); background: transparent; }
  .cm-modal.cm-critical .cm-btn-cancel:hover { background: rgba(255,255,255,0.12); }
  .cm-modal.cm-critical .cm-btn-confirm { background: #fff; color: var(--tone-bad); border-color: #fff; }
  .cm-modal.cm-critical .cm-btn-confirm:hover { background: #f6e9e7; }
  .cm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  .cm-btn {
    padding: 9px 20px;
    border-radius: 3px;
    border: 1.5px solid #3b5575;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    color: #cbd5e1;
  }
  .cm-btn-cancel:hover { background: #10294a; color: #fff; }
  /* Confirm colour by type: mint for questions and information, red to delete, amber for warnings */
  .cm-btn-confirm { color: #fff; border: none; background: #00b894; transition: filter 0.2s; }   /* no colour fade between types */
  .cm-btn-confirm.cm-question, .cm-btn-confirm.cm-info, .cm-btn-confirm.cm-success { background: #00b894; }
  .cm-btn-confirm.cm-danger { background: #dc2626; }
  .cm-btn-confirm.cm-warning { background: #d97706; }
  .cm-btn-confirm:hover { filter: brightness(1.08); }

  /* ===== Custom Date Picker ===== */
  .date-picker {
    cursor: pointer !important;
    direction: ltr;
    text-align: right;
    font-weight: 600;
    color: var(--primary);
    padding-right: 14px !important;
    padding-left: 14px !important;
  }
  .date-picker:hover {
    border-color: var(--accent);
    background: #f0fdfa;
  }
  .dp-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .dp-overlay.show { opacity: 1; pointer-events: auto; }
  .dp-modal {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4);
    width: 360px;
    max-width: 90vw;
    overflow: hidden;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  }
  .dp-overlay.show .dp-modal { transform: scale(1) translateY(0); }

  .dp-head {
    background: linear-gradient(135deg, #0a2540, #1a3a5c);
    color: #fff;
    padding: 18px 20px;
    text-align: center;
  }
  .dp-head-label { font-size: 12px; color: rgba(255,255,255,0.5); letter-spacing: 1px; margin-bottom: 4px; text-transform: uppercase; }
  .dp-head-date { font-size: 22px; font-weight: 800; }
  .dp-head-day { font-size: 13px; color: #00d4aa; margin-top: 2px; font-weight: 600; }

  .dp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .dp-nav-btn {
    width: 36px; height: 36px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .dp-nav-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: scale(1.05); }
  .dp-nav-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 3px;
    transition: background 0.2s;
  }
  .dp-nav-title:hover { background: var(--bg); }

  .dp-grid { padding: 14px; }
  .dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
  }
  .dp-weekday {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }
  .dp-day {
    aspect-ratio: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .dp-day:hover { background: #d1fae5; color: #065f46; transform: scale(1.05); }
  .dp-day.dp-other { color: var(--text-light); opacity: 0.4; }
  .dp-day.dp-today {
    color: var(--accent);
    font-weight: 800;
  }
  .dp-day.dp-today::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
  }
  .dp-day.dp-selected {
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,212,170,0.35);
  }
  .dp-day.dp-selected.dp-today::after { background: #fff; }

  .dp-actions {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg);
  }
  .dp-action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 3px;
    border: 1.5px solid var(--border);
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
  }
  .dp-action-btn:hover { border-color: var(--accent); color: var(--accent); }
  .dp-action-btn.primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .dp-action-btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

  /* Year/Month picker */
  .dp-yearmonth {
    display: none;
    padding: 14px;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .dp-yearmonth.show { display: grid; }
  .dp-ym-btn {
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text);
  }
  .dp-ym-btn:hover { background: #d1fae5; color: #065f46; border-color: var(--accent); }
  .dp-ym-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }

  .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
  }

  .form-group { margin-bottom: 16px; }

  .login-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 3px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
  }
  .login-error.show { display: block; animation: shake 0.4s; }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
  }

  /* ======= APP LAYOUT ======= */
  .app { display: flex; min-height: 100vh; }

  /* The sidebar sits at the start of the line: right in Arabic, left in English */
  .sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    height: 100vh;
    position: fixed;
    inset-inline-start: 0;
    top: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
  }

  /* The gear, and the name under it on one line (Sora; "Operations" in mint) */
  .brand {
    display: flex; flex-direction: column; align-items: center;
    padding: 24px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .brand-logo { width: 56px; height: 56px; border-radius: 3px; }   /* the gear logo (.gear-emb) */
  .brand-logo svg { width: 44px; height: 44px; }
  .brand-lockup {
    margin-top: 12px;
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif;
    font-size: 16px; font-weight: 600; letter-spacing: 0.2px;
    color: #fff; white-space: nowrap; direction: ltr;
  }
  .brand-sub { color: var(--accent); }

  .nav { padding: 10px 0; flex: 1; min-height: 0; overflow-y: auto; }
  .nav-section {
    color: rgba(255,255,255,0.42);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 14px 22px 6px;
  }

  .nav-item {
    display: flex; align-items: center; gap: 12px;
    margin: 2px 10px;
    padding: 9px 12px;
    border-radius: 3px;
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    font-size: 14px;
    user-select: none;
  }
  .nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
  .nav-item.active { background: rgba(0,212,170,0.15); color: #fff; font-weight: 600; }
  /* Line icons (Tabler Icons, MIT licence — tabler.io/icons), drawn in the text colour */
  .ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  /* the same line icons in the pages (core.js icon()): sized and coloured by where they sit — in the text colour by default */
  svg.ico { vertical-align: -0.2em; }
  .btn .ico, .msf-btn .ico, .contract-tab .ico, .settle-tab .ico, .renewal-mode-btn .ico, .search-icon .ico { width: 16px; height: 16px; }
  .btn-sm .ico { width: 15px; height: 15px; }
  .ico-s { width: 14px; height: 14px; }        /* inside table chips, small notes and labels */
  .ico-m { width: 16px; height: 16px; }
  .ico-h { width: 18px; height: 18px; color: #00b894; }   /* section and card headings: mint */
  .ico-xl { width: 40px; height: 40px; stroke-width: 1.4; color: var(--text-light); }   /* the file boxes */
  .ico-l { width: 28px; height: 28px; }
  .ico-mute { color: var(--text-muted); }
  .ico-ok { color: #1b7f63; }
  .renewal-mode-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .renewal-history-title { display: flex; align-items: center; gap: 6px; }
  .msf-btn { display: inline-flex; align-items: center; gap: 6px; }
  .msf-btn > .ico:first-child { color: var(--text-muted); }
  .ico-chev { width: 14px; height: 14px; color: var(--text-muted); margin-inline-start: auto; }
  .modal-title { display: flex; align-items: center; gap: 8px; }
  .modal-title .ico { width: 19px; height: 19px; color: #00d4aa; }
  .modal-close .ico, .menu-toggle .ico, #lang-switch-btn .ico { width: 18px; height: 18px; }
  .search-icon { display: flex; }
  .nav-icon { display: flex; color: rgba(255,255,255,0.55); transition: color 0.18s; }
  .nav-item:hover .nav-icon { color: rgba(255,255,255,0.85); }
  .nav-item.active .nav-icon { color: var(--accent); }
  /* Counts: quiet tints (contracts red, deposits gold, projects blue, users violet) */
  .nav-badge {
    margin-inline-start: auto;
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
  }
  .nav-badge.gold { background: rgba(244,185,66,0.2); color: #fcd34d; }
  .nav-badge.blue { background: rgba(59,130,246,0.22); color: #93c5fd; }
  .nav-badge.violet { background: rgba(124,114,255,0.25); color: #c4b5fd; }

  /* The signed-in employee: green dot + name + sign-out */
  .user-card {
    margin: 12px 10px 14px;
    padding: 10px;
    padding-inline-start: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .user-dot {
    width: 9px; height: 9px; flex: none;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.22);
  }
  .user-name { flex: 1; min-width: 0; color: #fff; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logout-btn {
    background: rgba(255,255,255,0.06);
    border: none;
    color: rgba(255,255,255,0.7);
    width: 32px; height: 32px; flex: none;
    border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  .logout-btn .ico { width: 18px; height: 18px; }
  .logout-btn:hover { background: rgba(239,68,68,0.2); color: #fca5a5; }
  /* The initial-letter square in the users table: solid navy, like the dashboard lists and the project codes */
  .user-avatar {
    width: 38px; height: 38px;
    border-radius: 3px;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
  }

  /* ======= MAIN ======= */
  .main {
    margin-inline-start: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
  }

  /* The top bar is navy, joined to the sidebar, with a mint line under it */
  .topbar {
    background: var(--primary);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #00b894;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
  }

  .menu-toggle {
    display: none;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 38px; height: 38px;
    border-radius: 3px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
  }

  .topbar-title { font-size: 19px; font-weight: 700; color: #fff; }
  .topbar-sub { font-size: 12.5px; color: #9fb0c6; margin-top: 2px; }
  .topbar-actions { display: flex; align-items: center; gap: 10px; }
  /* buttons on the navy bar */
  .topbar .btn-outline { border-color: rgba(255,255,255,0.28); color: #fff; }
  .topbar .btn-outline:hover:not(:disabled) { border-color: #00d4aa; color: #00d4aa; }
  .topbar .btn-primary { background: #00b894; }
  .topbar .btn-primary:hover:not(:disabled) { background: #00a383; }
  .topbar .btn-ghost { color: #cbd5e1; }

  /* ======= BUTTONS ======= */
  .btn {
    padding: 9px 18px;
    border-radius: 3px;
    border: none;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .btn-primary { background: var(--primary); color: #fff; }
  .btn-primary:hover:not(:disabled) { background: var(--primary-2); transform: translateY(-1px); box-shadow: var(--shadow); }
  .btn-success { background: var(--success); color: #fff; }
  .btn-success:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }
  .btn-outline { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text); }
  .btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
  .btn-danger { background: var(--tone-bad); color: #fff; }   /* the cards' red, not the bright alarm red */
  /* Importing changes the system's data: one amber look, icon only (the name is the tooltip), used for the contracts,
     finance and platform payments imports — the page buttons (.btn-import) and the contracts file area (.import-zone) */
  .btn.btn-import {
    width: 40px; height: 40px; padding: 0; justify-content: center;
    background: var(--tone-warn); color: #fff; border: 1px solid var(--tone-warn);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18);
  }
  .btn.btn-import:hover { background: #7f520e; border-color: #7f520e; }
  .btn.btn-import .ico { width: 20px; height: 20px; }
  /* The contracts file area: solid red (a critical step), the file sign at the bottom in a white frame with a small
     warning mark, and "CRITICAL STEP" — always English, in the logo's font (Sora). The whole area is the button. */
  .import-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 12px;
    min-height: 200px; padding: 24px 24px 20px;
    background: var(--tone-bad); border: none;
    border-radius: 3px; cursor: pointer;
    transition: background 0.15s;
  }
  .import-zone:hover, .import-zone:focus-visible, .import-zone.drag-over { background: #8f3024; outline: none; }
  /* the red fills the whole window body: no white frame (the body's 22px padding) around it */
  .import-fill { margin: -22px; }
  /* the file-picking window is small (29-9-2026, the user's pick "ج": 360 wide, the red area 116 high, the sign 46): the
     finance and payments windows always; the contracts window while picking the file (its preview is the usual width) */
  .modal.import-modal.import-pick { width: 360px; }
  .import-fill .import-zone { border-radius: 0; min-height: 116px; justify-content: center; gap: 8px; padding: 16px 24px 14px; }
  .import-fill .import-zone-btn { width: 46px; height: 46px; }
  .import-fill .import-zone-btn > .ico { width: 22px; height: 22px; }
  .import-fill .import-zone-warn { width: 16px; height: 16px; bottom: 4px; }
  /* the contracts import result, the same size (29-9-2026): a solid area in the result's colour — green all saved,
     amber some not saved — and the window's top line and C mark take that colour until the next import */
  .import-result-zone {
    min-height: 116px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 20px; background: var(--tone-ok); color: #fff; text-align: center; cursor: pointer; transition: background 0.15s;
  }
  .import-result-zone:hover, .import-result-zone:focus-visible { background: #166a52; outline: none; }
  .import-result-mark {
    width: 38px; height: 38px; border: 2px solid rgba(255,255,255,0.85); border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
  }
  .import-result-mark .ico { width: 22px; height: 22px; stroke-width: 2; }
  .import-result-line { font-size: 13px; font-weight: 600; line-height: 1.5; }
  .import-result-label { direction: ltr; font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 3px; user-select: none; }
  .import-done-warn .import-result-zone { background: var(--tone-warn); }
  .import-done-warn .import-result-zone:hover, .import-done-warn .import-result-zone:focus-visible { background: #7f520e; }
  .import-modal.import-done-ok .modal-header { border-bottom-color: var(--tone-ok); }
  .import-modal.import-done-ok .import-mark { color: var(--tone-ok); }
  .import-modal.import-done-warn .modal-header { border-bottom-color: var(--tone-warn); }
  .import-modal.import-done-warn .import-mark { color: var(--tone-warn); }
  /* the import windows' top bar: white with a red line, only the warning sign + its letter (C/F/P) in the middle,
     the letter small at the sign's lower right edge; the close button at the end of the bar */
  .modal.import-modal { background: var(--card); }   /* white header: no navy behind it */
  .import-modal .modal-header {
    position: relative; justify-content: center; min-height: 42px; padding-top: 0; padding-bottom: 0;
    background: #fff; border-bottom: 3px solid var(--tone-bad);
  }
  .import-modal .modal-close { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); background: transparent; color: #5f6d7e; }
  .import-modal .modal-close:hover { background: #f1f4f8; color: var(--tone-bad); }
  .import-mark { position: relative; display: inline-flex; color: var(--tone-bad); direction: ltr; }
  .import-mark .ico { width: 24px; height: 24px; stroke-width: 2; }
  .import-mark b {
    position: absolute; left: 100%; bottom: -3px; margin-left: 1px;
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-weight: 700; font-size: 11px; line-height: 1;
  }
  /* finance: an import that did not finish (admin only) — solid red like the import area, above the cards */
  .ejar-unfinished {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 11px 14px;
    background: var(--tone-bad); color: #fff; border-radius: 3px; font-size: 13px; font-weight: 600; line-height: 1.6;
  }
  .ejar-unfinished .ico { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 2; }
  /* (7-10-2026) the automatic import's strip above the finance cards (admin): mode · last run · its log */
  .ejar-auto {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px;
    padding: 9px 14px; background: var(--card); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary);
    border-radius: 3px; font-size: 12.5px; color: var(--text); line-height: 1.6;
  }
  .ejar-auto-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 320px; }
  .ejar-auto-main > .ico { width: 18px; height: 18px; flex: none; color: var(--primary); }
  .ejar-auto-main b { flex: none; font-weight: 700; }
  .ejar-auto-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
  .ejar-auto-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--tone-mute); display: inline-block; vertical-align: middle; }
  .ejar-auto-ok { background: var(--tone-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-ok) 22%, #fff); }
  .ejar-auto-warn { background: var(--tone-warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-warn) 22%, #fff); }
  .ejar-auto-bad { background: var(--tone-bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-bad) 22%, #fff); }
  .ejar-auto-mute { background: var(--tone-mute); }
  .ejar-auto-side { display: flex; align-items: center; gap: 10px; flex: none; }
  .ejar-auto-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
  .ejar-auto-label select { padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 3px; font-family: inherit; font-size: 12.5px; background: var(--card); color: var(--text); }
  .ejar-auto-log { padding: 6px 12px; font-size: 12.5px; }
  .ejar-undo-btn { margin-top: 10px; padding: 6px 12px; font-size: 12.5px; }
  /* (9-10-2026) the report links kept for the admin (Ejar allows browser downloads only): one row per report */
  .ejar-auto-links { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
  .ejar-auto-links-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
  .ejar-auto-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .ejar-auto-link-name { font-weight: 700; }
  .ejar-auto-link-at { font-size: 12px; color: var(--text-muted); flex: 1 1 auto; }
  .ejar-auto-dl { padding: 6px 14px; font-size: 12.5px; text-decoration: none; }
  .ejar-auto-dismiss { padding: 6px 8px; }
  .ejar-auto-done { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--tone-ok); }
  .ejar-auto-done > .ico { width: 16px; height: 16px; flex: none; }
  .ejar-auto-done { flex-wrap: wrap; }
  /* (20-10-2026) the automatic log: why a link was kept instead of the attachment (a note, not an error) */
  .ejar-auto-note { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
  /* (20-10-2026) the contracts import window opened with a file from email */
  .import-inbox-note { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 9px 12px; border-radius: 3px; font-size: 12.5px; font-weight: 600;
    background: color-mix(in srgb, var(--tone-vio, #6d28d9) 9%, var(--card)); color: var(--text); border-inline-start: 3px solid var(--tone-vio, #6d28d9); }
  .import-inbox-note.held { background: color-mix(in srgb, var(--tone-warn) 12%, var(--card)); border-inline-start-color: var(--tone-warn); }
  .import-inbox-note > .ico { width: 16px; height: 16px; flex: none; }
  /* (19-10-2026) "Re-download" next to a pressed link while it is valid */
  .ejar-auto-again { padding: 4px 10px; font-size: 12px; text-decoration: none; margin-inline-start: 6px; }
  @media (max-width: 700px) { .ejar-auto-side { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px; } }
  .import-zone:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-bad) 35%, #fff); }
  .import-zone-btn {
    position: relative;
    width: 72px; height: 72px; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.85); color: #fff;
    transition: transform 0.15s, border-color 0.15s;
  }
  .import-zone:hover .import-zone-btn, .import-zone.drag-over .import-zone-btn { transform: translateY(-3px); border-color: #fff; }
  .import-zone-btn > .ico { width: 38px; height: 38px; stroke-width: 1.6; }
  .import-zone-warn {
    position: absolute; bottom: 6px; inset-inline-end: 6px;
    width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--tone-bad); color: #fff;
  }
  .import-zone-warn .ico { width: 15px; height: 15px; stroke-width: 2; }
  .import-zone-label {
    direction: ltr;
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif;
    font-size: 12px; font-weight: 600; letter-spacing: 3px;
    color: #fff; user-select: none;
  }
  .btn-ghost { background: transparent; color: var(--text-muted); }
  .btn-ghost:hover:not(:disabled) { background: var(--bg-2); color: var(--text); }
  .btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 3px; }
  .btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

  /* ======= CONTENT ======= */
  .content { padding: 22px 24px; flex: 1; }
  .page { display: none; }
  .page.active { display: block; animation: fadeIn 0.3s; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

  /* ======= STATS — one card look everywhere (dashboard, contracts, deposits, old payments, settlement, contracts import,
     finance): the title on a band in the card's meaning colour (tone-*), the number navy under it; the card of the
     current filter has a navy frame (.selected) ======= */
  .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
  .stat-card {
    --tone: var(--tone-navy);
    background: var(--card);
    border-radius: 3px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .stat-card[onclick] { cursor: pointer; user-select: none; }
  .stat-card[onclick]:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .stat-card.selected { outline: 2px solid var(--primary); outline-offset: 2px; }
  .tone-navy { --tone: var(--tone-navy); }
  .tone-ok { --tone: var(--tone-ok); }
  .tone-warn { --tone: var(--tone-warn); }
  .tone-bad { --tone: var(--tone-bad); }
  .tone-info { --tone: var(--tone-info); }
  .tone-vio { --tone: var(--tone-vio); }
  .tone-mute { --tone: var(--tone-mute); }

  .stat-label {
    background: var(--tone);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stat-card > :not(.stat-label) { padding-inline: 14px; }
  .stat-card > :last-child { padding-bottom: 12px; }
  .stat-value { font-size: 28px; font-weight: 700; line-height: 1.15; color: var(--primary); padding-top: 12px; }
  .stat-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
  .stat-link { font-size: 11.5px; font-weight: 700; color: var(--tone); text-decoration: underline; cursor: pointer; margin-top: 4px; }
  .stats-row .stat-value { font-size: 24px; }   /* the smaller card row of the contracts import */
  /* cards with amounts (finance, old payments, settlement): a bigger count and the amount clear under it */
  .stats-money .stat-value { font-size: 30px; }
  .stat-amount { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: 4px; }

  /* ======= FILTERS ======= */
  .filters {
    background: var(--card);
    border-radius: 3px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .search-box { flex: 1; min-width: 200px; position: relative; }
  .search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 14px;
    background: var(--bg);
    outline: none;
    transition: all 0.2s;
  }
  .search-box input:focus { border-color: var(--accent); background: #fff; }
  .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }
  .filter-select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 13.5px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    cursor: pointer;
    min-width: 130px;
  }

  /* ======= PAGER under the lists that had none (core.js pager*) — the contracts pagination bar's look ======= */
  .pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--card); flex-wrap: wrap; gap: 8px; }

  /* ======= MULTI-SELECT FILTER LISTS (the finance page's list look; dialogs.js msf*) ======= */
  .msf { position: relative; }
  .msf[hidden] { display: none; }
  .msf-btn {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 13px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    min-width: 150px;
    text-align: start;
    white-space: nowrap;
  }
  .filters .msf-btn { background: var(--bg); border-radius: 3px; font-size: 13.5px; }
  .msf-panel {
    position: absolute;
    top: calc(100% + 4px);
    inset-inline-start: 0;
    z-index: 50;
    min-width: 260px;
    max-height: 340px;
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 6px;
  }
  .msf-head { position: sticky; top: -6px; margin-top: -6px; padding-top: 6px; background: var(--card); z-index: 1; }
  .msf-search {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    margin-bottom: 6px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: inherit;
    font-size: 12.5px;
    background: var(--bg);
    color: var(--text);
    outline: none;
  }
  .msf-search:focus { border-color: var(--accent); background: var(--card); }
  .msf-tools { display: flex; gap: 6px; padding: 0 4px 8px; border-bottom: 1px dashed var(--border); margin-bottom: 4px; }
  .msf-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 3px; cursor: pointer; font-size: 12.5px; }
  .msf-item:hover { background: var(--bg); }
  .msf-item input { margin: 0; cursor: pointer; }
  .msf-item small { color: var(--text-muted); margin-inline-start: 4px; }
  .msf-ltr { direction: ltr; unicode-bidi: embed; font-family: monospace; font-size: 12px; }
  .msf-empty { padding: 8px; font-size: 12px; color: var(--text-muted); }
  /* short fixed lists (MSF_CFG narrow): the panel exactly as wide as its button, "select all" / "clear" one above the other */
  .msf-narrow .msf-panel { min-width: 0; width: 100%; }
  .msf-narrow .msf-tools { flex-direction: column; }
  .msf-narrow .msf-tools .btn { justify-content: center; }
  /* a dropdown that would cross the screen edge opens toward the other side of its button (fitDropPanel in dialogs.js) */
  .drop-flip { inset-inline-start: auto !important; inset-inline-end: 0 !important; }

  /* ======= TABLE ======= */
  .table-wrap {
    background: var(--card);
    border-radius: 3px;
    border: 1px solid var(--border);
    overflow: hidden;
  }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; min-width: 900px; }
  thead { background: var(--primary); }   /* navy table heads */
  th {
    padding: 13px 14px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.4px;
    border-bottom: 1.5px solid var(--primary);
    white-space: nowrap;
    text-transform: uppercase;
  }
  td {
    padding: 13px 14px;
    font-size: 13.5px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  tr:last-child td { border-bottom: none; }
  tbody tr { transition: background 0.15s; }
  tbody tr:hover td { background: #eef3f8; }

  .contract-id {
    font-weight: 700;
    color: var(--info);
    font-size: 12.5px;
    font-family: 'SF Mono', monospace;
  }
  .project-id {
    background: var(--primary);   /* solid navy, like the table heads (the user's choice, 28-9-2026) */
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 3px;
    display: inline-block;
    font-family: 'SF Mono', monospace;
  }
  .tenant-name { font-weight: 600; }
  .unit-badge {
    background: #eef2f7;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12.5px;
    font-weight: 700;
    display: inline-block;
  }
  .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
  }
  .status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
  .status-active { background: #d1fae5; color: var(--success); }
  .status-active::before { background: var(--success); }
  .status-critical { background: #fee2e2; color: var(--danger); animation: blink 1s infinite; }
  .status-critical::before { background: var(--danger); }
  .status-expired { background: #f1f5f9; color: #64748b; }
  .status-expired::before { background: #94a3b8; }
  .status-registered { background: #dbeafe; color: #1e40af; }
  .status-registered::before { background: #3b82f6; }
  .status-terminated { background: #ede9fe; color: #6d28d9; }
  .status-terminated::before { background: #7c3aed; }
  .status-handed-over { background: #ccfbf1; color: #0f766e; }
  .status-handed-over::before { background: #14b8a6; }
  @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }

  .days-badge { font-weight: 700; font-size: 12.5px; padding: 3px 9px; border-radius: 3px; }
  .days-ok { color: var(--success); background: #d1fae5; }
  .days-warn { color: #d97706; background: #fef3c7; }
  .days-danger { color: var(--danger); background: #fee2e2; }
  .days-expired { color: #64748b; background: #f1f5f9; }
  .days-registered { color: #1e40af; background: #dbeafe; }
  .days-terminated { color: #6d28d9; background: #ede9fe; }
  .days-handed-over { color: #0f766e; background: #ccfbf1; }

  .amount { font-weight: 700; font-size: 13.5px; color: var(--primary); }
  .action-btns { display: flex; gap: 5px; justify-content: flex-end; }

  /* ======= MODAL ======= */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,37,64,0.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
    overflow-y: auto;
  }
  .modal-overlay.show { display: flex; }
  .modal {
    /* navy behind the navy header, white behind the rest: at the rounded top corners the smoothing lets the window's
       own background through — white there showed as light pixels over a dark page (3-10-2026) */
    background: linear-gradient(to bottom, var(--primary) 30px, var(--card) 30px);
    border-radius: 3px;
    width: 600px;
    max-width: 100%;
    max-height: 90vh;
    /* the header and the footer stay in place, only the body scrolls (3-10-2026): the scroll bar starts under the navy
       header instead of running beside it */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  /* Scroll bars everywhere (page, tables, windows, lists — vertical and horizontal): the system's navy thumb on a light
     track, sharp, no arrow buttons. Chromium browsers (Chrome, Edge, Brave) use ::-webkit-scrollbar; Firefox the
     standard properties (only there: in Chromium scrollbar-color would switch the custom look off). */
  ::-webkit-scrollbar { width: 14px; height: 14px; }   /* 10px was too thin (user) — the thumb shows 10px inside the 2px frame */
  ::-webkit-scrollbar-track { background: #e6ecf3; }
  ::-webkit-scrollbar-thumb { background: var(--primary); border: 2px solid #e6ecf3; border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: #163a63; }
  ::-webkit-scrollbar-corner { background: #e6ecf3; }
  ::-webkit-scrollbar-button { display: none; }
  @supports not selector(::-webkit-scrollbar) {
    * { scrollbar-color: var(--primary) #e6ecf3; }
  }
  /* on the navy side bar a light thumb (navy on navy would vanish) */
  .sidebar ::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.28); border-color: transparent; }
  .sidebar ::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }
  @keyframes modalIn { from { transform: translateY(30px) scale(0.96); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
  /* big windows: navy header with a mint line */
  .modal-header {
    flex: none;
    padding: 16px 22px;
    background: var(--primary);
    border-bottom: 2px solid #00b894;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .modal-title { font-size: 17px; font-weight: 700; color: #fff; }
  .modal-close { background: rgba(255,255,255,0.08); border: none; width: 32px; height: 32px; border-radius: 3px; font-size: 18px; cursor: pointer; color: #cbd5e1; }
  .modal-close:hover { background: rgba(239,68,68,0.25); color: #fff; }
  .modal-body { padding: 22px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .modal-footer { flex: none; padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .form-group-modal { display: flex; flex-direction: column; gap: 5px; }
  .form-group-modal.full { grid-column: span 2; }
  .form-label-req span { color: var(--danger); }

  /* ======= EMPTY STATE ======= */
  .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
  }
  .empty-state .icon { width: 64px; height: 64px; margin-bottom: 14px; border-radius: 50%; background: var(--bg-2); display: inline-flex; align-items: center; justify-content: center; }
  .empty-state .icon .ico { width: 30px; height: 30px; color: var(--text-light); stroke-width: 1.6; }
  .empty-state h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
  .empty-state p { font-size: 14px; }

  /* ======= TOAST ======= */
  .toast {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;   /* away from the sidebar: left in Arabic, right in English */
    background: var(--primary);
    color: #fff;
    padding: 13px 18px;
    border-radius: 3px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 999;
    max-width: 340px;
    display: flex;
    align-items: center;
    gap: 9px;
  }
  .toast .ico, #cloud-status .ico { width: 18px; height: 18px; }   /* the message's kind (msgParts in core.js) */
  .toast.show { transform: translateY(0); opacity: 1; }
  /* a message has nothing to click, and hidden it is only invisible (it stays in its corner, sliding with the finance
     import bar): it never takes the clicks meant for what is under it (it covered part of that bar and its panel) */
  .toast { pointer-events: none; }
  /* "Server connected": the green dot in the cloud-status bubble (showCloudStatus) */
  .cs-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25); }
  .toast.success { background: var(--success); }
  .toast.error { background: var(--danger); }

  /* ======= FINANCE IMPORT PREVIEW: a bar in the messages' corner (left in Arabic, right in English) once a file is
     read — the whole bar opens the panel with the changes, "confirm" and "cancel" (ejarPreviewRender) ======= */
  .ejar-preview { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 900; }
  /* one fixed size in both languages and both states (30-9-2026: the size of the old "changes nothing" bar);
     the text is a fixed sentence — the counts live in the panel */
  .ejar-preview-bar {
    display: flex; align-items: center; gap: 10px; width: 230px; padding: 11px 14px;
    border: none; border-inline-start: 4px solid var(--tone-warn); border-radius: 3px;
    background: var(--primary); color: #fff; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.5;
    text-align: start; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow-lg);
  }
  .ejar-preview-bar:hover { background: #163a63; }
  .ejar-preview-bar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .ejar-preview-bar.ejar-preview-idle { border-inline-start-color: var(--tone-ok); }   /* the file changes nothing */
  .ejar-preview-bar .ico, .ejar-preview-name .ico { width: 18px; height: 18px; flex: none; }
  .ejar-preview-panel {
    width: 440px; max-width: calc(100vw - 48px); max-height: min(72vh, 660px); display: flex; flex-direction: column;
    background: var(--card); border: 1px solid var(--border); border-radius: 3px; box-shadow: var(--shadow-lg); overflow: hidden;
  }
  .ejar-preview-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px;
    background: var(--primary); color: #fff; border-bottom: 3px solid #00b894; font-size: 13px; font-weight: 600;
  }
  .ejar-preview-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .ejar-preview-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ejar-preview-min { flex: none; display: flex; padding: 4px; border: none; border-radius: 3px; background: transparent; color: #fff; cursor: pointer; }
  .ejar-preview-min:hover { background: rgba(255,255,255,0.14); }
  .ejar-preview-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #faf2e1; color: #8a5a00; font-size: 12.5px; font-weight: 600; }
  .ejar-preview-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
  .ejar-preview-sum { margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--text); }
  .ejar-preview-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--bg); }
  .ejar-preview-ok { flex: 1; justify-content: center; background: var(--tone-bad); color: #fff; }
  .ejar-preview-ok:hover { background: #8f3024; }
  .ejar-preview-cancel { background: var(--card); color: var(--text); border: 1px solid var(--border); }
  .ejar-preview-on .toast { bottom: calc(34px + var(--ejar-preview-h, 48px)); }   /* messages above the bar / panel */
  @media (max-width: 700px) {
    .ejar-preview { inset-inline: 12px; bottom: 12px; }
    .ejar-preview-bar { width: 100%; max-width: none; }
    .ejar-preview-panel { width: auto; max-width: none; max-height: 78vh; }
  }

  /* ======= FINANCE C/P (30-9-2026): each installment of a payment as a letter — C green = complete now, P amber =
     something remains — with the installment's order small at its bottom-right (C₄ P₅). Plain coloured text, no boxes;
     read left to right in both languages ======= */
  .ejar-cp-list { display: inline-flex; gap: 5px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; vertical-align: middle; }
  .ejar-cp { display: inline-block; direction: ltr; unicode-bidi: isolate; font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-size: 13px; font-weight: 600; line-height: 16px; }
  .ejar-cp-c { color: var(--tone-ok); }
  .ejar-cp-p { color: var(--tone-warn); }
  /* (1-10-2026) the letter = what the payment did: F blue = the last part that completed the installment; a rejected
     payment's letter grey (what it would get when counted) */
  .ejar-cp-f { color: var(--tone-info); }
  .ejar-cp.ejar-cp-x { color: var(--text-light); }
  .ejar-cp-n { position: relative; top: 4px; margin-left: 1px; font-size: 10px; }
  .ejar-cp-none { color: var(--text-light); }

  /* the payment details: MORE (the bank section's last box) opens the INSTALLMENTS panel over that column (ejarInstToggle) */
  .ejar-more {
    display: flex; align-items: center; justify-content: center; min-height: 52px; grid-column: -2 / -1;
    border: none; border-bottom: 3px solid var(--accent); border-radius: 3px; background: var(--primary); color: #fff;
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 1.5px; cursor: pointer;
  }
  .ejar-more:hover { background: #163a63; }
  .ejar-inst {
    position: absolute; top: 0; bottom: 0; z-index: 1; display: flex; flex-direction: column;
    border: 1px solid var(--primary); border-radius: 3px; background: var(--bg); overflow: hidden;
  }
  .ejar-inst[hidden] { display: none; }
  .ejar-inst-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; flex: none;
    background: var(--primary); color: #fff; border-bottom: 3px solid var(--accent);
    font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-weight: 600; font-size: 11.5px; letter-spacing: .5px;
  }
  .ejar-inst-x { display: flex; padding: 2px; border: none; border-radius: 3px; background: transparent; color: #fff; cursor: pointer; }
  .ejar-inst-x:hover { background: rgba(255,255,255,0.14); }
  .ejar-inst-x .ico { width: 16px; height: 16px; }
  .ejar-inst-title { direction: ltr; unicode-bidi: isolate; }
  .ejar-inst-box { flex: 1; min-height: 0; overflow-y: auto; background: var(--card); }
  /* (1-10-2026) one card per installment of the bill, 1 upwards; its payments oldest first in one row format
     (letter · number · date ……… amount); this payment's cards with a mint line, its rows shaded */
  .ejar-inst-card { padding: 6px 10px 7px; border-bottom: 1px solid var(--border); }
  .ejar-inst-card-me { border-inline-start: 3px solid var(--accent); padding-inline-start: 7px; }
  .ejar-inst-ch { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
  .ejar-inst-ord { font-size: 12.5px; color: var(--text); }
  .ejar-inst-card-me .ejar-inst-ord { color: var(--primary); }
  .ejar-inst-ia { font-size: 11px; color: var(--text-muted); }
  .ejar-inst-state {
    margin-inline-start: auto; unicode-bidi: isolate; font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif;
    font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); white-space: nowrap;
  }
  .ejar-inst-ok { color: var(--tone-ok); }
  .ejar-inst-warn { color: var(--tone-warn); }
  .ejar-inst-state.ejar-inst-left { font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0; color: var(--tone-bad); }
  .ejar-inst-no { display: block; margin: 0 0 3px; font-family: monospace; font-size: 11px; color: var(--text-muted); direction: ltr; unicode-bidi: isolate; text-align: start; }
  .ejar-inst-r { display: flex; align-items: center; gap: 8px; margin: 0 -4px; padding: 2px 4px; border-radius: 3px; font-size: 11.5px; color: var(--text-muted); }
  .ejar-inst-r > .ejar-cp-list, .ejar-inst-r > .ejar-cp-none { flex: none; min-width: 46px; }   /* all the payment's letters (F₄ P₅); the dates line up */
  .ejar-inst-cont { font-size: 11px; color: var(--text-light); white-space: nowrap; }   /* the same payment again, in its next installment */
  .ejar-inst-r-me { background: color-mix(in srgb, var(--tone-info) 10%, var(--card)); }
  .ejar-inst-self { min-width: 8.5ch; font-family: monospace; font-size: 11.5px; color: var(--text); direction: ltr; unicode-bidi: isolate; text-align: start; }
  .ejar-inst-r-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .ejar-inst-r-amt { margin-inline-start: auto; color: var(--text); white-space: nowrap; }
  .ejar-inst-r-x .ejar-inst-r-amt { color: var(--text-light); }
  .ejar-inst-plink { min-width: 8.5ch; padding: 0; border: none; background: none; font-family: monospace; font-size: 11.5px; color: var(--tone-info); text-decoration: underline; cursor: pointer; direction: ltr; unicode-bidi: isolate; text-align: start; }
  .ejar-inst-plink.ejar-inst-plink-txt { font-family: inherit; direction: inherit; }
  .ejar-inst-plink:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  .ejar-inst-bill { padding: 4px 10px; background: var(--bg-2); border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
  .ejar-inst-gap { background: var(--bg); }
  .ejar-inst-gap .ejar-inst-ord { color: var(--text-muted); }
  .ejar-inst-gap-note { display: block; margin-top: 2px; font-size: 11px; color: var(--text-light); }

  /* ======= DETAIL ======= */
  .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .detail-item { display: flex; flex-direction: column; gap: 4px; }
  .detail-item.full { grid-column: span 2; }
  .detail-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
  .detail-value { font-size: 14.5px; font-weight: 600; color: var(--text); }
  .detail-divider { grid-column: span 2; border: none; border-top: 1px solid var(--border); margin: 4px 0; }

  .progress-wrap { margin-top: 18px; }
  .progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
  .progress-bar { height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
  .progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }

  .renewal-summary {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 1.5px solid var(--success);
    border-radius: 3px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .renewal-summary-item { display: flex; flex-direction: column; gap: 2px; }
  .renewal-summary-label { font-size: 11px; color: #065f46; font-weight: 600; }
  .renewal-summary-value { font-size: 13.5px; font-weight: 700; color: #064e3b; }

  .renewal-history { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
  .renewal-history-title { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; }
  .renewal-log { display: flex; flex-direction: column; gap: 8px; max-height: 140px; overflow-y: auto; }
  .renewal-log-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 3px;
    font-size: 12.5px;
  }
  .renewal-log-item .log-icon { font-size: 16px; }
  .renewal-log-item .log-info { flex: 1; }
  .renewal-log-item .log-date { font-size: 11px; color: var(--text-muted); }

  /* Renewal mode buttons */
  .renewal-mode-btn {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 3px;
    background: var(--card);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
  }
  .renewal-mode-btn:hover { border-color: var(--success); color: var(--success); }
  .renewal-mode-btn.active {
    border-color: var(--success);
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    box-shadow: 0 4px 12px rgba(16,185,129,0.2);
  }

  /* Month buttons */
  .month-btn {
    padding: 10px 8px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    background: var(--card);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
  }
  .month-btn:hover { border-color: var(--success); background: #d1fae5; color: #065f46; }
  .month-btn.selected {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
  }

  /* ======= USERS PAGE ======= */
  /* role labels = .tone-chip in the role's colour: admin navy, reception blue, accountant violet, viewer grey, custom green */
  .role-badge { --tone: var(--tone-mute); font-size: 11.5px; }
  .role-admin { --tone: var(--tone-navy); }
  .role-receptionist { --tone: var(--tone-info); }
  .role-accountant { --tone: var(--tone-vio); }
  .role-viewer { --tone: var(--tone-mute); }
  .role-custom { --tone: var(--tone-ok); }

  /* ======= PROJECTS PAGE ======= */
  .projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
  .project-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 3px solid #00b894;
    border-radius: 3px;
    padding: 18px;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
  }
  .project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
  .project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
  .project-name { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
  .project-code {
    font-family: 'SF Mono', monospace;
    font-size: 11.5px;
    background: var(--primary);   /* solid navy, like .project-id */
    color: #fff;
    padding: 3px 8px;
    border-radius: 3px;
    display: inline-block;
    font-weight: 700;
  }
  .project-meta { display: flex; gap: 14px; margin-top: 12px; }
  .project-meta-item { display: flex; flex-direction: column; gap: 2px; }
  .project-meta-label { font-size: 11px; color: var(--text-muted); }
  .project-meta-value { font-size: 14px; font-weight: 700; color: var(--text); }

  /* ======= RESPONSIVE ======= */
  @media (max-width: 900px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(100%); width: 260px; box-shadow: var(--shadow-lg); }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }   /* English: hidden off the left edge */
    .sidebar.open, [dir="ltr"] .sidebar.open { transform: translateX(0); }
    .main { margin-inline-start: 0; }
    .menu-toggle { display: inline-flex; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-group-modal.full { grid-column: span 1; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item.full, .detail-divider { grid-column: span 1; }
    .renewal-summary { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 12px 16px; }
    .topbar-title { font-size: 16px; }
    .stat-value { font-size: 24px; }
    .modal { border-radius: 3px; }
  }

  @media (max-width: 480px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .topbar-actions .btn span { display: none; }
  }

  /* sidebar overlay on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }

  /* ===== DASHBOARD — "شريط القيادة" (30-9-2026, dashboard.js). No .stat-card here (the user's rule). The meaning colour
     of a panel / line / badge / tower comes from its tone-* class (--tone): no --tone default is set in this section,
     because these rules come after .tone-* and a default would win over it ===== */
  .dx { display: flex; flex-direction: column; gap: 16px; }
  .dx-tag { font-family: 'Sora', 'IBM Plex Sans Arabic', sans-serif; font-size: 10px; font-weight: 600; letter-spacing: 2px; unicode-bidi: isolate; white-space: nowrap; user-select: none; }
  .dx-num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
  .dx-panel[hidden] { display: none; }

  /* the command strip: one navy console, the figures separated by hairlines (no cards) */
  .dx-strip { background: var(--primary); color: #fff; border-radius: 3px; border-bottom: 3px solid var(--dx-mint); overflow: hidden; }
  .dx-metrics { display: flex; align-items: stretch; }
  .dx-m { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 13px 15px 12px; transition: background 0.15s; }
  .dx-m[role="button"] { cursor: pointer; }
  .dx-m[role="button"]:hover { background: rgba(255,255,255,0.05); }
  .dx-m + .dx-m::before { content: ''; position: absolute; inset-inline-start: 0; top: 14px; bottom: 14px; width: 1px; background: rgba(255,255,255,0.14); }
  .dx-m-line { display: flex; align-items: center; gap: 7px; white-space: nowrap; min-width: 0; }
  .dx-m-line .ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
  .dx-m-label { margin-inline-end: auto; padding-inline-end: 6px; font-size: 12.5px; color: var(--dx-strip-label); overflow: hidden; text-overflow: ellipsis; }
  .dx-m-num { font-size: 19px; font-weight: 700; line-height: 1.1; color: #fff; }
  .dx-m-num.dx-warn { color: var(--dx-num-warn); }
  .dx-m-num.dx-bad { color: var(--dx-num-bad); }
  /* (width 0 + min-width 100%: the note under a figure never widens it — the widths follow the label and the number) */
  .dx-m-sub { width: 0; min-width: 100%; font-size: 11.5px; color: var(--dx-strip-sub); padding-inline-start: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dx-m-sub b { color: var(--dx-strip-strong); font-weight: 600; }
  .dx-m-sub .dx-up b { color: var(--accent); }
  .dx-m-sub .dx-down b { color: var(--dx-num-bad); }
  .dx-strip-foot { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 7px 16px; background: rgba(0,0,0,0.22); font-size: 12px; color: var(--dx-strip-foot); }
  .dx-strip-foot .dx-tag { color: var(--accent); }
  .dx-strip-foot .ico { width: 14px; height: 14px; color: var(--dx-strip-foot); }
  .dx-fresh { display: inline-flex; align-items: center; gap: 6px; }
  .dx-fresh b { color: var(--dx-strip-strong); font-weight: 600; }
  .dx-dot { width: 3px; height: 3px; background: var(--dx-strip-sub); border-radius: 50%; }
  .dx-date { margin-inline-start: auto; color: var(--dx-strip-date); }
  .dx-date b { font-weight: 400; }

  /* two columns: the start (right in Arabic) = what to do today; the end = money and units */
  .dx-cols { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .dx-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

  /* panels: white, sharp, a 3px line in the panel's meaning colour, a quiet head */
  .dx-panel { background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--tone, var(--tone-navy)); border-radius: 3px; overflow: hidden; }
  .dx-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border); min-height: 46px; }
  .dx-title { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 700; color: var(--primary); white-space: nowrap; }
  .dx-title .ico { width: 18px; height: 18px; color: var(--dx-mint); }
  .dx-head-note { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .dx-head-note.dx-stale { color: var(--tone-warn); font-weight: 600; }
  .dx-head > .dx-tag { margin-inline-start: auto; color: var(--text-light); }
  .dx-head .bento-toggle { margin-inline-start: auto; }
  .dx-head .bento-toggle-btn { display: inline-flex; align-items: center; gap: 6px; }
  .dx-tab-n { font-size: 11px; font-weight: 700; opacity: 0.75; }

  /* today's alerts: one line per item, the number at the end, a chevron (the whole line opens the page on those rows) */
  .dx-alert { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
  .dx-alert[role="button"] { cursor: pointer; }
  .dx-alert::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, var(--tone-navy)); }
  .dx-alert[role="button"]:hover { background: var(--dx-row-hover); }
  .dx-alert-ico { width: 32px; height: 32px; flex: none; border-radius: 3px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--tone, var(--tone-navy)) 11%, var(--card)); color: var(--tone, var(--tone-navy)); }
  .dx-alert-ico .ico { width: 18px; height: 18px; }
  .dx-alert-txt { flex: 1; min-width: 0; }
  .dx-alert-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); }
  .dx-alert-title .dx-tag { font-size: 9px; letter-spacing: 1.5px; color: #fff; background: var(--tone-vio); padding: 2px 6px; border-radius: 2px; }
  .dx-alert-sub { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dx-alert-sub b { color: var(--text); }
  .dx-alert-num { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
  .dx-alert-num b { font-size: 18px; font-weight: 700; color: var(--tone, var(--tone-navy)); }
  .dx-alert-num small { font-size: 11.5px; color: var(--text-muted); }
  .dx-go { width: 16px; height: 16px; color: var(--text-light); flex: none; }
  .dx-alert:hover .dx-go { color: var(--tone, var(--tone-navy)); }
  .dx-panel .dx-alert:last-child { border-bottom: none; }
  /* (10-10-2026) Operation Report: the admin's box for Ejar's two nightly reports — a halo pulses round the box and the
     waiting row's icon and dot blink while a report waits; once taken, the import date stands still and large */
  .dx-report-pulse { animation: dxReportPulse 1.4s ease-in-out infinite; }
  @keyframes dxReportPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone-vio) 55%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--tone-vio) 0%, transparent); } }
  .dx-report-row.dx-report-wait .dx-alert-ico { animation: dxReportIco 1s steps(2, end) infinite; }
  @keyframes dxReportIco { to { background: var(--tone, var(--tone-vio)); color: #fff; } }
  .dx-report-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--tone-vio)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone, var(--tone-vio)) 22%, #fff); animation: dxReportDot 1s steps(2, end) infinite; }
  @keyframes dxReportDot { to { opacity: 0.15; } }
  .dx-report-date { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
  .dx-report-date b { font-size: 15px; font-weight: 700; color: var(--primary); direction: ltr; unicode-bidi: isolate; }
  .dx-report-date small { font-size: 11px; font-weight: 600; color: var(--tone, var(--tone-navy)); }
  .dx-report-row .dx-report-btn { padding: 7px 16px; font-size: 12.5px; text-decoration: none; flex: none; }
  .dx-report-row .dx-report-again { padding: 5px 12px; font-size: 12px; background: var(--card); }
  .dx-report-row .dx-alert-sub { white-space: normal; }   /* (19-10-2026) the "drop the file on its import button" hint whole next to a button */
  @media (prefers-reduced-motion: reduce) { .dx-report-pulse, .dx-report-row.dx-report-wait .dx-alert-ico, .dx-report-dot { animation: none; } }
  .dx-vac { border-top: 1px solid var(--border); }
  .dx-foot-ok { display: flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 12px; color: var(--tone-ok); background: color-mix(in srgb, var(--tone-ok) 6%, var(--card)); }
  .dx-foot-ok .ico { width: 15px; height: 15px; flex: none; }
  .dx-foot-ok.dx-muted { color: var(--text-muted); background: var(--bg); }
  .dx-locked { display: flex; align-items: center; gap: 8px; padding: 14px 16px; font-size: 12.5px; color: var(--text-muted); }
  .dx-locked .ico { width: 15px; height: 15px; flex: none; }

  /* renewals: 7 / 30 day tabs, the system's navy table head, one line per contract */
  .dx-sum { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; padding: 9px 16px; font-size: 12.5px; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); }
  .dx-sum b { color: var(--primary); font-weight: 700; }
  .dx-sum-col { flex-direction: column; align-items: stretch; gap: 7px; }
  .dx-dist { display: flex; height: 8px; width: 100%; gap: 2px; }
  .dx-dist > i { display: block; height: 100%; background: var(--tone); }
  .dx-dist-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; }
  .dx-dist-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .dx-dist-legend i { width: 9px; height: 9px; display: inline-block; background: var(--tone); }
  .dx-rows { --cols: minmax(0, 1fr) minmax(0, 1.15fr) 58px 100px; }
  .dx-row .dx-c-ten { order: 1; }
  .dx-row .dx-c-proj { order: 2; }
  .dx-row .dx-c-unit { order: 3; }
  .dx-row .dx-c-days { order: 4; }
  .dx-thead, .dx-row { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 10px; padding: 0 16px; }
  .dx-thead { background: var(--primary); color: #e2e8f0; font-size: 11.5px; font-weight: 700; padding-top: 8px; padding-bottom: 8px; letter-spacing: 0.3px; }
  .dx-thead > :nth-child(3), .dx-row > .dx-c-unit { text-align: center; }
  .dx-thead > :last-child, .dx-row > .dx-c-days { text-align: end; }
  .dx-row { padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; transition: background 0.15s; }
  .dx-row:hover { background: var(--dx-row-hover); }
  .dx-group { padding: 6px 16px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); background: var(--bg); border-bottom: 1px solid var(--border); }
  .dx-c-ten { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; color: var(--text); }
  .dx-ten-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dx-succ { flex: none; font-size: 10.5px; font-weight: 700; color: var(--tone-info); background: color-mix(in srgb, var(--tone-info) 10%, var(--card)); padding: 1px 6px; border-radius: 3px; white-space: nowrap; }
  .dx-c-proj { min-width: 0; color: var(--dx-proj); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dx-c-unit > span { background: var(--dx-unit-bg); color: var(--primary); padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 700; }
  .dx-c-br { display: none; }
  .dx-days { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 11.5px; font-weight: 700; color: var(--tone, var(--tone-warn)); background: color-mix(in srgb, var(--tone, var(--tone-warn)) 11%, var(--card)); white-space: nowrap; }
  .dx-more { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: 12.5px; color: var(--text-muted); }
  .dx-more b { color: var(--primary); }
  .dx-link { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; color: var(--tone-info); font-weight: 700; cursor: pointer; white-space: nowrap; }
  .dx-link .ico { width: 15px; height: 15px; }
  .dx-link:hover { text-decoration: underline; }

  /* money: the last 30 days against the 30 before, then one line per figure (each opens the finance page on its rows) */
  .dx-hero { padding: 13px 16px 12px; cursor: pointer; transition: background 0.15s; }
  .dx-hero:hover { background: var(--dx-row-hover); }
  .dx-hero-label { font-size: 12.5px; color: var(--text-muted); }
  .dx-hero-line { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; margin-top: 2px; }
  .dx-hero-num { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.2; }
  .dx-hero-count { font-size: 12px; color: var(--text-muted); }
  .dx-hero-count b { font-weight: 600; }
  .dx-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--tone-ok); background: color-mix(in srgb, var(--tone-ok) 10%, var(--card)); padding: 2px 7px; border-radius: 3px; }
  .dx-trend.dx-down { color: var(--tone-bad); background: color-mix(in srgb, var(--tone-bad) 10%, var(--card)); }
  .dx-trend.dx-flat { color: var(--text-muted); background: var(--bg-2); }
  .dx-trend .ico { width: 14px; height: 14px; stroke-width: 2.2; }
  .dx-cmp { margin-top: 11px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; font-size: 11.5px; color: var(--text-muted); }
  .dx-cmp-v { font-weight: 700; color: var(--text); text-align: end; }
  .dx-bar { height: 8px; background: var(--bg-2); overflow: hidden; }
  .dx-bar > i { display: block; height: 100%; background: var(--tone-ok); }
  .dx-bar.dx-bar-prev > i { background: var(--dx-bar-prev); }
  .dx-kv { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; cursor: pointer; transition: background 0.15s; }
  .dx-kv:hover { background: var(--dx-row-hover); }
  .dx-kv > .ico { width: 17px; height: 17px; color: var(--text-muted); flex: none; }
  .dx-kv-label { flex: 1; min-width: 0; color: var(--text); }
  .dx-kv-label small { color: var(--text-muted); font-size: 11.5px; margin-inline-start: 4px; }
  .dx-kv-label small b { font-weight: 600; }
  .dx-kv-val { font-weight: 700; color: var(--primary); white-space: nowrap; }
  .dx-kv-ok { color: var(--tone-ok); display: inline-flex; align-items: center; gap: 4px; }
  .dx-kv-ok .ico { width: 15px; height: 15px; }
  .dx-kv .ejar-cp { margin-inline-end: 2px; }
  .dx-cash-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 18px 16px; font-size: 13px; color: var(--text-muted); }
  .dx-cash-state .gear-emb, .dx-cash-state > .ico { width: 24px; height: 24px; flex: none; }
  .dx-cash-state .btn { margin-inline-start: auto; }

  /* occupancy: a tower per property (the 5 largest), 6 windows a floor, the rented windows lit from the ground up */
  .dx-occ-sum { display: flex; align-items: center; gap: 10px; padding: 12px 16px 2px; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
  .dx-occ-sum b { color: var(--primary); font-size: 14px; }
  .dx-occ-sum b.dx-occ-pct { color: var(--tone, var(--primary)); }
  .dx-occ-bar { flex: 1; height: 6px; background: var(--dx-bar-bg); min-width: 40px; }
  .dx-occ-bar > i { display: block; height: 100%; background: var(--tone-ok); }
  .dx-sky { --w: 9px; --g: 2px; padding: 12px 16px 0; }
  .dx-sky-row { display: flex; gap: 6px; }
  .dx-sky-row > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
  .dx-sky-bld { align-items: flex-end; border-bottom: 3px solid var(--primary); }
  .dx-tw { gap: 4px; }
  .dx-tw[role="button"] { cursor: pointer; }
  .dx-tw-pct { font-size: 12px; font-weight: 700; color: var(--tone, var(--tone-mute)); }
  .dx-tw-body { display: grid; grid-template-columns: repeat(6, var(--w)); gap: var(--g); padding: 4px; border: 1.5px solid var(--primary); border-bottom: none; background: var(--card); transition: border-color 0.15s; }
  .dx-tw[role="button"]:hover .dx-tw-body { border-color: var(--tone, var(--primary)); }
  .dx-tw-nounits .dx-tw-body { border-style: dashed; }
  .dx-win { width: var(--w); height: var(--w); background: var(--dx-win-empty); }
  .dx-win.dx-win-lit { background: var(--tone-ok); }   /* a rented window is always green; the % above says the level */
  .dx-win.dx-win-none { background: transparent; }
  .dx-sky-lbl > div { padding-top: 6px; text-align: center; gap: 1px; }
  .dx-tw-name { font-size: 11px; font-weight: 600; color: var(--primary); line-height: 1.35; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .dx-tw-count { font-size: 11px; color: var(--text-muted); }
  .dx-tw-note { font-size: 10px; line-height: 1.3; color: var(--tone-warn); }
  .dx-legend { display: flex; align-items: center; gap: 14px; padding: 10px 16px 12px; font-size: 11px; color: var(--text-muted); }
  .dx-legend span { display: inline-flex; align-items: center; gap: 5px; }
  .dx-legend i { width: 9px; height: 9px; display: inline-block; }
  .dx-lg-lit { background: var(--tone-ok); }
  .dx-lg-empty { background: var(--dx-win-empty); }
  .dx-legend .dx-tag { margin-inline-start: auto; color: var(--text-light); letter-spacing: 1px; }
  .dx-occ-more { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--tone-info); cursor: pointer; }
  .dx-occ-more .ico { width: 15px; height: 15px; }
  .dx-occ-more:hover { background: var(--dx-row-hover); }
  .dx-occ-list { border-top: 1px solid var(--border); max-height: 240px; overflow-y: auto; }
  .dx-occ-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; align-items: center; gap: 10px; padding: 6px 16px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
  .dx-occ-row[role="button"] { cursor: pointer; }
  .dx-occ-row[role="button"]:hover { background: var(--dx-row-hover); }
  .dx-occ-row:last-child { border-bottom: none; }
  .dx-occ-name { min-width: 0; color: var(--primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dx-occ-cnt { color: var(--text-muted); }
  .dx-occ-p { font-weight: 700; text-align: end; color: var(--tone, var(--tone-mute)); }

  /* keyboard: every line that opens something shows the mint ring */
  .dx-m:focus-visible, .dx-row:focus-visible, .dx-alert:focus-visible, .dx-tw:focus-visible, .dx-kv:focus-visible, .dx-hero:focus-visible,
  .dx-link:focus-visible, .dx-occ-row:focus-visible, .dx-occ-more:focus-visible, .dash-list-chip-x:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  /* "من اللوحة ✕" above the contracts / deposits table: the rows of the dashboard figure that was clicked */
  .dash-list-chip { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; margin-bottom: 12px; padding: 5px 6px; padding-inline-start: 12px; background: var(--primary); color: #fff; border-radius: 3px; font-size: 12.5px; font-weight: 600; }
  .dash-list-chip[hidden] { display: none; }
  .dash-list-chip > .ico { width: 15px; height: 15px; color: var(--accent); flex: none; }
  .dash-list-chip-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-list-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; border: none; border-radius: 3px; background: rgba(255,255,255,0.12); color: #fff; cursor: pointer; }
  .dash-list-chip-x:hover { background: rgba(255,255,255,0.24); }
  .dash-list-chip-x .ico { width: 14px; height: 14px; }

  /* the 7 / 30 day tabs (also the look of other two-way switches) */
  .bento-toggle {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px;
    display: flex; gap: 2px;
  }
  .bento-toggle-btn {
    padding: 6px 12px; border: none;
    background: transparent;
    font-family: inherit; font-size: 12px; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    border-radius: 3px; transition: all 0.2s;
  }
  .bento-toggle-btn.active { background: var(--primary); color: #fff; }
  .bento-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

  /* A small label in a meaning colour (tone-*): light fill, thin frame, the colour as text — the users' roles and states */
  .tone-chip {
    /* no --tone default here: this rule comes after .tone-* / .role-*, so a default would win over them */
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700; line-height: 1.5;
    padding: 2px 9px; border-radius: 3px;
    color: var(--tone, var(--tone-navy));
    background: color-mix(in srgb, var(--tone, var(--tone-navy)) 9%, #fff);
    border: 1px solid color-mix(in srgb, var(--tone, var(--tone-navy)) 28%, #fff);
    flex-shrink: 0; white-space: nowrap;
  }
  .tone-chip .ico { width: 13px; height: 13px; }

  /* up to 1260 wide: one column in the order of the day */
  @media (max-width: 1260px) {
    .dx-cols { grid-template-columns: minmax(0, 1fr); }
  }
  /* 701–1260 (a small laptop, a tablet): the strip in two rows — 3 + 2, or 2 + 2 */
  @media (min-width: 701px) and (max-width: 1260px) {
    .dx-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .dx-m { grid-column: span 2; }
    .dx-metrics[data-n="5"] > .dx-m:nth-child(n+4), .dx-metrics[data-n="4"] > .dx-m, .dx-metrics[data-n="2"] > .dx-m { grid-column: span 3; }
    .dx-metrics[data-n="1"] > .dx-m { grid-column: span 6; }
    .dx-metrics[data-n="5"] > .dx-m:nth-child(4)::before, .dx-metrics[data-n="4"] > .dx-m:nth-child(3)::before { display: none; }
    .dx-metrics[data-n="5"] > .dx-m:nth-child(n+4), .dx-metrics[data-n="4"] > .dx-m:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,0.12); }
    .dx-m-label { font-size: 12px; }
  }
  /* the phone: the strip a divided readout in two columns, the renewal lines on two lines */
  @media (max-width: 700px) {
    .dx-hide-phone { display: none; }
    body:has(#page-dashboard.active) .topbar-sub { max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dx, .dx-cols, .dx-col { gap: 14px; }
    .dx-metrics { display: grid; grid-template-columns: 1fr 1fr; }
    .dx-m { padding: 10px 14px 9px; gap: 3px; }
    .dx-m + .dx-m::before { display: none; }
    .dx-m:nth-child(odd):not(:last-child)::after { content: ''; position: absolute; inset-inline-end: 0; top: 12px; bottom: 12px; width: 1px; background: rgba(255,255,255,0.14); }
    .dx-m:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,0.12); }
    .dx-m:nth-child(odd):last-child { grid-column: 1 / -1; }   /* an odd count: the last figure takes the whole line (no empty cell) */
    .dx-m-num { font-size: 17px; }
    .dx-m-sub { padding-inline-start: 0; font-size: 11px; }
    .dx-m-line .ico { display: none; }
    .dx-strip-foot { padding: 7px 14px; gap: 4px 10px; font-size: 11.5px; }
    .dx-strip-foot .dx-date { display: none; }
    .dx-head { padding: 10px 14px; flex-wrap: wrap; }
    .dx-alert { padding: 10px 14px; gap: 10px; }
    .dx-alert-sub { white-space: normal; }
    .dx-thead { display: none; }
    .dx-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 1px; padding: 9px 14px; }
    .dx-row .dx-days { padding: 2px 7px; }
    .dx-row .dx-c-ten { order: 1; flex: 1 1 auto; font-size: 13.5px; }
    .dx-row .dx-c-days { order: 2; }
    .dx-row .dx-c-br { display: block; order: 3; flex-basis: 100%; height: 0; }
    .dx-row .dx-c-proj, .dx-row .dx-c-unit { order: 4; font-size: 12px; color: var(--text-muted); font-weight: 500; text-align: start; }
    .dx-row .dx-c-unit > span { background: none; padding: 0; color: var(--text-muted); font-weight: 500; font-size: 12px; }
    .dx-row .dx-c-unit::before { content: attr(data-pre); }
    .dx-sum, .dx-group, .dx-more, .dx-kv, .dx-occ-more, .dx-occ-row, .dx-legend, .dx-occ-sum { padding-inline: 14px; }
    .dx-hero { padding: 12px 14px; }
    .dx-hero-num { font-size: 22px; }
    .dx-sky { --w: 6px; --g: 1.5px; padding-inline: 10px; }
    .dx-sky-row { gap: 4px; }
    .dx-tw-body { padding: 3px; }
    .dx-tw-name { font-size: 10.5px; }
    .dx-legend .dx-tag { display: none; }
  }

  /* ======= EXPIRED CONTRACTS RECONCILIATION (expired-recon.js, 27-10-2026) — the system's cards, filters and table;
     the rows carry their result's colour on the start edge ======= */
  .er-intake { background: var(--card); border: 1px solid var(--border); border-radius: 3px; padding: 18px; display: grid; gap: 14px; margin-bottom: 16px; transition: border-color 0.15s; }
  .er-intake.er-over { border-color: var(--accent); }
  .er-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
  .er-slot {
    display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px;
    background: var(--bg); border: 1.5px dashed var(--border-strong); border-radius: 3px;
    font-family: inherit; color: var(--text); text-align: start; cursor: pointer; transition: border-color 0.15s, background 0.15s;
  }
  .er-slot .ico { flex: none; color: var(--text-muted); }
  .er-slot:hover, .er-intake.er-over .er-slot { border-color: var(--primary); }
  .er-slot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  .er-slot.er-filled { border-style: solid; border-color: var(--tone-ok); background: color-mix(in srgb, var(--tone-ok) 8%, var(--card)); }
  .er-slot.er-filled .ico { color: var(--tone-ok); }
  .er-slot-text { display: grid; gap: 2px; min-width: 0; }
  .er-slot-title { font-size: 14px; font-weight: 700; color: var(--primary); }
  .er-slot-file { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
  .er-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
  .er-field { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
  .er-field .form-input { width: 170px; }
  .er-msg { font-size: 13px; color: var(--text-muted); min-height: 1.5em; }
  .er-msg.er-msg-err { color: var(--tone-bad); font-weight: 600; }
  .er-blank { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 36px 20px; background: var(--card); border: 1px dashed var(--border-strong); border-radius: 3px; color: var(--text-muted); font-size: 13px; }
  .er-blank b { color: var(--text); font-size: 16px; }
  .er-source { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
  .er-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
  .er-bar { justify-content: space-between; }
  .er-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .er-chip { border: 1.5px solid var(--border); background: var(--card); color: var(--text); border-radius: 20px; padding: 4px 12px; font-family: inherit; font-size: 13px; cursor: pointer; }
  .er-chip:hover { border-color: var(--primary); }
  .er-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
  .er-chip-n { font-size: 12px; opacity: 0.75; margin-inline-start: 6px; font-variant-numeric: tabular-nums; }
  .er-search { flex: 0 1 300px; }
  .er-table { min-width: 1150px; }
  .er-table td { padding: 10px 12px; }
  .er-table td:first-child { border-inline-start: 3px solid var(--er-c, transparent); }
  .er-table tr.er-m { --er-c: var(--tone-ok); }
  .er-table tr.er-e { --er-c: var(--tone-warn); }
  .er-table tr.er-s { --er-c: var(--tone-bad); }
  .er-table tr.er-o { --er-c: var(--tone-info); }
  .er-table td.er-text { text-align: start; min-width: 160px; }
  .er-table td.er-note { text-align: start; font-size: 12.5px; color: var(--text-muted); min-width: 240px; max-width: 340px; }
  .er-table td.er-st { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
  .er-table td.er-empty { padding: 30px; color: var(--text-muted); }
  .er-pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
  .er-pill.er-m, .er-pill.er-co-out { background: color-mix(in srgb, var(--tone-ok) 13%, #fff); color: var(--tone-ok); }
  .er-pill.er-e, .er-pill.er-co-ren { background: color-mix(in srgb, var(--tone-warn) 14%, #fff); color: var(--tone-warn); }
  .er-pill.er-s, .er-pill.er-co-need { background: color-mix(in srgb, var(--tone-bad) 12%, #fff); color: var(--tone-bad); }
  .er-pill.er-o { background: color-mix(in srgb, var(--tone-info) 13%, #fff); color: var(--tone-info); }
  .er-co { display: grid; gap: 3px; justify-items: center; }
  .er-co-sub { font-size: 11.5px; color: var(--text-muted); }
  .er-num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
  .er-diff { color: var(--tone-bad); font-weight: 700; }
  .er-foot { font-size: 12px; color: var(--text-muted); line-height: 1.7; margin: 14px 0 0; }
  /* the lock (every visit), the three methods, and a check-out box per project (27-10-2026) */
  .er-lock { max-width: 380px; margin: 40px auto; display: grid; gap: 8px; justify-items: center; text-align: center; padding: 28px 24px;
    background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 3px; color: var(--text-muted); font-size: 13px; }
  .er-lock .ico-xl { color: var(--primary); }
  .er-lock b { color: var(--text); font-size: 16px; }
  .er-lock-row { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
  .er-lock-row .form-input { flex: 1; min-width: 0; text-align: center; letter-spacing: 2px; }
  .er-lock-err { color: var(--tone-bad); font-weight: 600; min-height: 1.4em; }
  .er-modes { background: var(--card); border: 1px solid var(--border); border-radius: 3px; padding: 18px; }
  .er-modes-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
  .er-modes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
  .er-mode { display: grid; gap: 4px; text-align: start; padding: 16px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 3px;
    font-family: inherit; color: var(--text); cursor: pointer; transition: border-color 0.15s; }
  .er-mode b { font-size: 15px; color: var(--primary); }
  .er-mode span { font-size: 12.5px; color: var(--text-muted); }
  .er-mode:hover, .er-mode:focus-visible { border-color: var(--primary); outline: none; }
  .er-mode-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-muted); }
  .er-mode-bar b { color: var(--primary); }
  .er-projects { display: grid; gap: 8px; }
  .er-proj-title { font-size: 13px; font-weight: 700; color: var(--primary); }
  .er-proj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
  .er-proj { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; min-width: 0;
    background: var(--bg); border: 1.5px dashed var(--border-strong); border-radius: 3px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
  .er-proj > .ico { flex: none; margin-top: 2px; color: var(--text-muted); }
  .er-proj:hover, .er-proj.er-over { border-color: var(--primary); }
  .er-proj:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  .er-proj.er-filled { border-style: solid; border-color: var(--tone-ok); background: color-mix(in srgb, var(--tone-ok) 8%, var(--card)); }
  .er-proj.er-filled > .ico { color: var(--tone-ok); }
  .er-proj.er-warn { border-color: var(--tone-warn); background: color-mix(in srgb, var(--tone-warn) 9%, var(--card)); }
  .er-proj-text { display: grid; gap: 2px; min-width: 0; padding-inline-end: 22px; }
  .er-proj-name { font-size: 13.5px; font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
  .er-proj-sub, .er-proj-file { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
  .er-proj-warn { font-size: 12px; font-weight: 600; color: var(--tone-warn); margin-top: 2px; }
  .er-proj-x { position: absolute; top: 8px; inset-inline-end: 8px; display: inline-flex; padding: 3px; border: none; border-radius: 3px;
    background: transparent; color: var(--text-muted); cursor: pointer; }
  .er-proj-x:hover { background: color-mix(in srgb, var(--tone-bad) 12%, #fff); color: var(--tone-bad); }
  .er-excluded { font-size: 13px; font-weight: 600; color: var(--tone-warn); background: color-mix(in srgb, var(--tone-warn) 10%, var(--card));
    border-inline-start: 3px solid var(--tone-warn); border-radius: 3px; padding: 8px 12px; margin-bottom: 12px; }
  .er-pill.er-co-act { background: color-mix(in srgb, var(--tone-info) 13%, #fff); color: var(--tone-info); }
  .er-pill.er-co-sys { background: color-mix(in srgb, var(--tone-vio) 13%, #fff); color: var(--tone-vio); }
  @media (max-width: 600px) {
    .er-intake { padding: 14px; }
    .er-controls > * { flex: 1 1 140px; }
    .er-field .form-input { width: 100%; }
    .er-search { flex: 1 1 100%; }
  }

  /* ===== "Systems Verification" sidebar group (app-shell.js): opens and closes, its pages indented ===== */
  .nav-group-head .nav-chev { width: 16px; height: 16px; margin-inline-start: auto; color: rgba(255,255,255,0.5); transition: transform 0.18s; }
  .nav-group-head[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }
  .nav-group-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .nav-group[hidden] { display: none; }
  .nav-item.nav-sub { padding-inline-start: 28px; font-size: 13.5px; }
  .nav-item.nav-sub .ico { width: 18px; height: 18px; }

  /* ===== Bank reconciliation page (bank-recon.js; reuses the .er-* intake, chips, pills and table) ===== */
  .br-stmts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
  .br-stmt { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; min-width: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: 3px; }
  .br-stmt > .ico { flex: none; margin-top: 2px; color: var(--text-muted); }
  .br-stmt.er-filled { border-color: var(--tone-ok); background: color-mix(in srgb, var(--tone-ok) 6%, var(--card)); }
  .br-stmt.er-filled > .ico { color: var(--tone-ok); }
  .br-stmt.er-warn { border-color: var(--tone-warn); background: color-mix(in srgb, var(--tone-warn) 8%, var(--card)); }
  .br-stmt.br-bad { border-color: var(--tone-bad); background: color-mix(in srgb, var(--tone-bad) 7%, var(--card)); }
  .br-stmt.br-bad > .ico { color: var(--tone-bad); }
  .br-stmt-main { display: grid; gap: 4px; min-width: 0; flex: 1; padding-inline-end: 22px; }
  .br-stmt-name { font-size: 13.5px; font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
  .br-stmt-sub, .br-stmt-note { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
  .br-stmt-ok { font-size: 12.5px; font-weight: 600; color: var(--tone-ok); }
  .br-stmt-err { font-size: 12.5px; font-weight: 600; color: var(--tone-bad); line-height: 1.6; }
  .br-stmt-proj { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
  .br-stmt-proj .form-input { flex: 1; min-width: 0; padding: 6px 10px; font-size: 13px; }
  .br-scope, .br-tabs { margin-bottom: 10px; }
  .br-tab-extra { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
  .br-cls-sum { display: inline-flex; gap: 6px; align-items: center; }
  .br-table { min-width: 980px; }
  /* side by side: a pair = two rows; a stronger line above each pair, the result cell spans both */
  .br-table tr.br-pair-sys td { border-top: 2px solid var(--border-strong); }
  .br-table tr.br-pair-bank td:first-child { border-inline-start: none; }
  .br-table td.br-src { font-size: 12.5px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
  .br-table td.br-res { vertical-align: middle; }