/* MOTUS design system — single committed light theme: navy + white, with the amber primary of 16/11 in three places only
   (the selected menu item, the primary button, the active tab; docs/UI-SHELL.md).
   Layout: dark navy sidebar on the inline-start edge, light grey canvas, white cards.
   Fonts are self-hosted (Google Fonts, SIL Open Font License) so the app works without
   internet access to fonts.googleapis.com. */
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Variable.ttf") format("truetype"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("../fonts/Cairo-Variable.ttf") format("truetype"); font-weight: 200 1000; font-style: normal; font-display: swap; }
:root {
  /* the final design (16/11): amber primary on dark text, navy for links, headings and secondary buttons */
  --primary: #F2A20C;        /* the selected menu item, the primary button, the active tab — nowhere else */
  --primary-hover: #DB9008;
  --on-primary: #0B1F33;     /* text and icons on the primary */
  --primary-soft: #FFF6E3;   /* the selected table row */
  --nav-bg: #061D38;         /* the menu */
  --navy: #08264A;           /* links, headings, secondary buttons */
  --bg: #F4F6F9;
  --line: #E3E8EF;
  --text-2: #5B6B7F;
  /* the earlier names, kept for every screen: «primary» there is the navy text colour */
  --motus-primary: var(--navy);
  --motus-deep: var(--nav-bg);
  --motus-white: #FFFFFF;
  --motus-background: var(--bg);
  --motus-border: var(--line);
  --motus-text-secondary: var(--text-2);
  --motus-hover: #EEF2F7;
  --motus-success: #15803D; --motus-success-bg: #ECFDF3;
  --motus-warning: #9A3412; --motus-warning-bg: #FDEDE4;
  --motus-danger: #B91C1C; --motus-danger-bg: #FEF2F2;
  --motus-info: #08264A; --motus-info-bg: #EEF2F7;
  --motus-chart-1: #08264A; --motus-chart-2: #2C4A6E; --motus-chart-3: #5A7493; --motus-chart-4: #8FA3BA; --motus-chart-5: #C3CFDC;
  --motus-focus-ring: 0 0 0 3px rgba(8, 38, 74, 0.25);
  --font-english: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "Cairo", "Segoe UI", Tahoma, sans-serif;
  --radius-card: 12px; --radius-button: 8px; --radius-input: 8px;
  --sidebar-w: 264px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--motus-background); color: var(--motus-primary); font-family: var(--font-english); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--font-arabic); }
.num, td.n, .kpi-value, .mono { font-family: var(--font-english); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--motus-primary); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: none; box-shadow: var(--motus-focus-ring); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100%; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); background: var(--motus-deep); color: #fff; display: flex; flex-direction: column; z-index: 40; padding-top: env(safe-area-inset-top, 0px); padding-inline-start: env(safe-area-inset-left, 0px); transition: transform .2s ease; }
html[dir="rtl"] .sidebar { padding-inline-start: env(safe-area-inset-right, 0px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; }
.brand svg { height: 28px; width: 132px; }
.brand-tag { font-family: var(--font-english); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.55); padding: 0 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
/* the settings, pinned at the sidebar's foot: they stay in view while the 13 sections scroll above them */
.nav.nav-foot { flex: none; overflow-y: auto; max-height: 45%; padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255,255,255,.1); }
.nav.nav-foot:empty { display: none; }
.nav-group { margin-top: 14px; }
.nav-group-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; color: rgba(255,255,255,.45); padding: 0 12px 6px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: rgba(255,255,255,.72); text-decoration: none; font-size: 14px; font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active, .nav .nav-sec-link.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.nav a.active svg { opacity: 1; }
.nav .count { margin-inline-start: auto; font-family: var(--font-english); font-size: 11px; background: rgba(255,255,255,.14); padding: 0 7px; border-radius: 10px; }
.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--motus-white); border-bottom: 1px solid var(--motus-border); display: flex; align-items: center; gap: 10px; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; height: 38px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding-inline: 36px 12px; background: var(--motus-background); }
.topbar .search svg { position: absolute; inset-inline-start: 11px; top: 10px; width: 18px; height: 18px; color: var(--motus-text-secondary); }
.search-results { position: absolute; top: 44px; inset-inline: 0; background: #fff; border: 1px solid var(--motus-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(6,29,56,.14); max-height: 360px; overflow: auto; z-index: 50; }
.search-results a { display: flex; gap: 8px; padding: 9px 12px; text-decoration: none; border-bottom: 1px solid var(--motus-border); }
.search-results a:hover { background: var(--motus-hover); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--motus-border); background: #fff; border-radius: var(--radius-button); cursor: pointer; position: relative; color: var(--motus-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--motus-hover); }
.icon-btn .dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--motus-danger); color: #fff; font-size: 11px; font-family: var(--font-english); display: grid; place-items: center; }
.menu-btn { display: none; }
.select { height: 38px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); background: #fff; padding-inline: 10px 28px; max-width: 220px; }
.lang-switch { display: inline-flex; border: 1px solid var(--motus-border); border-radius: var(--radius-button); overflow: hidden; height: 38px; }
.lang-switch button { border: 0; background: #fff; padding: 0 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.lang-switch button.on { background: var(--motus-primary); color: #fff; }
.lang-switch button:first-child { font-family: var(--font-arabic); }
.demo-banner { background: var(--motus-info-bg); color: var(--motus-primary); font-size: 12.5px; padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--motus-border); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.content { padding-block: 22px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1480px; width: 100%; }
@media (min-width: 900px) { .content { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); } }
.scrim { display: none; }
@media (max-width: 1100px) {
  :root { --sidebar-w: 248px; }
  .sidebar { transform: translateX(-100%); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(6,29,56,.4); z-index: 35; }
  .main { margin-inline-start: 0; }
  .menu-btn { display: inline-grid; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .topbar .search { order: 9; max-width: none; flex-basis: 100%; }
  .hide-sm { display: none !important; }
  #company-switch { max-width: 150px; }
}

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div { min-width: 0; max-width: 100%; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 1.25; }
.page-head .sub { color: var(--motus-text-secondary); font-size: 13px; margin-top: 4px; max-width: 70ch; }
.crumbs { font-size: 12.5px; color: var(--motus-text-secondary); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--motus-text-secondary); text-decoration: none; }
.crumbs a:hover { color: var(--motus-primary); text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius-button); border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.secondary:hover { background: var(--motus-hover); border-color: var(--navy); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--motus-primary); }
.btn.ghost:hover { background: var(--motus-hover); border-color: transparent; }
.btn.danger { background: #fff; border-color: var(--motus-danger); color: var(--motus-danger); }
.btn.danger:hover { background: var(--motus-danger-bg); border-color: var(--motus-danger); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.loading { pointer-events: none; opacity: .7; }

.grid { display: grid; gap: 16px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 14px 16px; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--motus-text-secondary); font-weight: 500; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 4px; line-height: 1.25; overflow-wrap: anywhere; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--motus-text-secondary); margin-inline-start: 4px; }
.kpi-foot .progress { flex: 1; min-width: 60px; }
.kpi-foot { font-size: 12px; color: var(--motus-text-secondary); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta-up { color: var(--motus-success); font-weight: 600; } .delta-down { color: var(--motus-danger); font-weight: 600; }
.cols-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2-1 { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .cols-2, .cols-3, .cols-2-1 { grid-template-columns: minmax(0, 1fr); } }
.card { background: #fff; border: 1px solid var(--motus-border); border-radius: var(--radius-card); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 600; }
.card-head .hint { font-size: 12px; color: var(--motus-text-secondary); }
.card-body { padding: 4px 16px 16px; }
.card-body.flush { padding: 0; }
.section-title { font-size: 18px; font-weight: 600; margin: 26px 0 12px; }
.muted { color: var(--motus-text-secondary); }
.small { font-size: 12.5px; }
.sep { height: 1px; background: var(--motus-border); margin: 12px 0; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; } .chart-box.short { height: 200px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dt th { position: sticky; top: 0; background: #fff; text-align: start; font-weight: 600; font-size: 12.5px; color: var(--motus-text-secondary); padding: 10px 12px; border-bottom: 1px solid var(--motus-border); white-space: nowrap; cursor: default; user-select: none; }
.dt th.sortable { cursor: pointer; }
.dt th.sortable:hover { color: var(--motus-primary); }
.dt th .arrow { font-size: 10px; margin-inline-start: 4px; }
.dt td { padding: 10px 12px; border-bottom: 1px solid var(--motus-border); vertical-align: middle; }
.dt td.n, .dt th.n { text-align: end; white-space: nowrap; }
.dt tbody tr:hover { background: var(--motus-hover); }
.dt tbody tr.selected, .dt tbody tr[aria-selected="true"] { background: var(--primary-soft); }
.dt tbody tr.click { cursor: pointer; }
.dt tfoot td { font-weight: 700; background: var(--motus-background); }
.dt .neg { color: var(--motus-danger); } .dt .pos { color: var(--motus-success); }
.num.neg, .loss { color: var(--motus-danger); } .loss { font-weight: 600; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--motus-text-secondary); }
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--motus-border); }
.table-tools input[type=search] { height: 34px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 10px; min-width: 0; flex: 1 1 200px; max-width: 320px; }
.table-tools select { height: 34px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 8px; background: #fff; max-width: 200px; }
/* a filter on is marked (27/11), so a short list is not taken for missing data */
.table-tools select:has(option:checked:not([value=""])) { border-color: var(--navy); background: var(--motus-hover); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; font-size: 12.5px; color: var(--motus-text-secondary); flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }
.empty { padding: 38px 16px; text-align: center; color: var(--motus-text-secondary); }
.empty svg { width: 36px; height: 36px; color: var(--motus-chart-4); }
.empty strong { display: block; color: var(--motus-primary); margin: 6px 0 2px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--motus-info-bg); color: var(--motus-primary); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.success { background: var(--motus-success-bg); color: var(--motus-success); }
.badge.warning { background: var(--motus-warning-bg); color: var(--motus-warning); }
.badge.warning::before { content: "!"; display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; background: var(--motus-warning); color: #fff; font-size: 10px; font-weight: 800; line-height: 1; flex: none; }
.badge.danger { background: var(--motus-danger-bg); color: var(--motus-danger); }
.badge.muted { background: #F1F3F6; color: var(--motus-text-secondary); }
.badge.outline { background: #fff; border: 1px solid var(--motus-border); }
.tag-ai { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; border: 1px dashed var(--motus-chart-3); color: var(--motus-chart-2); background: #fff; }
.tag-est { display: inline-flex; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--motus-warning-bg); color: var(--motus-warning); }
.tag-ok { display: inline-flex; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--motus-success-bg); color: var(--motus-success); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--motus-border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--motus-text-secondary); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--on-primary); background: var(--primary); border-bottom-color: var(--primary); border-radius: 8px 8px 0 0; }
.tabs button:hover { color: var(--motus-primary); }
.seg { display: inline-flex; border: 1px solid var(--motus-border); border-radius: var(--radius-button); overflow-x: auto; background: #fff; max-width: 100%; scrollbar-width: none; }
.seg button { white-space: nowrap; flex: none; border: 0; background: none; padding: 0 12px; height: 34px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--motus-text-secondary); }
.seg button.on { background: var(--motus-primary); color: #fff; }

/* ---------- detail lists ---------- */
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 0; font-size: 13.5px; }
.dl dt { color: var(--motus-text-secondary); padding: 8px 0; border-bottom: 1px solid var(--motus-border); }
.dl dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--motus-border); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.progress { height: 8px; background: #E8EDF3; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--motus-primary); border-radius: 4px; }
.progress.warn > i { background: var(--motus-warning); } .progress.bad > i { background: var(--motus-danger); } .progress.good > i { background: var(--motus-success); }

/* ---------- side sheet & modal ---------- */
.sheet-scrim, .modal-scrim { position: fixed; inset: 0; background: rgba(6,29,56,.38); z-index: 60; }
.sheet { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%); background: #fff; z-index: 61; display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(6,29,56,.18); padding-top: env(safe-area-inset-top, 0px); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 12px; border-bottom: 1px solid var(--motus-border); }
.sheet-head h2 { font-size: 18px; font-weight: 700; }
.sheet-body { flex: 1; overflow: auto; padding: 16px 20px 28px; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100% - 32px)); max-height: calc(100% - 48px); background: #fff; border-radius: var(--radius-card); z-index: 61; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(6,29,56,.25); }
.modal .sheet-body { padding-bottom: 20px; }
/* مراجعة التصميم 27/11: a long form opens wide (U.formModal, more than 12 fields), three columns from 900px */
.modal.wide { width: min(960px, calc(100% - 32px)); }
@media (min-width: 900px) { .modal.wide .form { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--motus-border); flex-wrap: wrap; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 50%; transform: translateX(-50%); background: var(--motus-deep); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 80; font-weight: 500; box-shadow: 0 10px 30px rgba(6,29,56,.3); max-width: calc(100% - 32px); }
html[dir="rtl"] .toast { transform: translateX(50%); }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form { grid-template-columns: minmax(0, 1fr); } }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; height: 38px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 10px; background: #fff; }
.field textarea { height: auto; min-height: 76px; padding: 8px 10px; }
.field input:focus, .field select:focus, .field textarea:focus, .table-tools input:focus, .topbar input:focus { border-color: var(--motus-primary); box-shadow: var(--motus-focus-ring); outline: none; }
.field .help { font-size: 12px; color: var(--motus-text-secondary); margin-top: 4px; }
.field.err input, .field.err select { border-color: var(--motus-danger); }
.field .msg { font-size: 12px; color: var(--motus-danger); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; }
.check[hidden] { display: none; }   /* MOT-286 (D3 #236): a hidden setting value stays on the page, out of sight */
.check input { width: 16px; height: 16px; accent-color: var(--motus-primary); }

/* ---------- misc components ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--motus-border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .s { font-size: 12px; color: var(--motus-text-secondary); }
.sev { width: 4px; align-self: stretch; border-radius: 2px; background: var(--motus-chart-4); flex: none; }
.sev.high { background: var(--motus-danger); } .sev.medium { background: var(--motus-warning); }
.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chain .node { border: 1px solid var(--motus-border); border-radius: 8px; padding: 8px 12px; background: #fff; min-width: 120px; }
.chain .node small { display: block; color: var(--motus-text-secondary); font-size: 11.5px; }
.chain .node a { font-weight: 600; text-decoration: none; }
.chain .arrow { color: var(--motus-chart-4); }
html[dir="rtl"] .flip { transform: scaleX(-1); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.vehicle-card { padding: 14px 16px; display: grid; gap: 10px; cursor: pointer; text-decoration: none; color: inherit; }
.vehicle-card:hover { border-color: var(--motus-chart-3); }
.vc-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.vc-plate { font-weight: 700; font-size: 16px; }
.vc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 12px; }
.vc-stats b { display: block; font-size: 14px; font-family: var(--font-english); font-variant-numeric: tabular-nums; }
.cards-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* dispatch board */
.board { overflow-x: auto; border-top: 1px solid var(--motus-border); }
.board-inner { min-width: 1180px; }
.board-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--motus-border); min-height: 46px; }
.board-label { padding: 7px 12px; border-inline-end: 1px solid var(--motus-border); font-size: 12.5px; background: #fff; }
.board-label b { display: block; font-size: 13px; }
.board-lane { position: relative; background-image: linear-gradient(to right, var(--motus-border) 1px, transparent 1px); background-size: calc(100% / 24) 100%; }
html[dir="rtl"] .board-lane { background-image: linear-gradient(to left, var(--motus-border) 1px, transparent 1px); }
.board-lane.drop-ok { background-color: var(--motus-success-bg); } .board-lane.drop-bad { background-color: var(--motus-danger-bg); }
.board-block { text-decoration: none; position: absolute; top: 6px; bottom: 6px; border-radius: 6px; background: var(--motus-primary); color: #fff; font-size: 11.5px; padding: 3px 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.board-block.done { background: var(--motus-chart-4); color: var(--motus-deep); }
.board-block.running { background: var(--motus-chart-2); }
/* a trip subcontracted to a supplier (migration 073): its own colour on the board and its badge */
.board-block.sub { background: #0F766E; color: #fff; border: 1px dashed #fff; }
.board-block.sub.done { background: #99D5CE; color: #0B3F3A; }
.board-sub-head .board-label { color: #0F766E; }
.legend-inline i.legend-sub { background: #0F766E; }
.badge.sub { background: #E6F4F2; color: #0F766E; }
.board-block.maint { background: repeating-linear-gradient(45deg, var(--motus-warning-bg), var(--motus-warning-bg) 6px, #fff 6px, #fff 12px); color: var(--motus-warning); border: 1px solid var(--motus-warning); }
.board-hours { display: grid; grid-template-columns: 190px 1fr; font-size: 11px; color: var(--motus-text-secondary); border-bottom: 1px solid var(--motus-border); position: sticky; top: 0; background: #fff; z-index: 2; }
.board-hours .h { display: grid; grid-template-columns: repeat(24, 1fr); }
/* MOT-283: the board and the unassigned bookings in full screen */
body.board-full .sidebar, body.board-full .topbar { display: none; }
body.board-full .main { margin-inline-start: 0; }
body.board-full .board { max-height: calc(100vh - 220px); overflow: auto; }
.board-hours .h span { padding: 4px; border-inline-start: 1px solid var(--motus-border); font-family: var(--font-english); }
.unassigned { display: grid; gap: 8px; }
.ua-card { border: 1px dashed var(--motus-chart-3); border-radius: 8px; padding: 10px; background: #fff; cursor: grab; font-size: 12.5px; }
.ua-card:active { cursor: grabbing; }
.ua-card.picked { border-style: solid; border-color: var(--motus-primary); box-shadow: var(--motus-focus-ring); }
.ua-card b { font-size: 13px; }

/* calendar */
.cal { overflow-x: auto; }
.cal table { border-collapse: collapse; min-width: 900px; width: 100%; font-size: 12px; }
.cal th, .cal td { border: 1px solid var(--motus-border); padding: 4px; text-align: center; }
.cal th { background: #fff; font-weight: 600; color: var(--motus-text-secondary); position: sticky; top: 0; }
.cal td.lbl { text-align: start; white-space: nowrap; background: #fff; font-weight: 600; position: sticky; inset-inline-start: 0; }
.cal .cell { display: block; border-radius: 4px; padding: 2px 4px; font-family: var(--font-english); }
.cal .c1 { background: var(--motus-chart-5); } .cal .c2 { background: var(--motus-chart-4); } .cal .c3 { background: var(--motus-chart-2); color: #fff; }
.cal .csub { background: #0F766E; color: #fff; }
.cal .cm { background: var(--motus-warning-bg); color: var(--motus-warning); }
.cal .today { outline: 2px solid var(--motus-primary); outline-offset: -2px; }

/* map */
.map-wrap { position: relative; background: #E9EEF4; border-radius: 0 0 var(--radius-card) var(--radius-card); overflow: hidden; }
.map-wrap svg { display: block; width: 100%; height: auto; }
.map-legend { position: absolute; top: 10px; inset-inline-start: 10px; background: #fff; border: 1px solid var(--motus-border); border-radius: 8px; padding: 6px 10px; font-size: 12px; display: grid; gap: 3px; }
.lg { display: inline-flex; align-items: center; gap: 6px; } .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* tire map */
.tire-map { display: grid; place-items: center; padding: 10px; }
.tire-map svg { width: 100%; max-width: 280px; height: auto; }

/* chat */
.chat { display: flex; flex-direction: column; height: min(72vh, 760px); }
.chat-log { flex: 1; overflow: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.msg { max-width: 860px; }
.msg.user { justify-self: end; background: var(--motus-primary); color: #fff; border-radius: 12px; padding: 10px 14px; max-width: 70%; }
.msg.ai { background: #fff; border: 1px solid var(--motus-border); border-radius: 12px; padding: 12px 14px; }
.msg.ai .meta { font-size: 12px; color: var(--motus-text-secondary); margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--motus-border); }
.chat-input input { flex: 1; min-width: 0; height: 42px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 12px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 12px; }
.suggest button { border: 1px solid var(--motus-border); background: #fff; border-radius: 16px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.suggest button:hover { background: var(--motus-hover); }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--motus-chart-3); animation: blink 1s infinite; } .typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

/* print sheet (trip order) */
.doc-sheet { background: #fff; border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 24px; max-width: 820px; }
.doc-sheet .doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--motus-primary); padding-bottom: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.qr { width: 96px; height: 96px; }
.score { font-family: var(--font-english); font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 6px; }
.score.g { background: var(--motus-success-bg); color: var(--motus-success); } .score.w { background: var(--motus-warning-bg); color: var(--motus-warning); } .score.b { background: var(--motus-danger-bg); color: var(--motus-danger); }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--motus-background); border: 1px solid var(--motus-border); border-radius: 6px; padding: 1px 6px; direction: ltr; unicode-bidi: isolate; }
pre.code { display: block; padding: 12px; overflow: auto; white-space: pre; max-height: 360px; text-align: left; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--motus-text-secondary); }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }
.report-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.report-item { text-align: start; border: 1px solid var(--motus-border); background: #fff; border-radius: 10px; padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; }
.report-item:hover { border-color: var(--motus-chart-3); background: var(--motus-hover); }
.report-item b { font-size: 13.5px; } .report-item span { font-size: 12px; color: var(--motus-text-secondary); }
.heat td { text-align: center; font-family: var(--font-english); font-size: 12px; padding: 8px 6px; border: 2px solid #fff; border-radius: 4px; }

/* phone overrides (kept last so they win the cascade) */
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi-value { font-size: 19px; }
  .page-head h1 { font-size: 22px; }
  .chat { height: 70vh; }
  .msg.user { max-width: 85%; }
}

/* ---------- sign-in / password screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--motus-background); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 28px 28px 20px; box-shadow: 0 8px 30px rgba(8, 38, 74, .08); }
.auth-card h1 { font-size: 20px; margin: 18px 0 14px; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.auth-brand svg { height: 34px; width: auto; }
.brand-tag.dark { color: var(--motus-text-secondary); padding: 0; border: 0; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--motus-border); display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--motus-text-secondary); font-size: 12.5px; }
.lang-switch.light { display: inline-flex; border: 1px solid var(--motus-border); border-radius: 8px; overflow: hidden; }
.lang-switch.light button { background: #fff; color: var(--motus-primary); border: 0; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 12.5px; }
.lang-switch.light button.on, .lang-switch.light button[aria-pressed="true"], .lang-switch.light button.active { background: var(--motus-primary); color: #fff; }
.form.one { grid-template-columns: 1fr; }
.btn.block { width: 100%; justify-content: center; }
.btn.wait { pointer-events: none; opacity: .7; }
.form-error { display: flex; gap: 10px; align-items: flex-start; background: var(--motus-danger-bg); color: var(--motus-danger); border: 1px solid #F3C7C7; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 0 0 12px; }
.form-error svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.form-error.info { background: var(--motus-info-bg); color: var(--motus-primary); border-color: var(--motus-border); }
.toast.error { background: var(--motus-danger); }
.secret-row { display: flex; gap: 8px; align-items: center; background: var(--motus-hover); border: 1px solid var(--motus-border); border-radius: 8px; padding: 8px 10px; }
.secret-row code { flex: 1; overflow-wrap: anywhere; direction: ltr; text-align: left; font-size: 13px; user-select: all; }
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; max-height: 260px; overflow: auto; padding: 4px 0; }
.scope-grid .check { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
.prog-day { display: grid; grid-template-columns: 70px 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.prog-day select, .je-line select, .je-line input { height: 36px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 8px; background: #fff; font: inherit; min-width: 0; }
.pg-card { display: block; } .pg-card [hidden] { display: none !important; } .pg-card select, .pg-card input[type="time"], .pg-card input[type="number"] { height: 36px; width: 100%; border: 1px solid var(--motus-border); border-radius: var(--radius-input); padding: 0 8px; background: #fff; font: inherit; min-width: 0; }  /* MOT-281: the program day card */
.je-line { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
@media (max-width: 640px) { .prog-day { grid-template-columns: 1fr 1fr; } .je-line { grid-template-columns: 1fr 1fr; } .auth-card { padding: 22px 18px 16px; } }

/* ---------- printing ---------- */
@media print {
  .sidebar, .topbar, .scrim, .no-print, .toast, .tabbar { display: none !important; }
  body { background: #fff; }
  .main, main { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
@media print {
  body.print-doc * { visibility: hidden !important; }
  body.print-doc .doc-sheet, body.print-doc .doc-sheet * { visibility: visible !important; }
  body.print-doc .doc-sheet { position: absolute; inset-inline: 0; top: 0; width: 100%; box-shadow: none; border: 0; }
  body.print-doc .no-print { display: none !important; }
}

/* invitations from other companies (one Sabeel account, several companies) */
.banner-invites { display: flex; gap: 12px; align-items: flex-start; margin: 16px 24px 0; padding: 12px 14px; border: 1px solid var(--motus-border); border-radius: 10px; background: var(--motus-info-bg); color: var(--motus-primary); }
.banner-invites > svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.banner-invites > div { flex: 1; min-width: 0; }
.invites { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.invite { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--motus-border); border-radius: 8px; background: #fff; color: inherit; }
/* driver: my trips */
.my-trips { display: grid; gap: 12px; }
.my-trip { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.my-trip .route { font-size: 16px; font-weight: 700; }
/* contracts: vehicle picker */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 12px; max-height: 220px; overflow: auto; padding: 8px; border: 1px solid var(--motus-border); border-radius: 8px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
/* inside the MOTUS app: the app has its own navigation */
html.embed .sidebar, html.embed .topbar, html.embed .scrim { display: none !important; }
html.embed .main { margin-inline-start: 0 !important; }

/* ---------- help (docs/HELP.md) ---------- */
.help-btn { margin-inline-start: 8px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--motus-border); background: var(--motus-white); color: var(--motus-primary); font-weight: 800; font-size: 13px; cursor: pointer; vertical-align: middle; }
.help-btn:hover, .help-btn:focus-visible { background: var(--motus-hover); box-shadow: var(--motus-focus-ring); outline: none; }
.help-tip { position: absolute; z-index: 9999; max-width: 240px; background: var(--motus-primary); color: var(--motus-white); padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 20px rgba(8, 38, 74, .25); pointer-events: none; }
.help-tip .help-reason { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .25); color: #FDE68A; }
.help-wrap { display: inline-flex; }
.help-steps { margin: 8px 0; padding-inline-start: 22px; }
.help-steps li { margin: 4px 0; }
.help-steps li.help-shared { background: var(--motus-warning-bg); color: var(--motus-warning); border-radius: 6px; padding: 4px 8px; list-style-position: inside; }
.help-task { border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 10px 12px; margin: 8px 0; background: var(--motus-white); }
.help-task summary { cursor: pointer; font-weight: 700; }
.help-ask { display: flex; gap: 8px; margin: 8px 0; }
.help-ask .input { flex: 1; }
/* دليل الاستخدام (web/js/05d-guide.js) */
.guide-q { border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 10px 12px; margin: 8px 0; background: var(--motus-white); }
.guide-q summary { cursor: pointer; font-weight: 700; }
.guide-q .actions { margin-top: 8px; flex-wrap: wrap; }
.guide-video { display: block; width: 100%; max-height: 320px; margin: 8px 0; border-radius: 8px; background: #000; }
.guide-panel .guide-other, .guide-centre .guide-other { display: none; }
.guide-panel.all-roles .guide-other, .guide-centre.all-roles .guide-other { display: block; }
.guide-panel.all-roles .guide-none-mine { display: none; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guide-items dt { font-weight: 700; margin-top: 8px; }
.guide-items dd { margin: 2px 0 0; }
.guide-tips { margin: 8px 0; padding-inline-start: 20px; color: var(--motus-text-secondary); }
.guide-choose { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 8px 0; }
.guide-choose .on { box-shadow: var(--motus-focus-ring); }
.guide-window { border: 1px solid var(--motus-border); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; background: var(--motus-hover); }
.guide-window p { margin: 4px 0 0; }
.help-set { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.help-set-desc { margin: -2px 0 6px; padding-inline-start: 24px; }
.help-spot { position: relative; z-index: 9998; box-shadow: 0 0 0 4px var(--motus-white), 0 0 0 7px var(--motus-primary) !important; border-radius: 8px; }
.help-tour-card { position: fixed; z-index: 9999; inset-block-end: 24px; inset-inline-end: 24px; width: min(360px, calc(100vw - 48px)); background: var(--motus-white); border: 1px solid var(--motus-border); border-radius: var(--radius-card); padding: 14px 16px; box-shadow: 0 12px 32px rgba(8, 38, 74, .2); }
.help-tour-card p { margin: 6px 0 10px; color: var(--motus-text-secondary); }
.help-print { background: var(--motus-white); padding: 24px; max-width: 900px; margin: 0 auto; }
.help-print section { break-inside: avoid; border-bottom: 1px solid var(--motus-border); padding: 8px 0; }
@media print { .help-print h2 { break-before: page; } .help-print h2:first-of-type { break-before: auto; } }
.help-hl { position: relative; z-index: 9997; box-shadow: 0 0 0 3px var(--motus-white), 0 0 0 6px #14B8A6 !important; border-radius: 8px; transition: box-shadow .2s; }

/* the Sabeel team's read-only support session (lib/support.js) */
.support-band { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; background: #C62828; color: #fff; font-size: 14px; padding: 6px 12px; }
.support-band .btn { height: 28px; background: #fff; color: #C62828; border-color: #fff; }

/* account setup (13c-views-setup.js) */
.banner-setup { display: flex; gap: 12px; align-items: center; margin: 16px 24px 0; padding: 12px 14px; border: 1px solid var(--motus-border); border-radius: 10px; background: var(--motus-warning-bg); color: var(--motus-warning); }
.banner-setup > svg { width: 20px; height: 20px; flex: none; }
.banner-setup > div { flex: 1; min-width: 0; }
/* MOT-309: the trial countdown (web/js/13h-trial.js) */
.banner-trial { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 24px 0; padding: 12px 14px; border: 1px solid var(--motus-border); border-radius: 10px; background: var(--motus-info-bg); color: var(--motus-info); }
.banner-trial.soon { background: var(--motus-warning-bg); color: var(--motus-warning); }
.banner-trial.ended { background: var(--motus-danger-bg); color: var(--motus-danger); }
.banner-trial > svg { width: 20px; height: 20px; flex: none; }
.banner-trial > .trial-text, .banner-trial.ended > div { flex: 1; min-width: 180px; }
.banner-trial .trial-count { display: flex; gap: 6px; }
.banner-trial .trial-unit { display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 4px 8px; border-radius: 8px; background: var(--motus-white); color: inherit; line-height: 1.2; }
.banner-trial .trial-unit b { font-size: 18px; }
.banner-trial .trial-unit small { font-size: 11px; opacity: .85; }
@media (max-width: 640px) { .banner-trial { margin: 12px 16px 0; } .banner-trial .trial-count { width: 100%; justify-content: center; } }
.setup-mode .sidebar, .setup-mode .menu-btn, .setup-mode .search { display: none; }
.setup-mode .main { margin-inline-start: 0; }
.setup-mode .content { max-width: 960px; margin-inline: auto; }
.setup-step .setup-body { margin-top: 10px; }
.setup-branches { display: grid; gap: 8px; }
.setup-branch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.setup-branch b { min-width: 140px; }
.setup-branch input { width: 140px; }

/* ---------- the menu of 13 sections, the top bar filters, the AI page, the subscription page (17/11, docs/UI-SHELL.md) ---------- */
.tabs button.on:hover { color: var(--on-primary); }
.nav-sec { margin-top: 2px; }
.nav-sec-btn, .nav .nav-sec-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; border: 0; background: none; color: rgba(255,255,255,.78); font: inherit; font-size: 14px; font-weight: 600; text-align: start; cursor: pointer; text-decoration: none; }
.nav-sec-btn svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-sec-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-sec.here > .nav-sec-btn { color: #fff; }
.nav-sec-btn .chev { margin-inline-start: auto; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); opacity: .6; flex: none; }
html[dir="rtl"] .nav-sec-btn .chev { transform: rotate(135deg); }
.nav-sec-btn .count + .chev { margin-inline-start: 8px; }
.nav-sec.open > .nav-sec-btn .chev, html[dir="rtl"] .nav-sec.open > .nav-sec-btn .chev { transform: rotate(45deg); margin-top: -4px; }
.nav-sub { padding: 2px 0 6px; }
.nav .nav-sub a { padding-block: 7px; padding-inline: 40px 12px; font-size: 13.5px; }
.nav .count { margin-inline-start: auto; }
.nav a.active .count { background: rgba(11,31,51,.14); }
.icon-btn.bell.active { border-color: var(--navy); background: var(--motus-hover); }
.scope { display: flex; gap: 6px; }
.scope .select { height: 38px; max-width: 170px; border: 1px solid var(--motus-border); border-radius: var(--radius-input); background: #fff; padding: 0 8px; }
.ai-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ai-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: #fff; border: 1px solid var(--motus-border); border-radius: var(--radius-card); text-decoration: none; color: var(--navy); }
.ai-card:hover { border-color: var(--navy); box-shadow: 0 6px 18px rgba(6,29,56,.08); }
.ai-card > svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.ai-card b { font-size: 15px; }
.ai-card span:not(.badge) { display: block; color: var(--text-2); font-size: 13px; margin-top: 4px; }
.ai-card.sia { border-color: var(--sia, #00B4A6); }
.ai-card > .sia-av { flex: none; width: 40px; height: 40px; }
.overrun { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px; background: var(--motus-danger-bg); color: var(--motus-danger); border: 1px solid var(--motus-danger); }
.overrun svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.units-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.units-big { font-size: 28px; font-weight: 800; color: var(--navy); }
@media (max-width: 1100px) { .scope { display: none; } .scope.on { display: flex; } .scope.on .select { max-width: 120px; } }
/* a filter on (27/11): the chosen select is marked, so short lists are not taken for missing data */
.scope.on .select:has(option:checked:not([value=""])) { border-color: var(--navy); background: var(--motus-hover); font-weight: 600; }

/* ---------- the settings page of 16 sections (13e-views-settings16.js, docs/SETTINGS.md) ---------- */
.set-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.set-menu { position: sticky; top: 76px; }
.set-menu input[type=search] { width: 100%; margin-bottom: 10px; }
.set-menu nav { display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 190px); overflow: auto; }
.set-menu nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; text-decoration: none; font-size: 13.5px; }
.set-menu nav a svg { width: 16px; height: 16px; flex: none; }
.set-menu nav a:hover { background: var(--motus-background); }
.set-menu nav a.on { background: var(--motus-primary); color: #fff; }
.set-main > .card, .set-main #set-box > .card, .set-main #set-box > .set-level { margin-bottom: 16px; }
.set-rows { display: flex; flex-direction: column; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 20px; padding: 12px 0; border-bottom: 1px solid var(--motus-border); align-items: start; }
.set-row:last-child { border-bottom: 0; }
.set-row.wide { grid-template-columns: minmax(0, 1fr); }
.set-label label { font-weight: 600; }
.set-label .help { font-size: 12.5px; opacity: .75; margin-top: 2px; }
.set-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.set-input input:not([type=checkbox]), .set-input select, .set-input textarea { max-width: 100%; }
.set-input textarea { width: 100%; }
.set-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.set-logo { display: block; max-width: 160px; max-height: 80px; margin-bottom: 8px; border: 1px solid var(--motus-border); border-radius: 8px; padding: 4px; background: #fff; }
.set-embed .page-head h1 { font-size: 18px; }
@media (max-width: 900px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-menu { position: static; }
  .set-menu nav { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .set-row { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- security (13g-views-security.js, migration 055): two-step setup, recovery codes, the scope picker ---------- */
.tf-enrol { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.tf-qr .qr { width: 180px; height: 180px; border: 1px solid var(--motus-border); border-radius: 8px; }
.tf-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 10px 0; }
.tf-codes code { font-size: 15px; letter-spacing: .5px; }
.scope-box select[multiple] { width: 100%; min-height: 96px; }

/* ===== Sia, the one assistant (web/js/12b-sia.js, docs/SIA.md) =====
   Bottom, on the side away from the menu (bottom left in Arabic), 24px from the edges, 56px. Her colours are hers (SIA tokens),
   not the amber. While she is shown the page keeps 96px under its content, so the last table's «السابق / التالي» scrolls clear of her. */
:root { --sia: #00B4A6; --sia-2: #2EC27E; --sia-face: #F4F8FA; --sia-hero: #F5FCF9; }
body.has-sia .content { padding-bottom: 96px; }
.sia-fab { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); inset-inline-end: calc(24px + env(safe-area-inset-right, 0px)); z-index: 45; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 4px 14px 4px 4px; background: #fff; color: var(--navy); border: 2px solid var(--sia); border-radius: 99px; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(6,29,56,.18); }
[dir="rtl"] .sia-fab { padding: 4px 4px 4px 14px; }
.sia-fab:hover, .sia-fab.on, .sia-fab:focus-visible { border-color: var(--sia-2); outline: none; box-shadow: 0 8px 24px rgba(6,29,56,.18), 0 0 0 3px rgba(0,180,166,.25); }
.sia-av { display: block; border-radius: 50%; object-fit: cover; background: var(--sia-face); }
.sia-fab .sia-av { width: 48px; height: 48px; }
.sia-bubble { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 24px; z-index: 45; max-width: 260px; background: #fff; color: var(--navy); border: 1px solid var(--sia); border-radius: 14px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(6,29,56,.16); cursor: pointer; }
.sia-panel { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 24px; z-index: 46; width: min(420px, calc(100vw - 24px)); height: min(620px, calc(100vh - 120px)); background: #fff; border-radius: 18px; box-shadow: 0 16px 48px rgba(6,29,56,.25); display: flex; flex-direction: column; overflow: hidden; }
.sia-panel[hidden], .sia-bubble[hidden], .sia-suggest[hidden] { display: none; }
.sia-panel header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--motus-deep); color: #fff; }
.sia-panel header .grow { flex: 1; min-width: 0; }
.sia-panel header small { display: block; color: rgba(255,255,255,.72); font-size: 12px; }
.sia-panel header .sia-av { box-shadow: 0 0 0 2px var(--sia); }
.sia-face.thinking .sia-av { animation: sia-think 1.2s ease-in-out infinite; }
@keyframes sia-think { 50% { transform: scale(.94); opacity: .8; } }
.sia-ico { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 10px; background: transparent; color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.25); border-radius: 8px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; }
.sia-ico:hover, .sia-ico:focus-visible { color: #fff; border-color: var(--sia); outline: none; }
.sia-ico svg { width: 16px; height: 16px; }
.sia-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--motus-bg, #F6F8FB); }
.sia-msg { max-width: 92%; min-width: 0; padding: 9px 12px; border-radius: 14px; line-height: 1.65; font-size: 13.5px; overflow-wrap: anywhere; }
.sia-msg.user { align-self: flex-start; background: var(--motus-deep); color: #fff; border-start-start-radius: 4px; }
.sia-msg.ai { align-self: flex-end; background: #fff; border: 1px solid var(--motus-border); border-start-end-radius: 4px; color: var(--navy); }
.sia-msg.err { align-self: center; background: #FDECEC; color: #B42318; }
.sia-msg .table-wrap { max-width: 100%; overflow-x: auto; }
.sia-msg .meta { margin-top: 6px; font-size: 11.5px; color: var(--motus-text-secondary); display: flex; flex-wrap: wrap; gap: 4px; }
.sia-hero { align-self: center; height: auto; max-width: 100%; border-radius: 16px; background: var(--sia-hero); }
.sia-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; max-height: 120px; overflow-y: auto; }
.sia-suggest button { border: 1px solid var(--sia); background: #fff; color: var(--navy); border-radius: 99px; padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.sia-suggest button:hover, .sia-suggest button:focus-visible { background: var(--sia-hero); outline: none; }
.sia-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--motus-border); }
.sia-form input { flex: 1; min-width: 0; }
.sia-mic { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 38px; background: #fff; color: var(--navy); border: 1px solid var(--motus-border); border-radius: 8px; cursor: pointer; }
.sia-mic:hover, .sia-mic:focus-visible { border-color: var(--sia); outline: none; }
.sia-mic.rec { background: #B42318; border-color: #B42318; color: #fff; }
.sia-msg .help-task, .sia-msg .guide-card { margin: 6px 0 0; }
.sia-msg .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* help.sia.position = start (MOT-148): the same corner on the other side */
#sia-root.sia-start .sia-fab { inset-inline-end: auto; inset-inline-start: calc(24px + env(safe-area-inset-left, 0px)); }
#sia-root.sia-start .sia-bubble, #sia-root.sia-start .sia-panel { inset-inline-end: auto; inset-inline-start: 24px; }
@media (max-width: 480px) { #sia-root.sia-start .sia-panel { inset-inline-start: 12px; } }
@media (max-width: 480px) { .sia-fab span { display: none; } .sia-fab, [dir="rtl"] .sia-fab { padding: 4px; } .sia-fab .sia-av { width: 44px; height: 44px; } .sia-panel { inset-inline-end: 12px; } }
@media (prefers-reduced-motion: reduce) { .sia-face.thinking .sia-av { animation: none; } }
@media print { #sia-root { display: none; } }

/* ===== search on every list (05-ui.js U.matches, 05e-list-search.js) ===== */
.list-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.list-search input { flex: 1 1 220px; max-width: 360px; min-width: 0; }
.list-row[hidden], .cards-grid > [hidden], table.dt tr[hidden] { display: none !important; }
.kpi[role="button"] { cursor: pointer; }
.kpi[role="button"]:hover, .kpi[role="button"]:focus-visible { border-color: var(--navy); outline: none; box-shadow: var(--motus-focus-ring); }
.kpi[aria-pressed="true"] { border-color: var(--navy); box-shadow: inset 0 -3px 0 var(--navy); }
.filter-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; font-size: 13.5px; }

/* ---------- the other Sabeel systems (05f-systems.js; 19-مرجع-الشكل.md, MOT-106 and MOT-107) ---------- */
.help-tip .help-tip-title { font-weight: 700; }
.sys-slot { display: contents; }
.sys-switch { display: inline-flex; align-items: center; gap: 6px; }
.sys-btn { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 10px; border: 1px solid var(--motus-border); border-radius: 9px; background: #fff; color: var(--motus-primary); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; user-select: none; }
.sys-btn:hover { background: var(--motus-hover); }
.sys-btn.compact { padding: 0 7px; }
.sys-btn[aria-pressed="true"] { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(8, 38, 74, .15), inset 0 -2px 0 var(--navy); }
.sys-ico { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; border-radius: 6px; font-family: var(--font-english); font-size: 10px; font-weight: 800; line-height: 1; box-sizing: border-box; }
.sys-ico.lg { width: 24px; height: 24px; font-size: 12px; }
.sys-sep { width: 1px; height: 24px; background: var(--motus-border); flex: none; }
@media (max-width: 1100px) { .sys-btn:not(.compact) .sys-name { display: none; } .sys-btn { padding: 0 7px; } }
/* split mode: MOTUS on the start side, the other system in a frame beside it (no split under 1200px: 05f-systems.js) */
.split-pane { position: fixed; inset-block: 0; inset-inline-end: 0; width: 50vw; z-index: 45; display: flex; flex-direction: column; background: #fff; border-inline-start: 1px solid var(--motus-border); }
.split-bar { height: 46px; flex: none; display: flex; align-items: center; gap: 10px; padding-inline: 12px; color: #fff; }
.split-names { display: flex; flex-direction: column; min-width: 0; margin-inline-end: auto; line-height: 1.2; }
.split-names strong { font-size: 14px; }
.split-names small { font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.split-btn { height: 28px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 7px; background: transparent; color: #fff; font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.split-btn:hover { background: rgba(255, 255, 255, .12); }
.split-frame { flex: 1; width: 100%; border: 0; }
body.split { --sidebar-w: 68px; }
body.split #app-root { width: 50vw; }
body.split .sidebar .brand-tag, body.split .sidebar .nav span, body.split .sidebar .nav .count, body.split .sidebar .nav .chev, body.split .sidebar .nav-sub { display: none; }
body.split .sidebar .nav a, body.split .sidebar .nav button { justify-content: center; }
body.split .topbar .search, body.split .top-actions > .badge, body.split .top-actions > #company-switch, body.split .scope { display: none; }
body.split .kpis, body.split .cards-grid, body.split .cols-3, body.split .report-list, body.split .ai-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.split table.dt .sec { display: none; }
body.split .page-head .actions .btn.secondary, body.split .page-head .actions .btn.ghost, body.split .table-tools .seg { display: none; }
/* مراجعة التصميم 27/11: letter-spacing pulls Arabic letters apart (they are joined), so none in Arabic */
html[lang="ar"] .nav-group-title { letter-spacing: 0; text-transform: none; }

/* MOT-269 (2): the new contract's five steps (Terms.dc.html) */
.kw-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; font-size: 14px; }
.kw-steps li { background: #fff; border: 1px solid var(--motus-border); color: var(--motus-text-secondary); border-radius: 8px; padding: 10px 12px; }
.kw-steps li.done { background: var(--motus-success-bg); border-color: transparent; color: var(--motus-success); }
.kw-steps li.on { background: var(--primary); border-color: transparent; color: var(--on-primary); font-weight: 600; }
.kw-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 760px) { .kw-steps { grid-template-columns: 1fr; } }

/* MOT-276: a table's period from / to, next to its filters */
.table-tools .tbl-range { display: inline-flex; align-items: center; gap: 6px; color: var(--motus-text-secondary); white-space: nowrap; }
.table-tools .tbl-range input[type="date"] { width: auto; }
