/* مُفوَّض — design tokens
   ink: chancery-ink navy · paper: cool court-form grey · violet: rubber-stamp ink · amber: deadlines */
:root {
  --ink: #16233A;
  --ink-2: #22344F;
  --ink-3: #3A4C69;
  --paper: #ECEEEA;
  --card: #FBFBF9;
  --line: #D6DAD3;
  --line-2: #E4E7E1;
  --text: #1D2430;
  --muted: #687180;
  --violet: #5B3FA0;
  --violet-2: #7458BD;
  --violet-soft: #ECE7F6;
  --amber: #C98612;
  --amber-soft: #FBF1DC;
  --green: #2F7A5B;
  --green-soft: #E2F0E9;
  --red: #B4372E;
  --red-soft: #F8E4E1;

  --f-display: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
  --f-body: "IBM Plex Sans Arabic", Tahoma, sans-serif;

  --r-panel: 14px;
  --r-ctl: 9px;
  --rail-w: 252px;
  --float: 0 1px 0 rgba(22, 35, 58, .05), 0 18px 40px -18px rgba(22, 35, 58, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--f-body); font-size: 15px; line-height: 1.65; color: var(--text);
  background: var(--paper); font-variant-numeric: tabular-nums;
}
a { color: var(--violet); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 600; line-height: 1.3; margin: 0; color: var(--ink); }
:focus-visible { outline: 2.5px solid var(--violet-2); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- rail (sidebar) ---------- */
.rail {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--rail-w); z-index: 30;
  background-color: var(--ink); color: #C9D2E0; display: flex; flex-direction: column; padding: 18px 14px;
  /* guilloché — the security-print lines found on official paper */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.045' stroke-width='1'%3E%3Cpath d='M0 60 Q30 20 60 60 T120 60 T180 60 T240 60'/%3E%3Cpath d='M0 66 Q30 26 60 66 T120 66 T180 66 T240 66'/%3E%3Cpath d='M0 72 Q30 32 60 72 T120 72 T180 72 T240 72'/%3E%3Cpath d='M0 54 Q30 94 60 54 T120 54 T180 54 T240 54'/%3E%3Cpath d='M0 48 Q30 88 60 48 T120 48 T180 48 T240 48'/%3E%3C/g%3E%3C/svg%3E");
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 4px 6px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.brand-seal { width: 42px; height: 42px; color: #CBB8F2; flex: none; display: grid; place-items: center; }
.brand-seal svg { width: 100%; height: 100%; }
.brand-seal.sm { width: 32px; height: 32px; color: var(--violet); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-txt b { font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: .2px; }
.brand-txt small { color: #93A0B6; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.rail nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #C9D2E0; font-size: 14.5px;
  transition: background .2s, color .2s;
}
.rail nav a i { font-size: 21px; color: #8FA0BC; transition: color .2s; }
.rail nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.rail nav a.on { background: #fff; color: var(--ink); font-weight: 600; }
.rail nav a.on i { color: var(--violet); }
.rail-user { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.who b { color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: #93A0B6; font-size: 12px; }
.rail .icon-btn { color: #C9D2E0; }

/* ---------- main ---------- */
.main { margin-inline-start: var(--rail-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 32px; background: rgba(236, 238, 234, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.m-brand { display: none; }
.content { padding: 26px 32px 60px; max-width: 1280px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: 600 14.5px var(--f-body); padding: 10px 18px; border-radius: 10px; background: var(--ink); color: #fff;
  transition: transform .12s var(--ease), background .2s; white-space: nowrap; min-height: 42px;
}
.btn i { font-size: 19px; }
.btn:hover { background: var(--ink-2); }
.btn:active { transform: scale(.97); }
.btn-violet { background: var(--violet); } .btn-violet:hover { background: var(--violet-2); }
.btn-green { background: var(--green); } .btn-green:hover { background: #276a4e; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 1.5px #E6C1BC; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 21px; }
.icon-btn:hover { background: rgba(22,35,58,.07); }

/* ---------- chips & deadlines ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip-amber { background: var(--amber-soft); color: #8A5A07; }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.chip-ink { background: #E3E8F0; color: var(--ink-2); }
.chip-mute { background: #EAEBE7; color: var(--muted); }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.due i { font-size: 16px; }
.due-soon { color: #8A5A07; } .due-today { color: var(--amber); font-weight: 700; } .due-over { color: var(--red); font-weight: 700; }

/* ---------- panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel + .panel { margin-top: 18px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.panel-h h2 { font-size: 18px; display: flex; align-items: center; gap: 9px; }
.panel-h h2 i { color: var(--violet); font-size: 22px; }
.panel-b { padding: 18px 20px; }
.panel-flush .panel-b { padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .panel + .panel, .stack > .panel + .panel { margin-top: 0; }
.stack { display: grid; gap: 18px; }

/* ---------- dashboard: today sheet ---------- */
.today {
  display: grid; grid-template-columns: 1.15fr repeat(3, 1fr); background: var(--ink); color: #fff; border-radius: 18px; overflow: hidden;
  margin-bottom: 20px; position: relative;
}
.today::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05'%3E%3Cpath d='M0 60 Q30 20 60 60 T120 60 T180 60 T240 60'/%3E%3Cpath d='M0 70 Q30 30 60 70 T120 70 T180 70 T240 70'/%3E%3Cpath d='M0 50 Q30 90 60 50 T120 50 T180 50 T240 50'/%3E%3C/g%3E%3C/svg%3E"); }
.today > div { padding: 22px 24px; position: relative; }
.today > div + div { border-inline-start: 1px solid rgba(255,255,255,.09); }
.today .greet h2 { color: #fff; font-size: 22px; margin-bottom: 4px; }
.today .greet p { margin: 0; color: #A9B5C9; font-size: 14px; }
.today .greet .btn { margin-top: 14px; background: #fff; color: var(--ink); }
.metric b { display: block; font-family: var(--f-display); font-size: 40px; line-height: 1.1; font-weight: 600; }
.metric span { color: #A9B5C9; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.metric span i { font-size: 18px; color: #CBB8F2; }
.metric.alert b { color: #F4C46A; }

/* deadline rail: a real timeline (days ahead) */
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 0; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: thin; }
.tl-day { padding: 0 14px 4px; border-inline-start: 1px dashed var(--line); min-height: 96px; }
.tl-day:first-child { border-inline-start: 0; }
.tl-day h4 { font-family: var(--f-body); font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.tl-day.is-today h4 { color: var(--amber); }
.tl-item { display: block; font-size: 13px; line-height: 1.45; padding: 6px 9px; border-radius: 8px; background: #F2F3EF; color: var(--text); margin-bottom: 6px; border-inline-start: 3px solid var(--ink-3); }
.tl-item.k-deadline { border-color: var(--amber); background: var(--amber-soft); }
.tl-item.k-expertise { border-color: var(--violet); background: var(--violet-soft); }
.tl-item.k-hearing { border-color: var(--ink); }
.tl-item.k-sale { border-color: var(--green); background: var(--green-soft); }

/* ---------- lists (dossier rows) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line-2); }
.rows li:last-child { border-bottom: 0; }
.rows .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; flex: none; background: #EEF0EC; color: var(--ink-2); }
.rows .ico.v { background: var(--violet-soft); color: var(--violet); }
.rows .ico.a { background: var(--amber-soft); color: var(--amber); }
.rows .ico.g { background: var(--green-soft); color: var(--green); }
.rows .body { flex: 1; min-width: 0; }
.rows .t { font-weight: 600; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .s { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.rows .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.rows a.row-link { position: absolute; inset: 0; }
.rows li.linked { position: relative; transition: background .15s; }
.rows li.linked:hover { background: #F4F5F1; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 13px; padding: 11px 16px; border-bottom: 1px solid var(--line); background: #F4F5F1; white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #F7F8F4; }
.tbl .num { text-align: end; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: #F4F5F1; border-top: 1.5px solid var(--line); }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; font: 15px var(--f-body); color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  padding: 10px 12px; min-height: 44px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus { outline: 0; border-color: var(--violet-2); box-shadow: 0 0 0 4px rgba(116, 88, 189, .15); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
fieldset.group { grid-column: 1 / -1; border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: inherit; gap: inherit; }
.section-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-family: var(--f-display); color: var(--ink); font-size: 16px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.section-label:first-child { border-top: 0; padding-top: 0; }
.section-label i { color: var(--violet); font-size: 20px; }
.seg { display: inline-flex; background: #E3E6E0; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--ink-2); transition: background .15s; }
.seg input:checked + span { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(22,35,58,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--violet-2); }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .input { width: auto; min-width: 180px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 19px; }
.search .input { padding-inline-start: 40px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: 14.5px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a i { font-size: 19px; }
.tabs a.on { color: var(--ink); border-color: var(--violet); }
.tabs a .n { background: #E3E6E0; border-radius: 999px; padding: 0 8px; font-size: 12px; }

/* ---------- facts (key/value) ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- empty, toast ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty i { font-size: 54px; color: #B9BFC9; }
.empty h3 { margin: 10px 0 4px; font-size: 18px; }
.empty p { margin: 0 auto 16px; max-width: 40ch; }
.toast {
  position: fixed; z-index: 80; top: 18px; inset-inline-end: 22px; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--float); font-weight: 500;
  animation: toast-in .45s var(--ease), toast-out .4s var(--ease) 4.2s forwards;
}
.toast i { font-size: 22px; color: #9FE0BF; }
.toast-err i { color: #F3A79F; }
@keyframes toast-in { from { transform: translateY(-14px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-14px); opacity: 0; visibility: hidden; } }

/* ---------- bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 70; background: rgba(15, 24, 40, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-card { background: var(--card); width: min(560px, 100%); border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); animation: sheet-up .32s var(--ease); max-height: 86vh; overflow: auto; }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: #CFD3CC; margin: 0 auto 14px; }
.sheet h3 { font-size: 18px; margin-bottom: 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 14px; background: #F1F2EE; color: var(--ink); font-weight: 600; font-size: 13.5px; text-align: center; }
.quick-grid a i { font-size: 30px; color: var(--violet); }
.more-list { display: grid; gap: 2px; }
.more-list a { display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--ink); border-radius: 10px; font-weight: 500; }
.more-list a:hover { background: #F1F2EE; }
.more-list a i { font-size: 22px; color: var(--violet); }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* modal (desktop centered, phone = sheet) */
.modal { position: fixed; inset: 0; z-index: 75; background: rgba(15, 24, 40, .5); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal-card { background: var(--card); border-radius: 18px; width: min(560px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--float); animation: pop .3s var(--ease); }
.modal-card .panel-h { position: sticky; top: 0; background: var(--card); z-index: 1; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* ---------- tabbar (phone) ---------- */
.tabbar { display: none; }

/* ---------- the stamp (signature moment) ---------- */
.stamp {
  --c: var(--violet);
  display: inline-grid; place-items: center; text-align: center; width: 168px; height: 168px; border-radius: 50%;
  border: 4px solid var(--c); color: var(--c); transform: rotate(-11deg); position: relative; padding: 14px;
  font-family: var(--f-display); line-height: 1.2;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.75'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 1.75'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1.5px solid var(--c); }
.stamp b { font-size: 25px; display: block; }
.stamp small { font-family: var(--f-body); font-size: 12px; font-weight: 600; display: block; margin-top: 4px; }
.stamp.green { --c: var(--green); }
.stamp.red { --c: var(--red); }
.stamp.sm { width: 104px; height: 104px; border-width: 3px; padding: 8px; }
.stamp.sm b { font-size: 16px; } .stamp.sm small { font-size: 10px; }
.stamp.thump { animation: thump .55s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes thump {
  0% { transform: rotate(-24deg) scale(2.3); opacity: 0; filter: blur(3px); }
  55% { transform: rotate(-9deg) scale(.9); opacity: 1; filter: blur(0); }
  75% { transform: rotate(-12deg) scale(1.04); }
  100% { transform: rotate(-11deg) scale(1); }
}
.stamp-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(236, 238, 234, .7); backdrop-filter: blur(2px); animation: fade .2s; }
.stamp-overlay.out { animation: fade .35s reverse forwards; }
.shake { animation: shake .3s .3s; }
@keyframes shake { 30% { transform: translateY(3px); } 60% { transform: translateY(-1px); } }

/* ---------- map ---------- */
.page-map .content { padding: 0; max-width: none; }
.map-wrap { position: relative; height: calc(100vh - 71px); }
#map { position: absolute; inset: 0; background: #DCE0D8; }
.map-side {
  position: absolute; z-index: 5; top: 16px; inset-inline-start: 16px; bottom: 16px; width: 370px; display: flex; flex-direction: column;
  background: var(--card); border-radius: 16px; box-shadow: var(--float); overflow: hidden;
}
.map-side .head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.map-side .head h2 { font-size: 18px; }
.route-sum { display: flex; gap: 16px; margin-top: 10px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.route-sum b { color: var(--ink); font-size: 18px; font-family: var(--f-display); margin-inline-end: 3px; }
.map-side .list { overflow-y: auto; flex: 1; }
.stop { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .15s; }
.stop:hover, .stop.on { background: #F4F2FA; }
.stop .n { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13.5px; flex: none; }
.stop.urgent .n { background: var(--amber); }
.stop.done .n { background: var(--green); }
.stop .t { font-weight: 600; color: var(--ink); line-height: 1.4; }
.stop .s { font-size: 12.5px; color: var(--muted); }
.stop .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.map-side .foot { padding: 12px 16px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; flex-wrap: wrap; }
.map-fab { position: absolute; z-index: 5; bottom: 22px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 8px; }
.map-fab .icon-btn { background: #fff; box-shadow: var(--float); width: 46px; height: 46px; border-radius: 14px; }
.map-fab .icon-btn.on { background: var(--violet); color: #fff; }

/* HTML markers */
.mk { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer; }
.mk-stop { width: 34px; height: 42px; animation: drop .5s var(--ease) both; }
.mk-stop svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 5px rgba(22,35,58,.35)); }
.mk-stop span { position: absolute; top: 6px; inset-inline: 0; text-align: center; color: #fff; font: 700 13px var(--f-body); }
@keyframes drop { from { transform: translate(-50%, -160%); opacity: 0; } }
.mk-office { transform: translate(-50%, -50%); width: 42px; height: 42px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 24px; box-shadow: var(--float); border: 3px solid #fff; }
.mk-agent { transform: translate(-50%, -50%); width: 18px; height: 18px; }
.mk-agent::before, .mk-agent::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.mk-agent::before { background: var(--violet); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 1; }
.mk-agent::after { background: var(--violet); animation: ping 1.8s ease-out infinite; }
.mk-agent em { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 12px var(--f-body); font-style: normal; background: #fff; color: var(--ink); padding: 1px 8px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.mk-cand { width: 26px; height: 26px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; border: 3px solid var(--amber); display: grid; place-items: center; font: 700 12px var(--f-body); color: var(--amber); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.mk-cand.on { background: var(--violet); border-color: var(--violet); color: #fff; }
@keyframes ping { from { transform: scale(1); opacity: .5; } to { transform: scale(3.2); opacity: 0; } }

.mini-map { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #DCE0D8; position: relative; }
.cands { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.cands li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; background: #fff; }
.cands li:hover { border-color: var(--violet-2); }
.cands li.on { border-color: var(--violet); background: var(--violet-soft); }
.cands li b { width: 24px; height: 24px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: grid; place-items: center; font-size: 12px; flex: none; }
.geo-state { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-top: 8px; }
.geo-state i { font-size: 18px; }

/* ---------- inventory capture ---------- */
.capture {
  display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 18px; background: var(--ink); border-radius: 18px; color: #fff; margin-bottom: 18px;
}
.shot {
  position: relative; aspect-ratio: 1; border-radius: 14px; background: var(--ink-2); border: 2px dashed rgba(255,255,255,.22);
  display: grid; place-items: center; overflow: hidden; cursor: pointer; text-align: center; color: #A9B5C9; font-size: 14px;
}
.shot i { font-size: 44px; color: #CBB8F2; display: block; margin-bottom: 6px; }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cap-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cap-body h3 { color: #fff; font-size: 18px; }
.cap-body p.hint { margin: 0; color: #A9B5C9; font-size: 13.5px; }
.mic-row { display: flex; align-items: center; gap: 14px; }
.mic {
  width: 66px; height: 66px; border-radius: 50%; border: 0; background: var(--violet); color: #fff; font-size: 30px; cursor: pointer; flex: none;
  display: grid; place-items: center; position: relative; touch-action: none; transition: transform .15s;
}
.mic.rec { background: var(--red); transform: scale(1.08); }
.mic.rec::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--red); animation: ping 1.2s ease-out infinite; }
.wave { flex: 1; height: 44px; display: flex; align-items: center; gap: 3px; }
.wave span { flex: 1; background: rgba(255,255,255,.25); border-radius: 3px; height: 4px; transition: height .08s; }
.mic.rec ~ .wave span { background: #F3A79F; }
.transcript { min-height: 52px; background: rgba(255,255,255,.07); border-radius: 10px; padding: 10px 12px; color: #fff; font-size: 15px; border: 1px solid rgba(255,255,255,.1); }
.transcript:empty::before { content: attr(data-ph); color: #8393AD; }
.transcript:focus { outline: 2px solid var(--violet-2); }
.cap-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cap-actions .btn-ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.25); }
.cap-actions .btn-ghost:hover { background: rgba(255,255,255,.07); }
.cap-status { font-size: 13px; color: #A9B5C9; display: flex; align-items: center; gap: 6px; }
.inv-thumb { width: 56px; height: 56px; border-radius: 9px; object-fit: cover; background: #E3E6E0; }
.inv-row-new { animation: row-in .7s var(--ease); }
@keyframes row-in { from { background: var(--violet-soft); } }
.tbl td[contenteditable] { cursor: text; border-radius: 6px; }
.tbl td[contenteditable]:hover { box-shadow: inset 0 0 0 1px var(--line); }
.tbl td[contenteditable]:focus { outline: 2px solid var(--violet-2); background: #fff; }
.ai-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--violet); background: var(--violet-soft); border-radius: 999px; padding: 0 8px; }
.pending-row td { opacity: .65; }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* gallery (inspections) */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.gallery img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.gallery figcaption { padding: 8px 10px; font-size: 13px; }
.gallery figcaption small { display: block; color: var(--muted); font-size: 11.5px; }

/* signature pad */
.sigpad { width: 100%; height: 170px; background: #fff; border: 1.5px dashed var(--line); border-radius: 10px; touch-action: none; display: block; }

/* calendar month */
.month { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line-2); gap: 1px; }
.month .dh { background: #F4F5F1; padding: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; text-align: center; }
.month .dc { background: #fff; min-height: 104px; padding: 6px 7px; font-size: 12.5px; }
.month .dc.out { background: #F7F8F4; color: #B3B8BF; }
.month .dc .dn { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; }
.month .dc.today .dn { background: var(--violet); color: #fff; }
.month .ev { display: block; padding: 2px 6px; border-radius: 6px; margin-bottom: 3px; background: #EEF0EC; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-inline-start: 3px solid var(--ink-3); }
.month .ev.k-deadline { border-color: var(--amber); background: var(--amber-soft); }
.month .ev.k-expertise { border-color: var(--violet); background: var(--violet-soft); }
.month .ev.k-sale { border-color: var(--green); background: var(--green-soft); }
.month .ev.done { text-decoration: line-through; opacity: .6; }

/* finance */
.ledger-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); margin-bottom: 18px; }
.ledger-top div { padding: 18px 22px; }
.ledger-top div + div { border-inline-start: 1px solid var(--line-2); }
.ledger-top span { color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.ledger-top b { font-family: var(--f-display); font-size: 28px; font-weight: 600; display: block; color: var(--ink); }
.ledger-top .in b { color: var(--green); } .ledger-top .out b { color: var(--red); }
.amt-in { color: var(--green); font-weight: 600; } .amt-out { color: var(--red); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 10px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--muted); }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .pair i { width: 40%; max-width: 18px; border-radius: 4px 4px 0 0; display: block; transform-origin: bottom; animation: grow .7s var(--ease) both; }
.bars .pair i.in { background: var(--green); } .bars .pair i.out { background: #D9867D; }
@keyframes grow { from { transform: scaleY(0); } }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.auth-art { background: var(--ink); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; }
.auth-art .brand { border: 0; padding: 0; }
.auth-art svg.city { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .copy { position: relative; max-width: 30ch; }
.auth-art .copy h2 { color: #fff; font-size: 34px; line-height: 1.35; margin-bottom: 10px; }
.auth-art .copy p { color: #A9B5C9; margin: 0; font-size: 16px; }
.auth-art .stamp { position: absolute; top: 120px; inset-inline-end: 12%; --c: #CBB8F2; animation: thump .6s cubic-bezier(.3, 1.4, .5, 1) 2.9s both; }
.route-path { stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 2.6s var(--ease) .4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pin { opacity: 0; animation: pin-in .45s var(--ease) forwards; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes pin-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form { width: min(400px, 100%); }
.auth-form h1 { font-size: 30px; margin-bottom: 6px; }
.auth-form p.lead { color: var(--muted); margin: 0 0 26px; }
.auth-form .field { margin-bottom: 16px; }
.auth-err { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }

/* ---------- print (procès-verbaux) ---------- */
.doc { background: #fff; max-width: 820px; margin: 24px auto; padding: 48px 56px; color: #111; font-size: 15px; line-height: 1.9; box-shadow: var(--float); }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 22px; }
.doc-head .of b { font-family: var(--f-display); font-size: 19px; color: var(--ink); display: block; }
.doc h1 { text-align: center; font-size: 26px; margin: 10px 0 20px; }
.doc table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.doc th, .doc td { border: 1px solid #999; padding: 6px 8px; text-align: start; vertical-align: top; }
.doc th { background: #F0F1ED; }
.doc td img { width: 72px; height: 72px; object-fit: cover; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; }
.doc .sign div { border-top: 1px solid #555; padding-top: 6px; text-align: center; min-height: 90px; }
.doc .sign img { max-height: 80px; margin: 6px auto 0; }
.doc-tools { position: sticky; top: 0; display: flex; gap: 8px; justify-content: center; padding: 12px; background: var(--paper); z-index: 2; }
@media print {
  body { background: #fff; }
  .doc { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .doc-tools { display: none; }
  @page { margin: 16mm; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .today { grid-template-columns: 1fr 1fr; }
  .today > div:nth-child(3) { border-inline-start: 0; }
  .today > div:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.09); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .main { margin: 0; padding-bottom: 86px; }
  .m-brand { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 20px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 8px 11px; }
  .content { padding: 16px 16px 40px; }
  .form { grid-template-columns: 1fr; }
  .panel-h, .panel-b { padding-inline: 16px; }
  .rows li { padding: 12px 16px; }
  .ledger-top { grid-template-columns: 1fr; }
  .ledger-top div + div { border-inline-start: 0; border-top: 1px solid var(--line-2); }
  .capture { grid-template-columns: 1fr; }
  .shot { aspect-ratio: 16/10; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; z-index: 40; bottom: 0; inset-inline: 0;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--muted); font: 500 11.5px var(--f-body); background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .tabbar i { font-size: 24px; }
  .tabbar .fab { width: 56px; height: 56px; margin: -26px auto 0; border-radius: 18px; background: var(--violet); color: #fff; justify-content: center; box-shadow: 0 10px 22px -8px rgba(91,63,160,.7); }
  .tabbar .fab i { font-size: 26px; }
  .page-map .main { padding-bottom: 0; }
  .map-wrap { height: calc(100dvh - 61px - 70px); }
  .map-side { top: auto; inset-inline: 10px; bottom: 10px; width: auto; max-height: 48%; }
  .map-fab { top: 12px; bottom: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 26px 22px; }
  .auth-art .copy h2 { font-size: 24px; }
  .auth-art .stamp { width: 110px; height: 110px; top: 70px; }
  .auth-art .stamp b { font-size: 17px; }
  /* tables → stacked */
  table.tbl.stack-sm thead { display: none; }
  table.tbl.stack-sm, .tbl.stack-sm tbody, .tbl.stack-sm tr, .tbl.stack-sm td { display: block; width: 100%; }
  .tbl.stack-sm tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl.stack-sm td { border: 0; padding: 4px 16px; display: flex; justify-content: space-between; gap: 12px; }
  .tbl.stack-sm td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; flex: none; }
  .tbl.stack-sm tfoot { display: block; }
  .doc { padding: 24px 18px; margin: 0; }
  .month .dc { min-height: 64px; font-size: 11px; }
  .month .ev { padding: 1px 3px; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .route-path { stroke-dashoffset: 0; }
  .pin { opacity: 1; }
}
@media (max-width: 860px) {
  .topbar-actions { flex-wrap: nowrap; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
