/* App styles. Every colour comes from css/theme.css (brand v3.1 semantic tokens, light + dark).
   No colour literal in this file: soft rules and tints are derived from tokens with color-mix(). */
:root {
  /* derived from theme tokens (resolve per theme on :root) */
  --x-ok-line: color-mix(in srgb, var(--accent) 30%, transparent);
  --x-attn-line: color-mix(in srgb, var(--attn) 32%, transparent);
  --x-unfav-line: color-mix(in srgb, var(--unfav) 34%, transparent);
  --x-info-line: color-mix(in srgb, var(--info) 20%, transparent);
  --x-ours: color-mix(in srgb, var(--accent) 12%, var(--surface));        /* «our side» bubble: opaque green-tinted surface (both themes) */
  --x-ours-line: color-mix(in srgb, var(--accent) 30%, var(--surface));
  --x-brand-well: color-mix(in srgb, var(--brand-rule) 40%, transparent);  /* a flat well on emerald grounds */
}
/* Brand 05: the only graphic background is the monogram watermark (core watermark(), css/brand.css .wm):
   no line patterns, no gradients; icons never sit inside coloured tiles (05.2): status tints the icon itself. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: var(--body-size, 15px)/var(--body-lh, 1.75) var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
.mono { font-family: var(--font-fig); direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }

.boot { height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
.boot-off { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding-inline: 24px; text-align: center; }
.boot-off p { max-width: 42ch; margin: 0; color: var(--muted); line-height: 1.7; }
@keyframes pulse { 50% { opacity: .4; } }

/* buttons & fields (UI kit 08.9): 44 px, radius 8, one green primary; every other button is an emerald outline */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--control-h); padding: 0 16px; border-radius: var(--r-1);
  border: 1px solid var(--heading); background: transparent; cursor: pointer; font-weight: 700; text-decoration: none; color: var(--heading); }
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.dark { background: var(--brand-bg); border-color: var(--brand-bg); color: var(--on-brand); }
.btn.dark:hover { background: var(--brand-bg-3); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.crit { color: var(--unfav); border-color: var(--unfav); }
.btn.crit:hover { background: var(--unfav-soft); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 13px; color: var(--heading); }
.input { width: 100%; min-height: var(--control-h); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); color: var(--text); }
.input::placeholder, .cx-text::placeholder, .cx-search-in::placeholder, .cx-find::placeholder, .au-in input::placeholder { color: var(--muted-2); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
select.input option { background: var(--surface); color: var(--text); }
.input.ltr { direction: ltr; text-align: start; }
.err { background: var(--unfav-soft); color: var(--unfav); border-radius: var(--r-1); padding: 10px 12px; font-size: 14px; }
.ok-box { background: var(--accent-soft); color: var(--heading); border-radius: var(--r-1); padding: 12px; }
.code-big { font: 700 26px/1.2 var(--font-fig); letter-spacing: .12em; direction: ltr; text-align: center; padding: 10px; background: var(--surface); color: var(--heading); border: 1px dashed var(--accent); border-radius: var(--r-1); user-select: all; }

/* auth screens (older layout) */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand { background: var(--brand-bg); color: var(--on-brand); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand h1 { font-size: 34px; line-height: 1.3; margin: 0 0 12px; color: var(--on-brand); }
.auth-brand p { color: var(--on-brand-2); max-width: 420px; margin: 0; }
.auth-brand .gold { color: var(--champ); }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h2 { margin: 0; font-size: 24px; color: var(--heading); }
.link-btn { background: none; border: 0; color: var(--accent-text); cursor: pointer; padding: 0; font-weight: 700; }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 28px 20px; gap: 18px; } .auth-brand h1 { font-size: 24px; } }

/* shell (older top bar) */
.shell { overflow: hidden; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.top { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--brand-bg); color: var(--on-brand); }
.top .logo { height: 30px; }
.top .grow { flex: 1; }
.top .who { font-size: 13px; color: var(--on-brand-2); }
.top .btn { background: transparent; color: var(--on-brand); border-color: var(--on-brand-3); }
.top .btn:hover, .top .btn.active { background: var(--brand-bg-3); }
.body { flex: 1; min-height: 0; display: flex; }

/* channel list */
.side { width: 320px; flex: none; background: var(--surface); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.side h3 { margin: 0; padding: 14px 16px 6px; font-size: 12px; color: var(--muted); letter-spacing: .02em; display: flex; gap: 8px; align-items: center; }
.side h3 .mono { color: var(--muted-2); }
.ch { display: flex; gap: 10px; align-items: center; width: 100%; text-align: start; padding: 10px 16px; border: 0; background: none; cursor: pointer; border-inline-start: 3px solid transparent; color: var(--text); }
.ch:hover { background: var(--surface-3); }
.ch.on { background: var(--accent-soft); border-inline-start-color: var(--accent); }
.ch .num { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--line); font: 700 12px var(--font-fig); color: var(--muted); }
.ch.on .num { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ch .t { flex: 1; min-width: 0; }
.ch .t b { display: block; font-size: 14px; }
.ch .t span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font: 700 12px/22px var(--font-fig); text-align: center; }

/* chat (older layout) */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.chat-h { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-block-end: 1px solid var(--line); }
.chat-h h2 { margin: 0; font-size: 16px; color: var(--heading); }
.chat-h .path { font-size: 12px; color: var(--muted); }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: var(--r-pill); margin: 8px 0; }
.msg { max-width: min(560px, 80%); align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: 8px 12px; }
.msg.mine { align-self: flex-end; background: var(--x-ours); border-color: var(--x-ours-line); }
.msg .by { font-size: 12px; font-weight: 700; color: var(--accent-text); }
.msg.staff .by { color: var(--heading); }
.msg .tx { white-space: pre-wrap; word-break: break-word; }
.msg .at { font-size: 11px; color: var(--muted-2); text-align: end; direction: ltr; font-family: var(--font-fig); }
.file { display: flex; align-items: center; gap: 10px; margin: 4px 0; padding: 8px 10px; border-radius: var(--r-1); background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; text-align: start; width: 100%; color: var(--text); }
.file .ic { width: 36px; height: 36px; border-radius: var(--r-1); background: var(--brand-bg); color: var(--champ); display: grid; place-items: center; font: 700 10px var(--font-fig); flex: none; }
.file .nm { font-size: 13px; font-weight: 700; word-break: break-all; }
.file .meta { font-size: 11px; color: var(--muted); }
.compose { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; padding-block-end: max(10px, env(safe-area-inset-bottom)); background: var(--surface); border-block-start: 1px solid var(--line); }
.compose textarea { flex: 1; resize: none; max-height: 140px; min-height: var(--control-h); }
.attach { width: 44px; padding: 0; font-size: 20px; }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.empty img:not(.art) { width: 64px; opacity: .9; }
.uploading { font-size: 12px; color: var(--muted); padding: 0 16px 6px; }

/* admin pages */
.page { flex: 1; overflow-y: auto; padding: 20px 16px 40px; }
.page-in { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); color: var(--text); }
.card-h { padding: 14px 16px; border-block-end: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.card-h h2 { margin: 0; font-size: 16px; flex: 1; color: var(--heading); }
.card-b { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1; min-width: 160px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-block-end: 1px solid var(--line-2); text-align: start; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; }
.tbl tbody tr:hover { background: var(--surface-2); }
.scroll { overflow-x: auto; }
.chip { display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.chip.ok { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.chip.warn { background: var(--attn-soft); border-color: var(--x-attn-line); color: var(--attn); }
.chip.crit { background: var(--unfav-soft); border-color: var(--x-unfav-line); color: var(--unfav); }
.chans { display: flex; flex-wrap: wrap; gap: 6px; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal .card { width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
#toast { position: fixed; inset-block-end: 20px; inset-inline: 0; margin-inline: auto; width: fit-content; max-width: calc(100vw - 32px); background: var(--brand-bg); color: var(--on-brand); padding: 10px 16px; border-radius: var(--r-1); box-shadow: var(--shadow-lg); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
#toast.show { opacity: 1; }
#toast.crit { background: var(--brand-bg); border-inline-start: 4px solid var(--unfav); }

@media (max-width: 760px) {
  .side { width: 100%; border: 0; }
  .shell.in-chat .side { display: none; }
  .shell:not(.in-chat) .chat { display: none; }
  .back { display: inline-flex; }
  .top .who { display: none; }
  .top { gap: 6px; padding: 0 8px; }
  .top .logo { height: 24px; }
  .top .btn.sm { padding: 0 8px; white-space: nowrap; min-height: 34px; }
  .msg { max-width: 88%; }
}
.check { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-1); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* KPIs, inbox, charts, channel details */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi .v { font: 700 26px/1.2 var(--font-fig); font-variant-numeric: tabular-nums; color: var(--heading); unicode-bidi: isolate; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.crit { border-color: var(--x-unfav-line); background: var(--unfav-soft); } .kpi.crit .v { color: var(--unfav); }
.kpi.warn { border-color: var(--x-attn-line); background: var(--attn-soft); } .kpi.warn .v { color: var(--attn); }
.inbox { display: flex; flex-direction: column; }
.in-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 0; border-block-end: 1px solid var(--line-2); background: none; text-align: start; cursor: pointer; width: 100%; color: var(--text); }
.in-row:hover { background: var(--surface-3); }
.in-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.in-row .grow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.bar .stack { flex: 1; width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; background: var(--line-2); }
.bar i { display: block; width: 100%; } .bar i.c { background: var(--chart-3); } .bar i.s { background: var(--chart-1); }
.bar span { font: 11px var(--font-fig); color: var(--muted); }
.drive-box { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--r-1); background: var(--accent-soft); border: 1px solid var(--x-ok-line); }
.drive-box b { color: var(--accent-text); }
.drive-box.off { background: var(--unfav-soft); border-color: var(--x-unfav-line); } .drive-box.off b { color: var(--unfav); }
.drive-box .btn { align-self: flex-start; }
h3.sub { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.people li { padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--r-1); }
.chat-h .grow { flex: 1; min-width: 0; }
.modal .card { max-height: calc(100vh - 32px); overflow-y: auto; }
#top-extras { display: flex; gap: 6px; }
#top-extras:empty { display: none; }
.top .btn.active { background: var(--brand-bg-3); border-color: var(--on-brand-2); }
@media (max-width: 760px) {
  .top { overflow-x: auto; scrollbar-width: none; }
  .top::-webkit-scrollbar { display: none; }
  .kpi .v { font-size: 22px; }
  .page { padding: 12px 10px 32px; }
}
@media (display-mode: standalone) { .top { padding-block-start: env(titlebar-area-height, 0); } }

/* document requests */
.reqs { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px; background: var(--attn-soft); border-block-end: 1px solid var(--x-attn-line); max-height: 32vh; overflow-y: auto; }
.req { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--x-attn-line); border-radius: var(--r-1); padding: 8px 10px; }
.req.late { border-color: var(--x-unfav-line); background: var(--unfav-soft); }
.req .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.req-ic { font-size: 18px; }
.req-card { align-self: center; width: min(520px, 92%); background: var(--attn-soft); border: 1px solid var(--x-attn-line); border-radius: var(--r-2); padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); padding: 3px 10px; border-radius: var(--r-pill); }
.ok-tx { color: var(--accent-text); font-weight: 700; }
.late-tx { color: var(--unfav); font-weight: 700; }
.reqbadge { font-size: 11px; font-weight: 700; color: var(--attn); background: var(--attn-soft); border-radius: var(--r-pill); padding: 1px 7px; white-space: nowrap; }
.todo-box { margin: 10px 12px 4px; padding: 10px; border-radius: var(--r-2); background: var(--attn-soft); border: 1px solid var(--x-attn-line); display: flex; flex-direction: column; gap: 6px; }
.todo-item { display: flex; flex-direction: column; text-align: start; gap: 2px; border: 1px solid var(--x-attn-line); background: var(--surface); color: var(--text); border-radius: var(--r-1); padding: 6px 10px; cursor: pointer; }
.todo-item.late { border-color: var(--x-unfav-line); }
/* tasks board */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board .col { background: var(--surface-2); border-radius: var(--r-2); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.board .col h3 { margin: 2px 4px 4px; font-size: 13px; color: var(--muted); }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-1); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.task.late { border-color: var(--x-unfav-line); border-inline-start: 3px solid var(--unfav); }
.task-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.task-act { display: flex; gap: 6px; justify-content: flex-end; }
.field.wide { flex: 1 1 100%; }
.empty-col { text-align: center; padding: 12px 0; }
@media (max-width: 760px) { .board { grid-template-columns: 1fr; } .chat-h .btn.sm { padding: 0 8px; } }

/* ================================================================== app shell: rail + topbar + main */
.app { display: grid; grid-template-columns: var(--side, 256px) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* rail: always an emerald ground (both themes) */
.rail { background: var(--brand-bg); color: var(--on-brand); display: flex; flex-direction: column; min-height: 0; padding: 18px 14px 12px; gap: 14px; position: relative; overflow: hidden; }
.rail > * { position: relative; z-index: 1; }
.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 2px; }
.rail-top .logo { height: 34px; width: auto; margin-inline-start: -6px; }
.surface-tag { font: 500 10px/1 var(--font-fig); letter-spacing: .14em; text-transform: uppercase; color: var(--champ); border: 1px solid color-mix(in srgb, var(--champ) 35%, transparent); border-radius: var(--r-pill); padding: 5px 8px; white-space: nowrap; }
.ws-wrap { position: relative; }
.ws { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-1); background: var(--brand-bg-2); border: 1px solid var(--brand-rule); color: var(--on-brand); text-align: start; font: inherit; }
button.ws { cursor: pointer; }
button.ws:hover { background: var(--brand-bg-3); }
.ws .grow { flex: 1; min-width: 0; }
.ws-badge { width: 34px; height: 34px; border-radius: var(--r-1); display: grid; place-items: center; background: var(--champ); color: var(--brand-bg); font-weight: 800; font-size: 13px; flex: none; }
.ws b { display: block; font-size: 13.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws span#ws-sub { display: block; font-size: 11.5px; color: var(--on-brand-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-menu { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 5; background: var(--brand-bg-2); border: 1px solid var(--brand-rule); border-radius: var(--r-1); padding: 6px; box-shadow: var(--shadow-lg); }
.ws-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-1); color: var(--on-brand-2); font-size: 13px; font-weight: 700; }
.ws-opt:hover { background: var(--brand-rule); color: var(--on-brand); }
.ws-opt.on { background: var(--brand-bg-3); color: var(--on-brand); }
.ws-opt .grow { flex: 1; }
.ws-opt .surface-tag { font-size: 9px; padding: 4px 6px; }
.rail-nav { flex: 1; overflow-y: auto; margin: 0 -14px; padding: 0 14px 8px; scrollbar-width: thin; scrollbar-color: var(--brand-rule) transparent; display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; color: var(--on-brand-3); padding: 10px 10px 4px; letter-spacing: .02em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-1); color: var(--on-brand-2); font-size: 13.5px; font-weight: 500; position: relative; }
.nav-item .grow { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--brand-rule); color: var(--on-brand); }
.nav-item.on { background: var(--brand-bg-3); color: var(--on-brand); font-weight: 700; }
.nav-item.on::before { content: ""; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 3px; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--accent); }
.nav-item:focus-visible, .ws:focus-visible, .rail .icon-btn:focus-visible { outline: 2px solid var(--champ); outline-offset: 1px; box-shadow: none; }
.nav-count { font: 600 11px/1 var(--font-fig); background: var(--accent); color: var(--on-accent); padding: 4px 7px; border-radius: var(--r-pill); min-width: 22px; text-align: center; }
.nav-count.quiet { background: var(--brand-rule); color: var(--on-brand-2); }
.nav-count.alert { background: var(--champ); color: var(--brand-bg); }
.rail-me { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; border-block-start: 1px solid var(--brand-rule); }
.rail-me .grow { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.rail-me b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-me .xs { color: var(--on-brand-2); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail .icon-btn { width: 36px; height: 36px; border-color: transparent; background: transparent; color: var(--on-brand-2); }
.rail .icon-btn:hover { background: var(--brand-rule); color: var(--on-brand); }

/* avatars (used across surfaces) */
.avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--info-soft); color: var(--heading); font-weight: 800; position: relative; }
.rail .avatar { background: var(--champ); color: var(--brand-bg); }
.avatar .pres { position: absolute; inset-block-end: -1px; inset-inline-end: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: var(--muted-2); }
.avatar .pres.on { background: var(--accent); } .avatar .pres.away { background: var(--attn); }
.rail .avatar .pres { border-color: var(--brand-bg); }

/* generic icon button */
.icon-btn { width: var(--control-h); height: var(--control-h); flex: none; display: grid; place-items: center; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; position: relative; padding: 0; }
.icon-btn:hover { color: var(--heading); border-color: var(--heading); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--unfav); border: 2px solid var(--surface); }

/* topbar */
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: var(--top, 64px); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--surface); border-block-end: 1px solid var(--line); position: relative; z-index: 4; }
.topbar .grow { flex: 1; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumb a { color: var(--muted); white-space: nowrap; }
.crumb a:hover { color: var(--accent-text); }
.crumb b { color: var(--heading); font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb .i { color: var(--muted-2); }
.search-btn { display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface-2); color: var(--muted); font-size: 13px; min-width: 300px; cursor: pointer; text-align: start; }
.search-btn:hover { border-color: var(--muted-2); }
.search-btn .search-ph { flex: 1; }
kbd { font: 500 11px/1 var(--font-fig); border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 3px 5px; color: var(--muted); direction: ltr; }
.top-date { font-size: 12px; color: var(--muted); border-inline-start: 1px solid var(--line); padding-inline-start: 14px; height: 24px; display: flex; align-items: center; white-space: nowrap; font-family: var(--font-fig), var(--font); }
.bell-wrap { position: relative; }
.pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-lg); z-index: 20; overflow: hidden; }
.pop-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-block-end: 1px solid var(--line); font-size: 13px; color: var(--heading); }
.pop-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-block-end: 1px solid var(--line-2); color: var(--text); font-size: 13px; }
.pop-row:last-child { border-block-end: 0; }
.pop-row:hover { background: var(--surface-3); }
.pop-row .grow { flex: 1; display: flex; flex-direction: column; }
.pop-row > .i { color: var(--muted-2); }
.pop-ic { width: 24px; height: 24px; display: grid; place-items: center; flex: none; background: none; color: var(--accent-text); }
.pop-row.warn .pop-ic { color: var(--attn); }
.pop-row.crit .pop-ic { color: var(--unfav); }
.pop-empty { margin: 0; padding: 18px 14px; color: var(--muted); font-size: 13px; text-align: center; }
.burger { display: none; }

/* command palette (Ctrl+K) */
.cmdk { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.cmdk-card { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 72vh; }
.cmdk-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-block-end: 1px solid var(--line); color: var(--muted); }
.cmdk-in { flex: 1; border: 0; outline: 0; font-size: 15px; background: transparent; min-width: 0; color: var(--text); }
.cmdk-list { overflow-y: auto; padding: 6px 0 8px; }
.cmdk-gl { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 10px 16px 4px; }
.cmdk-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--text); cursor: pointer; }
.cmdk-row.on { background: var(--accent-soft); }
.cmdk-row.off { cursor: default; opacity: .75; }
.cmdk-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmdk-row b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-ic { width: 24px; height: 24px; display: grid; place-items: center; background: none; color: var(--heading); flex: none; }
.cmdk-note { margin: 0; padding: 14px 16px; font-size: 12.5px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 4px; font: 500 11px/1 var(--font-fig); background: var(--surface-3); color: var(--muted); white-space: nowrap; direction: ltr; unicode-bidi: isolate; }

/* main area */
#main { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
#main > .page { flex: 1; }
.scrim { display: none; }
.loading { padding: 24px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-h h1 { margin: 0; font-size: 22px; color: var(--heading); }
.page-h p { margin: 2px 0 0; }
.page-body { display: flex; flex-direction: column; gap: 16px; }
.page-in { max-width: 1180px; }
/* chat inside the shell */
.chat-wrap { flex: 1; min-height: 0; display: flex; }
.chat-wrap .side { width: 320px; }
.msgs.drop { outline: 2px dashed var(--accent); outline-offset: -8px; background: var(--accent-soft); }
.empty img:not(.art) { width: 56px; opacity: .9; }
a { text-decoration: none; }
.tbl a b { color: var(--heading); }
.tbl a:hover b { text-decoration: underline; }
@media (max-width: 1180px) { .top-date { display: none; } .search-btn { min-width: 220px; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; max-width: 86vw; z-index: 30; transform: translateX(100%); transition: transform .2s; }
  [dir="ltr"] .rail { transform: translateX(-100%); }
  .app.nav-open .rail { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .burger { display: grid; }
  .topbar { padding: 0 12px; gap: 8px; height: 56px; }
  .crumb .crumb-root, .crumb a, .crumb .i { display: none; }
  .crumb b { font-size: 15px; }
  .search-btn { min-width: 0; width: var(--control-h); padding: 0; justify-content: center; }
  .search-btn .search-ph, .search-btn kbd { display: none; }
  .pop { width: min(320px, calc(100vw - 24px)); }
}
@media (max-width: 760px) {
  .chat-wrap .side { width: 100%; border: 0; }
  .chat-wrap.in-chat .side { display: none; }
  .chat-wrap:not(.in-chat) .chat { display: none; }
  #top-extras .btn { padding: 0 8px; }
}

/* chat + auth (portal) ======================================================================== */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.i-sm { width: 16px; height: 16px; } .ic.i-xs { width: 13px; height: 13px; } .ic.i-lg { width: 22px; height: 22px; }
[dir=rtl] .ic.flip { transform: scaleX(-1); }
.cx-av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 800; font-size: 12px; color: var(--on-brand); background: var(--brand-bg-3); }
.cx-av.sm { width: 26px; height: 26px; font-size: 11px; } .cx-av.xs { width: 20px; height: 20px; font-size: 9px; } .cx-av.lg { width: 44px; height: 44px; font-size: 16px; }
/* six avatar tints, all from the closed palette, readable in both themes */
.cx-av.c1 { background: var(--accent); color: var(--on-accent); }
.cx-av.c2 { background: var(--brand-bg-3); color: var(--on-brand); }
.cx-av.c3 { background: var(--accent-soft-2); color: var(--heading); }
.cx-av.c4 { background: var(--brand-bg); color: var(--on-brand); }
.cx-av.c5 { background: var(--accent-soft); color: var(--heading); }
.cx-av.c6 { background: var(--surface-3); color: var(--heading); }
.cx-stack { display: inline-flex; align-items: center; }
.cx-stack .cx-av { border: 2px solid var(--surface); }
.cx-stack .cx-av + .cx-av { margin-inline-start: -8px; }
.cx-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.cx-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cx-chip.plain::before { display: none; }
.cx-chip.ok { background: var(--accent-soft); color: var(--accent-text); } .cx-chip.warn { background: var(--attn-soft); color: var(--attn); }
.cx-chip.crit { background: var(--unfav-soft); color: var(--unfav); } .cx-chip.info { background: var(--info-soft); color: var(--info); }
.cx-chip.champ { background: var(--attn-soft); color: var(--attn); } .cx-chip.dark { background: var(--brand-bg); color: var(--on-brand); }
/* file-type marks: soft fills + the type written (PDF / IMG / XLS / DOC / FILE) */
.cx-ico { width: 38px; height: 44px; border-radius: var(--r-1); display: grid; place-items: center; font: 700 10px/1 var(--font-fig); color: var(--on-brand); flex: none; background: var(--brand-bg); border: 1px solid var(--line); }
.cx-ico.pdf { background: var(--unfav-soft); color: var(--unfav-strong); } .cx-ico.img { background: var(--info-soft); color: var(--info); }
.cx-ico.xls { background: var(--accent-soft); color: var(--accent-text); } .cx-ico.doc { background: var(--attn-soft); color: var(--attn); }
.cx-ico.oth { background: var(--surface-3); color: var(--muted); }
.cx-ico.sm { width: 28px; height: 32px; font-size: 8px; border-radius: 6px; }
.cx-ibtn { width: var(--control-h); height: var(--control-h); display: inline-grid; place-items: center; flex: none; border-radius: var(--r-1); border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.cx-ibtn:hover { color: var(--heading); border-color: var(--heading); }
.cx-ibtn.sm { width: 34px; height: 34px; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 14px; border-radius: var(--r-1); border: 1px solid var(--heading); background: transparent; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--heading); text-decoration: none; }
.cx-btn:hover { background: var(--surface-3); }
.cx-btn.sm { height: 34px; padding: 0 10px; font-size: 12px; }
.cx-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cx-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.cx-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.cx-btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.cx-btn.champ { background: var(--attn-soft); border-color: var(--x-attn-line); color: var(--attn); }
.cx-btn:disabled { opacity: .55; cursor: default; }
.cx-btn:focus-visible, .cx-ibtn:focus-visible, .cx-send:focus-visible, .cx-reqbtn:focus-visible, .cx-act:focus-visible { outline: none; box-shadow: var(--focus); }
.cx-muted { color: var(--muted); font-size: 12.5px; margin: 0; }

/* layout: list | conversation | panel */
.cx { flex: 1; min-height: 0; display: grid; grid-template-columns: 268px minmax(0, 1fr) 288px; position: relative; overflow: hidden; background: var(--bg); }
.cx.hide-panel { grid-template-columns: 268px minmax(0, 1fr); }
.cx.hide-panel .cx-panel { display: none; }
.cx-list { background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cx-list-h { height: 60px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-block-end: 1px solid var(--line); }
.cx-list-h h2 { margin: 0; font-size: 16px; font-weight: 800; color: var(--heading); }
.cx-count { font: 700 11px/1 var(--font-fig); color: var(--muted); background: var(--surface-3); border-radius: var(--r-pill); padding: 4px 8px; }
.cx-count:empty { display: none; }
.cx-search { display: flex; align-items: center; gap: 8px; margin: 12px 14px 6px; height: var(--control-h); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface-2); color: var(--muted); }
.cx-search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.cx-search-in { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-size: 13px; color: var(--text); }
.cx-search-in:focus-visible { box-shadow: none; }
.cx-tabs { display: flex; gap: 6px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.cx-tab { white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 11px; border-radius: var(--r-pill); background: var(--surface-3); border: 0; cursor: pointer; }
.cx-tab.on { background: var(--brand-bg); color: var(--on-brand); }
.cx-items { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.cx-group { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 10px 8px 4px; }
.cx-group .mono { color: var(--muted-2); }
.cx-ci { display: flex; gap: 10px; padding: 9px 8px; border-radius: var(--r-1); align-items: flex-start; border: 0; background: none; text-align: start; cursor: pointer; width: 100%; color: var(--text); }
.cx-ci:hover { background: var(--surface-3); }
.cx-ci.on { background: var(--accent-soft); }
.cx-no { width: 36px; height: 36px; border-radius: var(--r-1); background: var(--info-soft); color: var(--heading); display: grid; place-items: center; font: 700 12px/1 var(--font-fig); flex: none; }
.cx-ci.on .cx-no, .cx-no.big { background: var(--brand-bg); color: var(--on-brand); }
.cx-no.big { width: 40px; height: 40px; border-radius: var(--r-1); font-size: 13px; }
.cx-ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cx-ci-top, .cx-ci-bot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cx-ci-top b { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-t { font: 500 10.5px/1 var(--font-fig); color: var(--muted-2); white-space: nowrap; }
.cx-last { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font: 700 11px/20px var(--font-fig); text-align: center; flex: none; }
.cx-reqdot { display: inline-flex; align-items: center; gap: 3px; font: 700 11px/1 var(--font-fig); color: var(--attn); background: var(--attn-soft); border-radius: var(--r-pill); padding: 3px 6px; flex: none; }
.cx-list-foot { flex: none; border-block-start: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.cx-list-foot .grow { display: flex; flex-direction: column; min-width: 0; }
.cx-list-foot b { color: var(--text); font-size: 12.5px; }

.cx-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.cx-chat.drop::after { content: "سيب الملف هنا وهيتأرشف على Drive"; position: absolute; inset: 70px 16px 16px; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--r-2); background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--accent-text); font-weight: 800; font-size: 16px; z-index: 5; pointer-events: none; }
html[lang="en"] .cx-chat.drop::after { content: "Drop the file here to archive it on Drive"; }
.cx-blank { flex: 1; display: grid; place-items: center; }
.cx-head { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-block-end: 1px solid var(--line); }
.cx-head-main { flex: 1; min-width: 0; }
.cx-head h2 { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--heading); }
.cx-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.cx-sub-stack { display: none; }
.cx-sync { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 700; }
.cx-sync::before, .cx-off::before { content: "·"; color: var(--muted); margin-inline-end: 2px; font-weight: 400; }
.cx-off { color: var(--unfav); font-weight: 700; }
.cx-head-stack .cx-av { width: 28px; height: 28px; font-size: 11px; }
.cx-dchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; max-width: 220px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface-2); font-size: 11.5px; color: var(--muted); }
.cx-dchip .ic { color: var(--accent-text); }
.cx-dchip b { color: var(--text); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-find { width: 180px; height: 36px; border: 1px solid var(--line); border-radius: var(--r-1); padding: 0 10px; font-size: 13px; background: var(--surface-2); color: var(--text); }
.cx-find:focus { outline: 0; border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.cx-back, .cx-more { display: none; }
.cx-ibtn.cx-back { border: 0; color: var(--text); }
.cx-body { flex: 1; min-height: 0; position: relative; display: flex; }
.cx-thread { flex: 1; overflow-y: auto; padding: 14px 22px 18px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); }
.cx-day { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 12px; margin: 6px 0; }
.cx-msg { display: flex; gap: 8px; max-width: 72%; align-items: flex-end; }
.cx-msg.wide { max-width: min(84%, 620px); }
.cx-msg.out { align-self: flex-start; }
.cx-msg.in { align-self: flex-end; flex-direction: row-reverse; }
.cx-msg.cont { margin-block-start: -4px; }
.cx-msg.cont .cx-who { display: none; }
.cx-msg.cont > .cx-av { visibility: hidden; }
.cx-bubble { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-2); padding: 8px 12px 6px; font-size: 14px; line-height: 1.65; min-width: 0; }
.cx-msg.out .cx-bubble { background: var(--x-ours); border-color: var(--x-ours-line); }
.cx-who { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-block-end: 2px; font-size: 12.5px; }
.cx-who b { font-weight: 800; color: var(--heading); }
.cx-who span { font-size: 11px; color: var(--muted); }
.cx-tx { white-space: pre-wrap; word-break: break-word; }
.cx-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font: 500 10.5px/1 var(--font-fig); color: var(--muted); margin-block-start: 4px; }
.cx-meta .ic { color: var(--accent-text); }
.cx-quote { border-inline-start: 3px solid var(--info); background: var(--info-soft); border-radius: 6px; padding: 5px 9px; margin: 2px 0 6px; font-size: 12px; line-height: 1.45; display: flex; flex-direction: column; color: var(--text); }
.cx-quote b { color: var(--info); font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.cx-quote span { color: var(--muted); }
.cx-msg.out .cx-quote { border-color: var(--accent); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.cx-msg.out .cx-quote b { color: var(--accent-text); }
.cx-doc { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); padding: 10px; margin: 4px 0; min-width: 0; }
.cx-doc-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cx-doc-main { flex: 1; min-width: 0; }
.cx-doc-name { font-size: 13px; font-weight: 700; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-doc-sub { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-block-start: 3px; }
.cx-ok { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-text); font-weight: 700; }
.cx-dpath { display: flex; align-items: center; gap: 6px; font: 500 11px/1.3 var(--font-fig); color: var(--muted); direction: ltr; justify-content: flex-start; border-block-start: 1px dashed var(--line); padding-block-start: 7px; min-width: 0; }
.cx-dpath .ic { color: var(--accent-text); }
.cx-dpath span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; }
.cx-sys { align-self: center; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 88%; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 75%, transparent); border: 1px dashed var(--line); border-radius: var(--r-1); padding: 6px 12px; }
.cx-sys b { color: var(--text); }
.cx-reqcard { align-self: center; width: min(520px, 92%); background: var(--attn-soft); border: 1px solid var(--x-attn-line); border-radius: var(--r-2); padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.cx-reqcard.late { border-color: var(--x-unfav-line); background: var(--unfav-soft); }
.cx-req-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--attn); font-weight: 700; }
.cx-req-top .cx-meta { margin: 0; margin-inline-start: auto; }
.cx-req-ic { width: 22px; height: 22px; display: grid; place-items: center; background: none; color: var(--attn); border: 0; flex: none; }
.cx-req-title { font-size: 14.5px; color: var(--heading); }
.cx-req-d { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.cx-req-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-block-start: 2px; }
.cx-dim { opacity: .22; }
.cx-newpill { position: absolute; inset-block-end: 14px; inset-inline-end: 22px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow); cursor: pointer; z-index: 3; }
.cx-newpill .cx-unread { position: absolute; inset-block-start: -8px; inset-inline-start: -6px; height: 18px; min-width: 18px; line-height: 18px; font-size: 10.5px; padding: 0 5px; }
.cx-reqs { flex: none; display: none; flex-direction: column; gap: 6px; padding: 8px 14px; background: var(--attn-soft); border-block-end: 1px solid var(--x-attn-line); max-height: 28vh; overflow-y: auto; }
.cx-req { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--x-attn-line); border-radius: var(--r-1); padding: 8px 10px; color: var(--text); }
.cx-req.late { border-color: var(--x-unfav-line); background: var(--unfav-soft); }
.cx-req.late .cx-req-ic, .cx-reqcard.late .cx-req-ic { color: var(--unfav); }
.cx-req .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cx-req .grow b { font-size: 13px; }
.cx-req .grow span { font-size: 11.5px; color: var(--muted); }
.cx-req-act { display: flex; gap: 4px; flex: none; }
.cx-req.compact { padding: 8px; align-items: flex-start; flex-wrap: wrap; }
.cx-req.compact .cx-req-act { width: 100%; justify-content: flex-end; }
/* composer */
.cx-comp { flex: none; background: var(--surface); border-block-start: 1px solid var(--line); padding: 10px 16px 12px; padding-block-end: max(12px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.cx-uploading { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--accent-text); font-weight: 700; }
.cx-bar { flex: 1; max-width: 240px; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.cx-bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width .2s; }
.cx-comp-row { display: flex; align-items: flex-end; gap: 8px; }
.cx-comp-row .cx-ibtn { width: 44px; height: 44px; }
.cx-box { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: var(--r-1); padding-block: 0; padding-inline: 12px 8px; background: var(--surface-2); display: flex; align-items: center; gap: 8px; }
.cx-box:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.cx-text { flex: 1; min-width: 0; border: 0; background: none; outline: 0; resize: none; padding: 11px 2px; font-size: 14px; line-height: 1.5; max-height: 140px; color: var(--text); }
.cx-text:focus-visible { box-shadow: none; }
.cx-drop { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); border: 1px dashed var(--muted-2); border-radius: 6px; padding: 4px 8px; background: var(--surface); white-space: nowrap; flex: none; }
.cx-drop .ic { color: var(--accent-text); }
.cx-reqbtn { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border-radius: var(--r-1); border: 1px solid var(--heading); background: transparent; color: var(--heading); font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.cx-reqbtn:hover { background: var(--surface-3); }
.cx-send { width: 44px; height: 44px; border-radius: var(--r-1); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border: 0; cursor: pointer; flex: none; }
.cx-send:hover { background: var(--accent-hover); }
.cx-readonly { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 18px; padding-block-end: max(12px, env(safe-area-inset-bottom)); background: var(--info-soft); border-block-start: 1px solid var(--x-info-line); color: var(--info); }
.cx-readonly div { display: flex; flex-direction: column; }
.cx-readonly b { font-size: 14px; }
.cx-readonly span { font-size: 12px; color: var(--muted); }
/* right panel */
.cx-panel { background: var(--surface); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cx-panel-h { height: 60px; flex: none; display: flex; align-items: center; gap: 8px; padding-block: 0; padding-inline: 16px 14px; border-block-end: 1px solid var(--line); }
.cx-panel-h h3 { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--heading); }
.cx-link { font-size: 12px; font-weight: 700; color: var(--accent-text); display: inline-flex; gap: 4px; align-items: center; }
.cx-panel-x { display: none; }
.cx-panel-b { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.cx-sec { padding: 12px 16px; border-block-end: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.cx-eyebrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.cx-eyebrow.mt { margin-block-start: 6px; }
.cx-eyebrow .mono { font-size: 11px; color: var(--muted-2); }
.cx-eyebrow a { color: var(--accent-text); font-size: 12px; }
.cx-tree { font: 500 11.5px/1 var(--font-fig); color: var(--muted); display: flex; flex-direction: column; gap: 2px; text-align: start; }
.cx-node { display: flex; align-items: center; gap: 6px; height: 24px; border-radius: 6px; padding-inline-end: 6px; min-width: 0; }
.cx-node-l { flex: 1; min-width: 0; direction: ltr; unicode-bidi: isolate; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-node-c { color: var(--muted-2); font-size: 10.5px; }
.cx-node.on { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.cx-node.on .ic { color: var(--accent-text); }
.cx-warnbox { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--unfav); background: var(--unfav-soft); border-radius: var(--r-1); padding: 8px 10px; }
.cx-cnt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cx-cnt div { border: 1px solid var(--line); border-radius: var(--r-1); padding: 7px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-cnt b { font: 700 16px/1.1 var(--font-fig); white-space: nowrap; color: var(--heading); font-variant-numeric: tabular-nums; }
.cx-cnt span { font-size: 10.5px; color: var(--muted); }
.cx-note { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted-2); margin: 0; }
.cx-plist { display: flex; flex-direction: column; gap: 6px; }
.cx-rf, .cx-filebtn { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cx-filebtn { width: 100%; text-align: start; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); color: var(--text); padding: 8px 10px; cursor: pointer; }
.cx-filebtn:hover { border-color: var(--heading); }
.cx-rf .grow, .cx-filebtn .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cx-rf-n { font-size: 12px; font-weight: 700; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-rf-s { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cx-person { display: flex; align-items: center; gap: 10px; }
.cx-person .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cx-person b { font-size: 13px; }
.cx-person .grow span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-syncbar { margin-block-start: auto; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-block-start: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.cx-syncbar b { color: var(--text); }
.cx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); flex: none; }
.cx-dot.off { background: var(--unfav); box-shadow: 0 0 0 3px var(--unfav-soft); }
.cx-dialog { display: flex; flex-direction: column; margin: -4px -16px 0; }
.cx-dialog .cx-sec:last-child { border-block-end: 0; }

@media (max-width: 1480px) { .cx-dchip, .cx-drop { display: none; } }
@media (max-width: 1279px) {
  .cx, .cx.hide-panel { grid-template-columns: 270px minmax(0, 1fr); }
  .cx-panel, .cx.hide-panel .cx-panel { display: flex; position: absolute; inset-block: 0; inset-inline-end: 0; width: 320px; z-index: 8; box-shadow: var(--shadow-lg); transform: translateX(-110%); visibility: hidden; transition: transform .18s, visibility .18s; }
  [dir="ltr"] .cx-panel, [dir="ltr"] .cx.hide-panel .cx-panel { transform: translateX(110%); }
  .cx.show-panel .cx-panel, [dir="ltr"] .cx.show-panel .cx-panel { transform: none; visibility: visible; }
  .cx-panel-x { display: inline-grid; }
  .cx-reqs:not([hidden]) { display: flex; }
  .cx-dchip { display: none; }
}
@media (max-width: 1040px) { .cx-drop, .cx-head-stack { display: none; } .cx-reqbtn span { display: none; } .cx-reqbtn { padding: 0 12px; } }
@media (max-width: 760px) {
  .cx, .cx.hide-panel { grid-template-columns: minmax(0, 1fr); }
  .cx-panel, .cx.hide-panel .cx-panel { display: none; }
  .cx.in-chat .cx-list { display: none; }
  .cx:not(.in-chat) .cx-chat { display: none; }
  .cx-list { border: 0; }
  .app:has(.cx.in-chat) .topbar { display: none; }
  .cx-head { height: auto; min-height: 64px; padding-block: 8px; padding-inline: 10px 6px; gap: 10px; }
  .cx-back, .cx-more { display: inline-grid; }
  .cx-ibtn.cx-more { border: 0; }
  .cx-info, .cx-hide-sm, .cx-find { display: none; }
  .cx-head h2 { font-size: 17px; }
  .cx-sub-stack { display: inline-flex; }
  .cx-sub { font-size: 12px; }
  .cx-thread { padding: 12px 10px 14px; }
  .cx-msg, .cx-msg.wide { max-width: 90%; }
  .cx-msg.out > .cx-av { display: none; }
  .cx-comp { padding: 8px 10px; }
  .cx-comp-row .cx-ibtn { width: 40px; height: 44px; border: 0; }
  .cx-box { border-radius: 22px; }
  .cx-send { border-radius: 50%; width: 46px; height: 46px; }
  .cx-newpill { inset-inline-end: 12px; }
  .cx-reqcard { width: 96%; }
}

/* sign-in (C1) */
.au { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); background: var(--bg); }
.au-brand { background: var(--brand-bg); color: var(--on-brand); padding: 44px 56px 40px; display: flex; flex-direction: column; gap: 26px; position: relative; overflow: hidden; }
/* emerald ground: the monogram watermark (core watermark(true) → .wm.wm-brand, sized in css/brand.css) + one character (.au-art) */
.au-brand > *:not(.wm):not(.au-art) { position: relative; z-index: 1; }
.au-brand .wm { width: 560px; inset-inline-end: -170px; inset-block-start: -120px; bottom: auto; }
.au-art { position: absolute; z-index: 1; inset-inline-end: 28px; inset-block-end: 0; height: min(270px, 34vh); width: auto; }
.au-brand:has(.au-art) .au-flow { margin-inline-end: 190px; }
.au-logo { align-self: flex-start; height: 72px; width: auto; }
.au-brand h1 { margin: 36px 0 0; font-size: 44px; line-height: 1.45; font-weight: 800; color: var(--on-brand); }
.au-brand h1 .gold { color: var(--champ); display: block; }
.au-lead { color: var(--on-brand-2); font-size: 16px; line-height: 1.9; max-width: 560px; margin: 0; }
.au-feats { display: flex; flex-direction: column; gap: 18px; list-style: none; padding: 0; margin: 4px 0 0; max-width: 560px; }
.au-feats li { display: flex; gap: 14px; align-items: flex-start; }
/* feature rows: a brand line icon, plain (no tile), in champagne on the emerald ground */
.au-feats .bi, .au-fi { color: var(--champ); margin-block-start: 2px; }
.au-fi { width: 26px; height: 26px; display: grid; place-items: center; flex: none; background: none; border: 0; }
.au-feats li > div { display: flex; flex-direction: column; min-width: 0; }
.au-feats b { display: block; font-size: 16px; color: var(--on-brand); }
.au-feats span { font-size: 13px; color: var(--on-brand-2); }
.au-flow { margin-block-start: auto; max-width: 560px; border: 1px solid var(--brand-rule); background: var(--x-brand-well); border-radius: var(--r-2); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.au-flow-t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.au-flow-t i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.au-pipe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.au-pipe span { height: 4px; border-radius: 2px; background: var(--accent); }
.au-pipe span.soon { background: var(--brand-rule); }
.au-pipe-l { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 12px; color: var(--on-brand-2); }
.au-pipe-l .soon { color: var(--on-brand-3); }
.au-side { display: flex; flex-direction: column; padding: 28px 40px 22px; min-width: 0; }
.au-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.au-top a { color: var(--accent-text); font-weight: 700; }
.au-mid { flex: 1; display: grid; place-items: center; padding: 28px 0; }
.au-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); box-shadow: var(--shadow-lg); padding: 32px 34px 26px; display: flex; flex-direction: column; gap: 16px; }
.au-card-h { display: flex; gap: 14px; align-items: center; }
/* the monogram on its own (on-light / on-dark images pick the version), no tile behind it */
.au-mark { width: 44px; height: 44px; display: grid; place-items: center; flex: none; background: none; }
.au-mark img { width: 40px; height: 40px; }
.au-card h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--heading); }
.au-card-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.au-field { display: flex; flex-direction: column; gap: 6px; }
.au-lab { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; color: var(--heading); }
.au-lab .link-btn { font-size: 12.5px; }
.au-in { display: flex; align-items: center; gap: 8px; height: var(--control-h); border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); padding: 0 12px; color: var(--muted); }
.au-in:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.au-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; font-size: 15px; color: var(--text); }
.au-in input:focus-visible { box-shadow: none; }
.au-in input.ltr { direction: ltr; text-align: start; font-family: var(--font-fig); }
.au-eye { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: grid; place-items: center; border-radius: var(--r-1); }
.au-hint { font-size: 12px; color: var(--muted); }
.au-submit { height: var(--control-h); border-radius: var(--r-1); border: 0; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.au-submit:hover { background: var(--accent-hover); }
.au-submit:disabled { opacity: .6; cursor: default; }
.au-alt { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-1); padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.au-alt > .ic { color: var(--accent-text); }
.au-alt .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.au-alt .grow span { font-size: 12px; color: var(--muted); }
.au-help { text-align: center; font-size: 13px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.au-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.au-foot span { display: inline-flex; align-items: center; gap: 6px; }
.au-note { background: var(--info-soft); color: var(--info); border-radius: var(--r-1); padding: 10px 12px; font-size: 13px; }
@media (max-width: 1100px) { .au-art { height: 200px; } .au-brand:has(.au-art) .au-flow { margin-inline-end: 140px; } .au-brand { padding: 36px 32px; } .au-brand h1 { font-size: 34px; margin-block-start: 16px; } .au-side { padding: 24px 24px 18px; } }
@media (max-width: 860px) {
  .au { grid-template-columns: 1fr; }
  .au-brand { order: -1; padding: 20px 18px; gap: 10px; }
  .au-feats, .au-flow, .au-lead, .au-art { display: none; }
  .au-brand .wm { width: 300px; inset-inline-end: -90px; inset-block-start: -70px; }
  .au-logo { height: 40px; }
  .au-brand h1 { font-size: 21px; margin: 0; line-height: 1.55; }
  .au-brand h1 .gold { display: inline; }
  .au-side { padding: 14px 16px 18px; }
  .au-mid { padding: 14px 0; align-items: start; }
  .au-card { padding: 22px 18px 18px; box-shadow: var(--shadow); }
}

/* ================================================================== alerts, notifications prompt, chat extras */
.fh-alerts { position: fixed; top: 68px; inset-inline-end: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.fh-alert { display: flex; gap: 10px; align-items: flex-start; text-align: start; padding: 10px 12px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); cursor: pointer; animation: fh-in .2s ease-out; }
.fh-alert img { width: 34px; height: 34px; border-radius: var(--r-1); flex: none; }
.fh-alert span { display: flex; flex-direction: column; min-width: 0; }
.fh-alert b { font-size: 13px; color: var(--heading); }
.fh-alert span span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* «a task you assigned is done» */
.fh-alert.done { border-color: var(--accent); border-inline-start-width: 4px; box-shadow: var(--shadow-lg), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.fh-alert-ok { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; }
.fh-alert-ok svg { width: 18px; height: 18px; }
@media (prefers-reduced-motion: no-preference) { .fh-alert.done { animation: fh-done .5s cubic-bezier(.22, 1, .36, 1); } }
@keyframes fh-done { 0% { opacity: 0; transform: translateY(-8px) scale(.94); } 60% { transform: translateY(0) scale(1.02); } 100% { opacity: 1; transform: none; } }
@keyframes fh-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.fh-ask { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 60; display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100vw - 36px)); padding: 12px 14px; border-radius: var(--r-2); background: var(--brand-bg); color: var(--on-brand); box-shadow: var(--shadow-lg); }
.fh-ask .grow { display: flex; flex-direction: column; font-size: 13px; }
.fh-ask .grow span { color: var(--on-brand-2); }
.fh-ask .btn:not(.primary) { background: transparent; color: var(--on-brand); border-color: var(--on-brand-3); }
.fh-ask .btn:not(.primary):hover { background: var(--brand-bg-3); }
/* chat: reply / edit bar, actions, ticks, images, voice, recorder */
.cx-replybar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 4px 6px; border-radius: var(--r-1); background: var(--accent-soft); border-inline-start: 3px solid var(--accent); color: var(--text); }
.cx-replybar .grow { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.cx-replybar .grow span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-msg { position: relative; }
.cx-acts { position: absolute; inset-block-start: -12px; inset-inline-end: 8px; display: none; gap: 2px; padding: 2px; border-radius: var(--r-1); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 2; }
.cx-msg:hover .cx-acts, .cx-msg:focus-within .cx-acts { display: flex; }
@media (hover: none) { .cx-acts { display: flex; position: static; box-shadow: none; border: 0; background: transparent; margin-block-start: 2px; } }
.cx-act { width: 30px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 6px; cursor: pointer; color: var(--muted); }
.cx-act:hover { background: var(--surface-3); color: var(--heading); }
.cx-quote.reply { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: start; border-block: 0; border-inline-end: 0; cursor: pointer; font: inherit; }
.cx-msg.flash .cx-bubble { box-shadow: var(--focus); transition: box-shadow .3s; }
.cx-gone { color: var(--muted); }
.cx-edited { color: var(--muted-2); font-size: 11px; margin-inline-end: 6px; }
.cx-tick { display: inline-flex; color: var(--muted-2); margin-inline-start: 4px; }
.cx-tick.seen { color: var(--accent-text); }
.cx-doc.img { padding: 4px; }
.cx-imgbox { display: grid; place-items: center; width: 100%; min-height: 120px; max-height: 320px; overflow: hidden; border: 0; border-radius: var(--r-1); background: var(--surface-2); cursor: zoom-in; padding: 0; position: relative; }
.cx-imgph { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.cx-img { display: none; max-width: 100%; max-height: 320px; object-fit: contain; }
.cx-imgbox.ready .cx-img { display: block; }
.cx-imgbox.ready .cx-imgph { display: none; }
.cx-full { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--r-1); }
.cx-voice { padding: 6px; }
.cx-play { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.cx-play:hover { border-color: var(--heading); }
.cx-audio { width: 260px; max-width: 100%; height: 40px; }
.cx-rec { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 4px 6px; border-radius: var(--r-1); background: var(--unfav-soft); color: var(--unfav); }
.cx-rec .grow { flex: 1; }
.cx-recdot { width: 10px; height: 10px; border-radius: 50%; background: var(--unfav); animation: fh-pulse 1s infinite; }
@keyframes fh-pulse { 50% { opacity: .3; } }
/* composer: the message box keeps its room when the chat column is narrow (three panes open) */
.cx-comp { container-type: inline-size; }
.cx-comp-row .cx-box { flex: 1 1 auto; min-width: 140px; }
@container (max-width: 640px) {
  .cx-reqbtn span { display: none; }
  .cx-reqbtn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .cx-comp-row { gap: 4px; }
  .cx-comp-row .cx-ibtn { width: 38px; }
}
/* workspace switcher sits above the rail nav (the nav scrolls in its own layer) */
.ws-wrap { z-index: 30; }
.ws-menu { z-index: 31; background: var(--brand-bg-2); isolation: isolate; }
.ws-opt { white-space: nowrap; }
.ws-opt .grow { overflow: hidden; text-overflow: ellipsis; }
.ws-opt .surface-tag { display: none; }

/* dialogs above the mobile menu and the rail; the switcher stays inside the rail's layer */
.modal { z-index: 50; }
.rail { isolation: isolate; }
@media (max-width: 760px) { .cx-find:not([hidden]) { display: block; } }

/* «فهيم AI» card under a document (team only) */
.cx-ai { margin-block-start: 8px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); color: var(--text); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; text-align: start; }
.cx-ai.ok { border-color: var(--x-ok-line); }
.cx-ai.fail { border-style: dashed; }
.cx-ai-h { display: flex; align-items: center; gap: 6px; }
.cx-ai-h b { font-size: 12px; color: var(--heading); letter-spacing: .02em; }
.cx-ai-h .cx-chip { margin-inline-start: auto; }
.cx-ai-ic { width: 18px; height: 18px; display: grid; place-items: center; background: none; color: var(--accent-text); }
.cx-ai-title { font-weight: 700; color: var(--heading); }
.cx-ai-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.cx-ai-grid dt { color: var(--muted); font-size: 12px; }
.cx-ai-grid dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: start; }
.cx-ai-grid dd .num { font-weight: 500; }
.cx-ai-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--muted); padding: 6px 8px; border-radius: var(--r-1); background: var(--surface-2); }
.cx-ai-note.ok { background: var(--accent-soft); color: var(--accent-text); }
.cx-ai-note.warn { background: var(--attn-soft); color: var(--attn); }
.cx-ai-note.crit { background: var(--unfav-soft); color: var(--unfav); }
.cx-ai-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cx-ai-by { display: inline-flex; gap: 4px; align-items: center; color: var(--accent-text); font-size: 12px; margin-inline-end: auto; }
.cx-ai-chk { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin-inline-end: auto; }
.cx-ai-chk input { accent-color: var(--accent); }
.cx-ai-msg { color: var(--muted); }
.cx-ai-dots::after { content: '…'; animation: fh-pulse 1s infinite; }
.cx-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 90px; gap: 10px; }
@media (max-width: 480px) { .row2, .row3 { grid-template-columns: 1fr; } }
.cx-ai-ask { margin-block-start: 6px; }
/* the back arrow is drawn pointing right (back in RTL); in LTR it points left */
[dir="ltr"] .cx-back .ic { transform: scaleX(-1); }

/* ===================================================================== chat, WhatsApp-style (js/chat.js, js/dm.js, js/voice.js)
   WhatsApp's shapes and gestures in FAHEEM's palette: bubbles with a tail on the first of a run, the time and ticks
   tucked into the bubble's corner, reactions sitting on its edge, voice notes with a waveform. */
.cx-thread { background-color: var(--surface-2); background-image: radial-gradient(color-mix(in srgb, var(--accent) 10%, transparent) 1px, transparent 1.3px); background-size: 18px 18px; gap: 3px; }
.cx-msg:not(.cont) { margin-block-start: 6px; }
.cx-bubble { position: relative; display: flow-root; border: 0; border-radius: 10px; padding: 6px 9px 5px; box-shadow: 0 1px .5px rgba(11, 42, 28, .14); }
.cx-msg.out .cx-bubble { background: var(--x-ours); }
.cx-msg.out > .cx-av { display: none; }
/* the tail: on the outer top corner of the first bubble of a run */
.cx-msg:not(.cont) .cx-bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.cx-msg.out:not(.cont) .cx-bubble { border-start-start-radius: 0; }
.cx-msg.in:not(.cont) .cx-bubble { border-start-end-radius: 0; }
.cx-msg.out:not(.cont) .cx-bubble::before { inset-inline-start: -7px; }
.cx-msg.in:not(.cont) .cx-bubble::before { inset-inline-end: -7px; }
[dir=rtl] .cx-msg.out .cx-bubble::before, [dir=ltr] .cx-msg.in .cx-bubble::before { clip-path: polygon(0 0, 100% 0, 0 100%); }
[dir=ltr] .cx-msg.out .cx-bubble::before, [dir=rtl] .cx-msg.in .cx-bubble::before { clip-path: polygon(100% 0, 0 0, 100% 100%); }
/* the time (and ticks) in the corner, on the text's last line when it fits */
.cx-bubble > .cx-tx:has(+ .cx-meta)::after { content: ""; display: inline-block; width: 66px; }
.cx-bubble > .cx-tx:has(+ .cx-meta .cx-edited)::after { width: 112px; }
.cx-bubble > .cx-tx + .cx-meta { float: inline-end; margin-block-start: -15px; margin-inline-start: 8px; position: relative; }
.cx-meta { margin-block-start: 2px; }
.cx-tick:not(.seen) .ic { color: var(--muted); }
.cx-who b { color: var(--accent-text); }
/* reactions: a pill on the bubble's bottom edge */
.cx-msg:has(.cx-reacts) { margin-block-end: 20px; }
.cx-reacts { position: absolute; inset-block-end: -17px; inset-inline-end: 10px; display: flex; align-items: center; gap: 1px; padding: 1px 5px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(11, 42, 28, .16); z-index: 1; }
.cx-msg.in .cx-reacts { inset-inline-end: auto; inset-inline-start: 10px; }
.cx-react { display: inline-flex; align-items: center; gap: 2px; border: 0; background: transparent; padding: 1px 2px; border-radius: var(--r-pill); font-size: 14px; line-height: 1.3; cursor: pointer; }
.cx-react.mine { background: var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent)); }
.cx-react .num { font: 600 11px/1 var(--font-fig); color: var(--muted); }
.dm-react-pick button.on { background: var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent)); }
@media (prefers-reduced-motion: no-preference) { .cx-reacts { animation: fx-pop .3s var(--fx-ease); } }

/* the voice note player */
.cx-doc.voice { border: 0; background: transparent; padding: 2px 0 0; margin: 0; }
.vn { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 8px; width: min(300px, 68vw); }
.vn-av { position: relative; }
.vn-av .cx-av { width: 44px; height: 44px; font-size: 17px; }
.vn-badge { position: absolute; inset-block-end: -2px; inset-inline-end: -3px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); border: 2px solid var(--surface); }
.vn-badge .vn-ic { width: 10px; height: 10px; }
.vn.on .vn-badge { background: var(--accent-hover); }
.vn-ic { width: 22px; height: 22px; flex: none; }
.vn-play { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--heading); cursor: pointer; }
.vn-play .vn-ic { width: 28px; height: 28px; }
.vn-play:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.vn.loading .vn-play { opacity: .5; animation: fh-pulse 1s infinite; }
.vn-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-block-start: 6px; }
.vn-wave { position: relative; display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; touch-action: none; outline: none; }
.vn-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 50%, transparent); transition: background-color .12s; }
.vn-wave i.on { background: var(--accent); }
.vn-wave:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.vn-thumb { position: absolute; top: 50%; inset-inline-start: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); pointer-events: none; }
[dir=rtl] .vn-thumb { transform: translate(50%, -50%); }
.vn-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 18px; font: 500 11px/1 var(--font-fig); color: var(--muted); }
.vn-speed { border: 0; border-radius: var(--r-pill); padding: 3px 7px; background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--text); font: 700 11px/1 var(--font-fig); cursor: pointer; }
.vn-speed[hidden] { display: none; }

/* the recorder bar (replaces the composer row while recording) */
.cx-comp.recording > .cx-comp-row { display: none; }
.cx-rec { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 4px 6px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); color: var(--text); box-shadow: 0 1px 2px rgba(11, 42, 28, .08); }
.cx-rec[hidden] { display: none; }
.vn-rbtn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.vn-rbtn:hover { background: var(--surface-2); color: var(--heading); }
.vn-rbtn.del:hover { color: var(--unfav); }
.vn-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--unfav); animation: fh-pulse 1s infinite; }
.cx-rec.paused .vn-dot { animation: none; opacity: .35; }
.vn-clock { min-width: 42px; font: 600 14px/1 var(--font-fig); color: var(--heading); }
.vn-live { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.vn-live i { width: 3px; flex: none; border-radius: 2px; background: var(--accent); }
.cx-rec.paused .vn-live i { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.vn-rsend { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.vn-rsend:hover { background: var(--accent-hover); }
.cx-send { border-radius: 50%; }
.cx-send .vn-ic { width: 22px; height: 22px; }

/* ===================================================================== Quran radio (js/radio.js)
   FAHEEM's emerald band with champagne: an eight-point star (rub el hizb) emblem, the live dot, one action. */
.qr-card { position: relative; display: flex; align-items: center; gap: 22px; padding: 20px 24px; margin-block: 4px 18px; border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-bg, #0B2A1C), color-mix(in srgb, var(--brand-bg, #0B2A1C) 82%, var(--accent))); color: var(--on-brand, #F4F1E8); box-shadow: 0 10px 28px -18px rgba(11, 42, 28, .7); }
.qr-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: radial-gradient(var(--champ, #C9A96E) 1px, transparent 1.4px); background-size: 16px 16px; }
.qr-mark { position: relative; flex: none; width: 92px; height: 92px; display: grid; place-items: center; }
.qr-star, .qr-star::before { position: absolute; inset: 10px; border: 2px solid var(--champ, #C9A96E); border-radius: 6px; }
.qr-star::before { content: ""; inset: -2px; transform: rotate(45deg); }
.qr-mark b { position: relative; font: 700 34px/1 var(--font-ar, 'Almarai'), serif; color: var(--champ, #C9A96E); }
.qr-card.on .qr-star { animation: qr-turn 24s linear infinite; }
@keyframes qr-turn { to { transform: rotate(360deg); } }
.qr-body { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qr-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qr-top h3 { margin: 0; font-size: 18px; color: var(--champ, #E8D9B5); }
.qr-live { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; background: rgba(255, 255, 255, .1); }
.qr-live i { width: 7px; height: 7px; border-radius: 50%; background: #E5484D; animation: fh-pulse 1.4s infinite; }
.qr-sub, .qr-note, .qr-src { margin: 0; font-size: 13px; opacity: .88; }
.qr-src { font-size: 11.5px; opacity: .6; }
.qr-note:empty { display: none; }
.qr-acts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-block: 6px 2px; }
.qr-play { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 22px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: var(--champ, #E8D9B5); color: #0B2A1C; font: 700 14.5px/1 inherit; transition: transform .18s, filter .2s; }
.qr-play:hover { filter: brightness(1.05); transform: translateY(-1px); }
.qr-play:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.qr-ic { font-size: 13px; }
.qr-site { color: var(--champ, #E8D9B5); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.qr-site:hover { text-decoration: underline; }
@media (max-width: 560px) { .qr-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; } .qr-mark { width: 64px; height: 64px; } .qr-mark b { font-size: 24px; } }
/* the floating chip while it plays (stops it from any page) */
.qr-chip { position: fixed; z-index: 70; inset-block-end: calc(16px + env(safe-area-inset-bottom, 0px)); inset-inline-start: 16px; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 0; border-radius: var(--r-pill); cursor: pointer; background: var(--brand-bg, #0B2A1C); color: var(--champ, #E8D9B5); font: 700 13px/1 inherit; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .5); }
.qr-chip b { font-size: 11px; opacity: .8; }
.qr-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.qr-eq i { width: 3px; height: 100%; border-radius: 1px; background: currentColor; animation: qr-eq .9s ease-in-out infinite; }
.qr-eq i:nth-child(2) { animation-delay: -.3s; } .qr-eq i:nth-child(3) { animation-delay: -.6s; }
.qr-chip.wait .qr-eq i { animation: none; height: 40%; }
@keyframes qr-eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .qr-card.on .qr-star, .qr-eq i, .qr-live i { animation: none; } }
.qr-quote { margin: 2px 0 4px; padding: 8px 12px; border-inline-start: 3px solid var(--champ, #C9A96E); border-radius: 8px; background: rgba(255, 255, 255, .06); display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.7; }
.qr-quote b { font-size: 11.5px; letter-spacing: .02em; color: var(--champ, #E8D9B5); }

/* ===================================================================== prayer times (js/prayer.js)
   A quiet strip on «يومي» and a calm full-screen card at the adhan: emerald, champagne, no alarm colours. */
.pr-strip { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-block: 4px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.pr-head, .pr-ask { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pr-head .grow, .pr-ask .grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.pr-head b, .pr-ask b { color: var(--heading); font-size: 15px; }
.pr-head span, .pr-ask span { color: var(--muted); font-size: 12.5px; }
.pr-ic { font-size: 22px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft, rgba(46, 125, 82, .12)); flex: none; }
.pr-left { color: var(--accent-text); font-family: var(--font-fig); }
.pr-city { min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; max-width: 100%; }
.pr-cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pr-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.pr-cell b { font: 600 15px/1.2 var(--font-fig); color: var(--heading); }
.pr-cell.past { opacity: .55; }
.pr-cell.next { background: var(--brand-bg, #0B2A1C); color: var(--champ, #E8D9B5); }
.pr-cell.next b { color: #fff; }
.pr-over { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(4, 16, 9, .72); backdrop-filter: blur(3px); }
.pr-o-card { position: relative; width: min(440px, 100%); padding: 30px 26px 24px; border-radius: 24px; text-align: center; color: #F4F1E8; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #17503A 0%, #0B2A1C 62%); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pr-o-star { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-block-end: 6px; }
.pr-o-star span, .pr-o-star span::before { position: absolute; inset: 8px; border: 2px solid var(--champ, #C9A96E); border-radius: 6px; }
.pr-o-star span::before { content: ""; inset: -2px; transform: rotate(45deg); }
.pr-o-star b { position: relative; font-size: 30px; }
.pr-o-kick { margin: 0; font-size: 13px; opacity: .8; }
.pr-o-card h2 { margin: 0; font-size: 30px; color: var(--champ, #E8D9B5); }
.pr-o-city { margin: 0; font-size: 13px; opacity: .75; }
.pr-o-line { margin: 10px 0 2px; font-size: 16px; line-height: 1.8; }
.pr-o-note { margin: 0; font-size: 12.5px; opacity: .78; line-height: 1.7; }
.pr-o-count { display: flex; align-items: baseline; gap: 8px; margin-block: 12px 6px; }
.pr-o-count span { font-size: 12.5px; opacity: .75; }
.pr-o-left { font: 600 34px/1 var(--font-fig); color: #fff; }
.pr-o-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-block-start: 6px; }
.pr-o-acts .btn { min-height: 44px; }
.pr-o-acts .btn:not(.primary) { background: transparent; color: #F4F1E8; border-color: rgba(255, 255, 255, .3); }
@media (prefers-reduced-motion: no-preference) { .pr-o-card { animation: fx-pop .45s var(--fx-ease); } .pr-o-star span { animation: qr-turn 30s linear infinite; } }
@media (max-width: 520px) { .pr-cells { grid-template-columns: repeat(5, minmax(56px, 1fr)); overflow-x: auto; } .pr-head .btn, .pr-head .pr-city { width: 100%; } }

/* ===================================================================== «يوم الفريق» (control.js renderDay)
   One row per person: who, what now, the day's total; then the day as a timeline (work in the client's colour,
   prayer breaks in champagne, ✓ where a task was finished, a line at «now»). The timeline scrolls on a phone. */
.dy-board { padding: 6px 0 10px; }
.dy-scale, .dy-row { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 0 16px; align-items: center; padding-inline: 16px; }
.dy-hours, .dy-track { position: relative; }
.dy-hours { height: 26px; }
.dy-hours span { position: absolute; top: 4px; transform: translateX(50%); font-size: 11px; color: var(--muted); }
[dir=ltr] .dy-hours span { transform: translateX(-50%); }
.dy-row { padding-block: 10px; border-top: 1px solid var(--line); }
.dy-row.off, .dy-row.idle { --dy-a: .9; }
.dy-who { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; border-radius: 10px; }
.dy-who:hover { background: var(--surface-2); }
.dy-who:focus-visible { outline: none; box-shadow: var(--focus); }
.dy-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dy-id b { font-size: 14px; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dy-on { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--accent-text); }
.dy-on.gold { color: #9A7B3F; }
.dy-pulse { display: inline-block; width: 7px; height: 7px; margin-inline-end: 5px; border-radius: 50%; background: var(--accent); vertical-align: middle; animation: fh-pulse 1.4s infinite; }
.dy-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.dy-sum b { font: 600 16px/1 var(--font-fig); color: var(--heading); }
.dy-tl { min-width: 0; overflow-x: auto; overflow-y: hidden; padding-block: 12px 4px; scrollbar-width: thin; }
.dy-track { height: 34px; border-radius: 9px; background: var(--surface-2); min-width: 420px; }
.dy-grid { position: absolute; inset: 0; display: flex; justify-content: space-between; pointer-events: none; }
.dy-grid i { width: 1px; background: var(--line); opacity: .7; }
.dy-seg { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; min-width: 3px; }
.dy-seg.live { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
.dy-seg.pray, .dy-dot.pray { background: repeating-linear-gradient(135deg, #C9A96E 0 5px, #E6D3A7 5px 10px); }
/* work colours: one per client, readable on both themes (champagne is kept for prayer) */
.t0 { background: #8FA39A; }
.t1 { background: #2FA36B; } .t2 { background: #4E8FD0; } .t3 { background: #E0874F; }
.t4 { background: #9B74D4; } .t5 { background: #2FB3B0; } .t6 { background: #DB6687; }
.dy-done { position: absolute; top: -9px; transform: translateX(50%); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--accent); color: var(--on-accent); border: 2px solid var(--surface); }
[dir=ltr] .dy-done { transform: translateX(-50%); }
.dy-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #E5484D; border-radius: 2px; }
.dy-now::before { content: ""; position: absolute; top: -3px; inset-inline-start: -3px; width: 8px; height: 8px; border-radius: 50%; background: #E5484D; }
.dy-more { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-block-start: 10px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.dy-more[hidden] { display: none; }
.dy-col { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dy-col h4 { margin: 0; font-size: 13px; color: var(--heading); }
.dy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dy-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dy-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dy-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dy-eod p { margin: 0 0 4px; font-size: 13px; line-height: 1.7; }
.dy-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px 2px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.dy-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dy-done-k { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; background: var(--accent); color: var(--on-accent); }
.dy-quiet { margin-block-start: 12px; }
.dy-quiet summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 8px 4px; }
.dy-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.dy-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 12.5px; }
.ct-chip.gold { background: color-mix(in srgb, #C9A96E 22%, transparent); color: #7A5F2B; }
@media (max-width: 900px) {
  .dy-scale { display: none; }
  .dy-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-inline: 12px; }
  .dy-more { grid-template-columns: minmax(0, 1fr); }
  .dy-track { min-width: 520px; }
}

/* task checklist + comments (team.js taskDetail) */
.tm-chk { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-chk li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.tm-chk li:hover { background: var(--surface-2); }
.tm-chk label { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; font-size: 13.5px; }
.tm-chk input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.tm-chk li.on span { text-decoration: line-through; color: var(--muted); }
.tm-chk-prog { height: 6px; margin-block: 4px; }
.tm-notes { display: flex; flex-direction: column; gap: 8px; margin-block: 6px; max-height: 260px; overflow-y: auto; }
.tm-note-row { display: flex; gap: 8px; align-items: flex-start; }
.tm-note-b { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.tm-note-row.mine .tm-note-b { background: var(--x-ours); }
.tm-note-b p { margin: 2px 0 0; white-space: pre-wrap; }
.tm-note-new { display: flex; gap: 8px; align-items: flex-end; }
.tm-note-new textarea { flex: 1; min-width: 0; }
.tm-files.ok { color: var(--accent-text); }

/* ===================================================================== phone & tablet pass (Nov 2026)
   Measured at 360 / 390 / 768 / 1024: nothing may push the page sideways, the page title always shows, controls
   stay ≥ 44 px to tap, and long cards fold instead of overflowing. */
html, body { overflow-x: clip; }
@media (max-width: 900px) {
  /* the top bar: the page title takes the room; install / notifications live in the bottom prompt and «حسابي» */
  .topbar #top-extras { display: none; }
  .topbar > .grow { display: none; }
  .topbar .crumb { flex: 1; min-width: 0; }
  .topbar .crumb b { display: block; min-width: 0; }
  .topbar .search-btn { flex: none; width: 44px; height: 44px; min-width: 44px; padding: 0; justify-content: center; }
  .topbar .icon-btn, .topbar .burger { width: 44px; height: 44px; flex: none; }
}
@media (max-width: 760px) {
  /* tasks: the columns stack (to do, then doing, then the summary) instead of a sideways strip */
  .tm-kanban.tasks { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); grid-auto-columns: auto; overflow: visible; scroll-snap-type: none; }
  /* the Quran radio: tighter on a phone */
  .qr-card { padding: 16px; gap: 8px; border-radius: 16px; }
  .qr-mark { display: none; }
  .qr-sub, .qr-src { display: none; }
  .qr-quote { font-size: 13.5px; }
  .qr-play { min-height: 44px; flex: 1; justify-content: center; }
  .qr-acts { gap: 12px; width: 100%; }
  /* the notifications prompt: a slim bar, never a block over the content */
  .fh-ask { inset-inline: 8px; padding: 10px 12px; gap: 8px; }
  .fh-ask .grow span { display: none; }
  /* forms and dialogs use the whole width */
  .modal > .card { width: min(100vw - 16px, 640px); max-height: calc(100dvh - 24px); }
  .row { flex-wrap: wrap; }
  .row > .field { flex: 1 1 140px; min-width: 0; }
  /* tables scroll inside their card, never the page */
  .ct-scroll, .tm-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* KPI strips: two per row */
  .ct-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .ct-kpi { min-width: 0; }
  .ct-kpi .v { font-size: 22px; }
  /* page headers: actions wrap under the title */
  .ct-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .ct-actions { flex-wrap: wrap; }
  .ct-actions > * { flex: 1 1 auto; }
}
@media (max-width: 380px) {
  .ct-kpis { grid-template-columns: minmax(0, 1fr) !important; }
}
/* tasks filters: «فلترة» is a plain label on a wide screen, a toggle on a phone */
button.tm-filter.lbl { border: 0; background: transparent; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 6px; cursor: default; padding: 0; }
.tm-fn { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; display: inline-grid; place-items: center; }
@media (max-width: 760px) {
  button.tm-filter.lbl { cursor: pointer; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .tm-filters:not(.open) > label.tm-filter, .tm-filters:not(.open) > .tm-stack, .tm-filters:not(.open) > input[type=search], .tm-filters:not(.open) > .grow { display: none; }
  .tm-filters { flex-wrap: wrap; gap: 8px; }
  .tm-filters.open > label.tm-filter, .tm-filters.open > input[type=search] { flex: 1 1 100%; }
  /* the notifications prompt sits at the top on a phone (never over a message box) */
  .fh-ask { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 62px); }
  body:has(.cx.in-chat) .fh-ask, body:has(.dm-main) .fh-ask { display: none; }
}
body:has(.modal) .fh-ask, body:has(.pr-over) .fh-ask { display: none; }

/* ================================================================== v0.24 client onboarding (js/onboarding.js)
   «ابدأ مع فهيم» on the portal home, the first-login welcome, the install help; the owner's «بداية العميل» card. */
.onb { margin-block: 4px 18px; padding: 0; overflow: hidden; }
.onb-head { display: flex; align-items: center; gap: 16px; padding: 16px var(--sp-4) 12px; border-block-end: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-soft, var(--em-06)), transparent 70%); }
.onb-art { width: 64px; height: 64px; object-fit: contain; flex: none; }
.onb-head h2 { margin: 2px 0 8px; font-size: 18px; font-weight: 800; color: var(--heading); }
.onb-k { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--accent-text, var(--accent)); }
.onb-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3, var(--line)); overflow: hidden; max-width: 360px; }
.onb-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--champ, #C9A96E)); transition: width .5s ease; }
[dir="rtl"] .onb-bar > span { background: linear-gradient(270deg, var(--accent), var(--champ, #C9A96E)); }
.onb-x { align-self: flex-start; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.onb-x:hover { background: var(--surface-2); color: var(--text); }
.onb-x:focus-visible { box-shadow: var(--focus); outline: none; }
.onb-steps { list-style: none; margin: 0; padding: 6px var(--sp-4) 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.onb-step { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-block-end: 1px dashed var(--line); min-width: 0; }
.onb-step .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.onb-step b { font-size: 14px; font-weight: 700; color: var(--heading); display: flex; align-items: center; gap: 8px; }
.onb-n { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); }
.onb-ic { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.onb-step.next .onb-ic { background: var(--accent-soft, var(--em-10)); box-shadow: 0 0 0 2px var(--accent) inset; }
.onb-step.done .onb-ic { background: var(--accent); color: var(--on-accent, #fff); }
.onb-step.done b { color: var(--muted); font-weight: 600; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.onb-step .btn { flex: none; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .onb-bar > span { transition: none; } }
/* the card has its own «فعّل الإشعارات» step: no second prompt on top of it */
body:has(.onb) .fh-ask { display: none; }

/* first sign-in */
.onb-wel .card { max-width: 640px; }
.onb-wel-top { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: var(--r-2);
  background: linear-gradient(135deg, var(--brand-bg, #0B2A1C), color-mix(in srgb, var(--brand-bg, #0B2A1C) 80%, var(--accent))); color: var(--on-brand, #F4F1E8); }
.onb-wel-top p { margin: 0; font-size: 15px; line-height: 1.75; }
.onb-wel-art { width: 92px; height: 92px; object-fit: contain; flex: none; }
.onb-how3 { list-style: none; margin: 16px 0 4px; padding: 0; display: grid; gap: 12px; }
.onb-how3 li { display: flex; gap: 12px; align-items: flex-start; }
.onb-how3 li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.onb-how3 b { font-size: 14px; color: var(--heading); }
.onb-team h3 { margin: 16px 0 10px; font-size: 14px; font-weight: 800; color: var(--heading); }
.onb-tm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-block-end: 16px; }
.onb-tm { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface-2); min-width: 0; }
.onb-tm b { font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onb-wel .row .btn.primary { min-width: 160px; justify-content: center; }

/* install help */
.onb-how { list-style: none; margin: 12px 0 16px; padding: 0; display: grid; gap: 10px; }
.onb-hs { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.onb-hn { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--on-accent, #fff); font-size: 13px; font-weight: 800; }

/* owner: wizard option + «بداية العميل» */
.ct-starter { display: flex; align-items: flex-start; gap: 10px; margin-block: 12px 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface-2); cursor: pointer; }
.ct-starter input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--accent); }
.ct-starter > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ct-checklist.ct-onb { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 22px; padding: 12px 16px 14px; }
.ct-checklist.ct-onb li > span:last-child { max-width: none; }

@media (max-width: 760px) {
  .onb-steps { grid-template-columns: 1fr; }
  .onb-head { padding: 14px 14px 10px; gap: 12px; }
  .onb-art { width: 52px; height: 52px; }
  .onb-head h2 { font-size: 16px; }
  .onb-steps { padding-inline: 14px; }
  .onb-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: start; }
  .onb-step .btn { grid-column: 2; justify-self: start; }
  .onb-wel-top { flex-direction: column; text-align: center; }
  .onb-wel-art { width: 76px; height: 76px; }
  .onb-tm-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-checklist.ct-onb { grid-template-columns: 1fr; }
}
@media (min-width: 761px) and (max-width: 1100px) { .ct-checklist.ct-onb { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ================================================================== v0.24.1 the app name «Faheem Solutions» (owner rule:
   F and S capital, the rest small, never Arabic) — Latin type in both languages, the monogram beside it */
.rail-name[lang="en"] { font-family: var(--font-la); letter-spacing: .01em; font-size: 17px; text-transform: none; }
.rail-name[lang="en"] small { font-family: var(--font-la); letter-spacing: .04em; text-transform: none; }
.au-name { align-self: flex-start; display: flex; align-items: center; gap: 14px; color: var(--on-brand, #F4F1E8); }
.au-mark { width: 46px; height: auto; flex: none; }
.au-name > span { display: flex; flex-direction: column; font-family: var(--font-la); font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: .005em; text-transform: none; }
.au-name small { font-size: 14px; font-weight: 700; letter-spacing: .06em; color: var(--champ, #C9A96E); margin-top: 4px; text-transform: none; }
@media (max-width: 760px) { .au-mark { width: 34px; } .au-name > span { font-size: 22px; } .au-name small { font-size: 12px; } }

/* v0.24.2 — every team member picks their city first; who has not, on the team day board */
.pr-pick .pr-o-line { margin-bottom: 16px; }
.pr-pick-sel { margin: 4px 0 14px; }
.pr-pick-sel .pr-city { width: 100%; min-height: 50px; font-size: 15.5px; font-weight: 700; border-radius: 14px; text-align: center; text-align-last: center;
  background: rgba(244, 241, 232, .96); color: #0B2A1C; border: 2px solid var(--champ, #C9A96E); }
.pr-pick-sel .pr-city:focus-visible { outline: 3px solid color-mix(in srgb, var(--champ, #C9A96E) 60%, transparent); outline-offset: 2px; }
.dy-nocity { border-color: color-mix(in srgb, var(--warn, #C98A2B) 55%, var(--line)); }
.dy-nocity p { margin: 0 0 10px; line-height: 1.7; }

/* v0.25 «تقرير الأسبوع» */
.ct-kpis-b { margin-top: -6px; }
.wk-lines { list-style: none; margin: 0; padding: 10px 16px 14px; display: grid; gap: 10px; }
.wk-lines li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.7; }
.wk-ic { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft, var(--em-06)); color: var(--accent); }
.wk-lines li.warn .wk-ic { background: color-mix(in srgb, var(--warn, #C98A2B) 16%, transparent); color: var(--warn, #C98A2B); }
.ct-table tr.wk-quiet td:first-child { box-shadow: inset -3px 0 0 var(--warn, #C98A2B); }
[dir="ltr"] .ct-table tr.wk-quiet td:first-child { box-shadow: inset 3px 0 0 var(--warn, #C98A2B); }

/* v0.25 «السعة والحدود» (integrations) */
.cap-card { grid-column: 1 / -1; }
.cap-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 16px 6px; }
.cap-box { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-2, 12px); background: var(--surface-2); min-width: 0; }
.cap-box > b { font-size: 20px; font-weight: 800; color: var(--heading); }
.cap-bar { height: 7px; border-radius: 99px; background: var(--surface-3, var(--line)); overflow: hidden; }
.cap-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.cap-bar > span.warn { background: var(--warn, #C98A2B); } .cap-bar > span.crit { background: var(--crit, #B4442E); }
.cap-counts { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; padding: 8px 16px 12px; }
.cap-counts > div { display: flex; flex-direction: column; gap: 2px; text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); }
.cap-counts b { font-size: 17px; color: var(--heading); }
.cap-l { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
@media (max-width: 1100px) { .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cap-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cap-grid { grid-template-columns: 1fr; } .cap-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* v0.25 loading skeleton + error state (shell.js) */
.sk-wait { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sk-page { padding: 22px clamp(14px, 2.4vw, 28px); display: grid; gap: 16px; max-width: 1400px; }
.sk { border-radius: 14px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 60%, var(--line)) 50%, var(--surface-2) 75%);
  background-size: 220% 100%; animation: sk-shine 1.3s ease-in-out infinite; }
.sk-head { display: grid; gap: 8px; }
.sk-t { height: 26px; width: min(320px, 70%); }
.sk-s { height: 14px; width: min(480px, 90%); border-radius: 8px; }
.sk-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sk-kpi { height: 92px; }
.sk-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.sk-col { display: grid; gap: 16px; align-content: start; }
.sk-card { height: 220px; } .sk-card.sm { height: 130px; }
@keyframes sk-shine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
@media (max-width: 760px) { .sk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sk-cols { grid-template-columns: 1fr; } .sk-card { height: 160px; } }
.err-state { max-width: 460px; margin: 48px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.err-state h2 { margin: 6px 0 0; font-size: 20px; color: var(--heading); }
.err-state p { margin: 0 0 8px; color: var(--muted); line-height: 1.7; }
.err-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--warn, #C98A2B) 14%, transparent); color: var(--warn, #C98A2B); }
.err-ic svg { width: 26px; height: 26px; }

/* v0.25 «الربط مع Claude» */
.cl-tools { display: grid; gap: 14px; padding: 12px 16px 16px; }
.cl-tools h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--heading); }
.cl-tools ul, .cl-safe { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.7; }
.cl-safe { padding: 12px 34px 16px 16px; } [dir="ltr"] .cl-safe { padding: 12px 16px 16px 34px; }
.cl-steps { display: grid; gap: 12px; margin: 14px 0; }
.cl-step { border: 1px solid var(--line); border-radius: var(--r-2, 12px); padding: 12px 14px; background: var(--surface-2); display: grid; gap: 8px; }
.cl-step h4 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--heading); }
.cl-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent, #fff); font-size: 12.5px; font-weight: 800; flex: none; }
.cl-copy { display: grid; gap: 4px; min-width: 0; }
.cl-copy-row { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.cl-code { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font: 12px/1.6 var(--mono, ui-monospace, monospace); overflow-wrap: anywhere; text-align: left; user-select: all; }
.cl-scopes { display: grid; gap: 8px; }
.cl-scope { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.cl-scope:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, var(--em-06)); }
.cl-scope input { margin-top: 3px; accent-color: var(--accent); }
.cl-scope > span { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 560px) { .cl-copy-row { flex-direction: column; } }

/* ================================================================== v0.25 motion (brand §10, web-motion-standard T0/T1)
   transform + opacity only; nothing moves under reduced motion; horizontal motion mirrors in RTL */
:root { --motion-dur: .38s; --motion-dur-fast: .22s; --motion-ease: cubic-bezier(.22, 1, .36, 1); --motion-rise: 10px; --motion-stagger: 35ms; }
.fx-wait { opacity: 0; transform: translateY(16px); }
@media (prefers-reduced-motion: reduce) { .fx-wait { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .cx-msg.fx-new { animation: fx-msg .34s var(--motion-ease) both; transform-origin: bottom right; }
  [dir="rtl"] .cx-msg.out.fx-new, [dir="ltr"] .cx-msg.in.fx-new { transform-origin: bottom left; }
  @keyframes fx-msg { from { opacity: 0; transform: translateY(10px) scale(.96); } }
  .pt-list > *, .pt-tm { transition: transform .25s var(--motion-ease), background-color .2s; }
  .pt-list > *:hover, .pt-tm:hover { transform: translateY(-2px); }
  .toast { animation: fx-toast .42s var(--motion-ease) both; }
  @keyframes fx-toast { from { opacity: 0; transform: translateY(18px) scale(.97); } }
}
/* phones: dialogs are bottom sheets that rise from the edge, like a native app */
@media (max-width: 760px) {
  .modal { align-items: end; padding: 0; }
  .modal > .card { width: 100%; max-width: none; border-radius: 22px 22px 0 0; max-height: 92dvh; overflow: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal > .card::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 0; }
}
@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  .modal > .card { animation: fx-sheet .42s var(--motion-ease) both; }
  @keyframes fx-sheet { from { transform: translateY(100%); } }
}
/* the top bar lifts off the page once the page scrolls (scroll-driven, where the browser supports it) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .app { timeline-scope: --page; }
    #main { scroll-timeline: --page block; }
    .topbar { animation: fx-bar linear both; animation-timeline: --page; animation-range: 0 64px; }
    @keyframes fx-bar { to { box-shadow: 0 10px 24px -18px rgba(11, 42, 28, .55); } }
  }
}

.onb-bar > span, .cap-bar > span { transform-origin: right center; }
[dir="ltr"] .onb-bar > span, [dir="ltr"] .cap-bar > span { transform-origin: left center; }
.cap-v { font-weight: 700; color: var(--heading); white-space: nowrap; }

/* ================================================================== v0.26 projects · approvals · workload (js/projects.js) */
.tm-note.info { background: color-mix(in srgb, var(--info, #2F6FA3) 10%, transparent); border-color: color-mix(in srgb, var(--info, #2F6FA3) 30%, transparent); }
.tm-note.warn { background: color-mix(in srgb, var(--warn, #C98A2B) 12%, transparent); border-color: color-mix(in srgb, var(--warn, #C98A2B) 35%, transparent); }
.pj-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pj-chip.ok { background: var(--accent-soft, var(--em-10)); color: var(--accent-text, var(--accent)); }
.pj-chip.info { background: color-mix(in srgb, var(--info, #2F6FA3) 14%, transparent); color: var(--info, #2F6FA3); }
.pj-chip.warn { background: color-mix(in srgb, var(--warn, #C98A2B) 16%, transparent); color: var(--warn, #C98A2B); }
.pj-chip.crit { background: color-mix(in srgb, var(--crit, #B4442E) 14%, transparent); color: var(--crit, #B4442E); }
.pj-chip svg { width: 13px; height: 13px; }
.pj-sel { width: auto; min-width: 180px; }
.pj-code { font: 700 11.5px/1 var(--font-fig, monospace); padding: 4px 7px; border-radius: 6px; background: var(--surface-2); color: var(--heading); }
.pj-bar { flex: 1; height: 7px; border-radius: 99px; background: var(--surface-3, var(--line)); overflow: hidden; min-width: 60px; }
.pj-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.pj-bar.late > span { background: var(--crit, #B4442E); } .pj-bar.watch > span { background: var(--warn, #C98A2B); }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pj-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-2, 14px); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0;
  box-shadow: inset 3px 0 0 var(--accent); transition: transform .25s var(--motion-ease, ease), box-shadow .25s; }
[dir="rtl"] .pj-card { box-shadow: inset -3px 0 0 var(--accent); }
[dir="rtl"] .pj-card.late { box-shadow: inset -3px 0 0 var(--crit, #B4442E); } [dir="ltr"] .pj-card.late { box-shadow: inset 3px 0 0 var(--crit, #B4442E); }
[dir="rtl"] .pj-card.watch { box-shadow: inset -3px 0 0 var(--warn, #C98A2B); } [dir="ltr"] .pj-card.watch { box-shadow: inset 3px 0 0 var(--warn, #C98A2B); }
[dir="rtl"] .pj-card.done { box-shadow: inset -3px 0 0 var(--line); } [dir="ltr"] .pj-card.done { box-shadow: inset 3px 0 0 var(--line); }
@media (prefers-reduced-motion: no-preference) { .pj-card:hover { transform: translateY(-2px); } }
.pj-card:focus-visible { outline: none; box-shadow: var(--focus); }
.pj-card-h { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pj-client { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-title { font-size: 16px; font-weight: 800; color: var(--heading); }
.pj-sub { font-size: 12px; color: var(--muted); }
.pj-prog { display: flex; align-items: center; gap: 10px; } .pj-prog b { font-size: 13px; color: var(--heading); }
.pj-facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.pj-facts .info { color: var(--info, #2F6FA3); } .pj-facts .warn { color: var(--warn, #C98A2B); } .pj-facts .crit { color: var(--crit, #B4442E); font-weight: 700; }
.pj-tpls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pj-tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; text-align: start; }
.pj-tpl.on { border-color: var(--accent); background: var(--accent-soft, var(--em-06)); box-shadow: 0 0 0 1px var(--accent) inset; }
.pj-extra { display: grid; gap: 10px; }
.pj-plan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); max-height: 220px; overflow: auto; }
.pj-plan ul { margin: 4px 0 0; padding-inline-start: 18px; display: grid; gap: 2px; }
.pj-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pj-check input { margin-top: 4px; accent-color: var(--accent); } .pj-check > span { display: flex; flex-direction: column; gap: 2px; }
.pj-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pj-head .card-b { padding: 16px 18px; }
.pj-head-row { display: flex; align-items: center; gap: 18px; }
.pj-ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3, var(--line)) 0); }
.pj-ring b { font-size: 18px; color: var(--heading); }
.pj-head-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.pj-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pj-kpi { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.pj-kpi b { font-size: 17px; color: var(--heading); }
.pj-kpi.info b { color: var(--info, #2F6FA3); } .pj-kpi.warn b { color: var(--warn, #C98A2B); } .pj-kpi.crit b { color: var(--crit, #B4442E); }
.pj-phase .card-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pj-phase .card-h h2 { flex: 1; min-width: 0; font-size: 15px; }
.pj-ph-meta { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.pj-rows { display: flex; flex-direction: column; }
.pj-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: start; cursor: pointer; font: inherit; }
.pj-row:last-child { border-bottom: 0; }
.pj-row:hover { background: var(--surface-2); }
.pj-row.static { cursor: default; } .pj-row.static:hover { background: transparent; }
.pj-row.done .pj-rt b { color: var(--muted); font-weight: 600; }
.pj-row.mine { box-shadow: inset 3px 0 0 var(--accent); } [dir="rtl"] .pj-row.mine { box-shadow: inset -3px 0 0 var(--accent); }
.pj-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed var(--muted-2, var(--line)); flex: none; display: grid; place-items: center; }
.pj-row.done .pj-dot { background: var(--accent); border: 0; color: var(--on-accent, #fff); }
.pj-dot svg { width: 12px; height: 12px; }
.pj-rt { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .pj-rt b { font-size: 14px; }
.pj-rt.linkish { border: 0; background: transparent; padding: 0; cursor: pointer; color: inherit; font: inherit; text-align: start; }
.pj-who { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 170px; }
.pj-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-due { width: 88px; color: var(--muted); }
.pj-acts { display: flex; gap: 6px; flex: none; }
.pj-empty { padding: 12px 16px; margin: 0; }
.pj-wl td { vertical-align: middle; }
.pj-load { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.pj-note { padding: 10px 16px; margin: 0; }
/* the client's «شغلنا عليكم» */
.pj-cl-list { display: grid; gap: 14px; padding: 12px 16px 16px; }
.pj-cl { display: grid; gap: 8px; }
.pj-cl-h { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pj-cl-h b:first-child { font-size: 14.5px; color: var(--heading); }
.pj-steps { list-style: none; margin: 2px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.pj-steps li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); min-width: 0; flex-wrap: wrap; }
.pj-sdot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.pj-steps li.done .pj-sdot { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.pj-steps li.doing .pj-sdot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--accent-soft, var(--em-10)); }
.pj-sdot svg { width: 11px; height: 11px; }
@media (max-width: 760px) {
  .pj-grid { grid-template-columns: 1fr; }
  .pj-tpls, .pj-plan, .pj-2 { grid-template-columns: 1fr; }
  .pj-head-row { flex-direction: column; align-items: stretch; } .pj-ring { align-self: center; }
  .pj-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-ph-meta { min-width: 0; width: 100%; }
  .pj-row { flex-wrap: wrap; row-gap: 6px; }
  .pj-rt { flex-basis: calc(100% - 34px); }
  .pj-who { max-width: none; margin-inline-start: 32px; } .pj-due { width: auto; }
  .pj-row.static .pj-acts { width: 100%; justify-content: flex-end; }
  .pj-sel { min-width: 0; width: 100%; }
}
.pj-scroll { overflow-x: auto; }
.pj-wl { width: 100%; border-collapse: collapse; min-width: 860px; font-size: 13.5px; }
.pj-wl th { text-align: start; padding: 11px 12px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; background: color-mix(in srgb, var(--line) 30%, transparent); }
.pj-wl td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pj-wl tr:last-child td { border-bottom: 0; }
.pj-wl td.num { font-variant-numeric: tabular-nums; }

/* ================================================================== v0.27 approvals · ratings · score · calendar (js/phase2.js) */
.ap-list { display: grid; gap: 0; }
.ap-row { display: grid; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ap-row:last-child { border-bottom: 0; }
.ap-row.pending { background: color-mix(in srgb, var(--warn, #C98A2B) 6%, transparent); }
.ap-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ap-top b { font-size: 15px; color: var(--heading); }
.ap-note { margin: 0; line-height: 1.7; }
.ap-files { display: flex; flex-wrap: wrap; gap: 8px; }
.ap-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 12.5px; }
.ap-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ap-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-body { display: grid; gap: 10px; padding: 12px 16px 16px; }
.rt-stars { display: flex; gap: 6px; direction: ltr; justify-content: flex-end; }
[dir="ltr"] .rt-stars { justify-content: flex-start; }
.rt-star { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted-2, var(--line)); font-size: 24px; line-height: 1; cursor: pointer; }
.rt-star.on { color: var(--champ, #C2B49A); border-color: var(--champ, #C2B49A); background: color-mix(in srgb, var(--champ, #C2B49A) 14%, transparent); }
.rt-score { flex: none; min-width: 46px; text-align: center; padding: 4px 8px; border-radius: 10px; font-weight: 800; background: var(--accent-soft, var(--em-10)); color: var(--accent-text, var(--accent)); }
.rt-score.low { background: color-mix(in srgb, var(--crit, #B4442E) 14%, transparent); color: var(--crit, #B4442E); }
.sc-in { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.sc-in > .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sc-parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.sc-part { display: grid; gap: 4px; }
.cal .cal-head, .cal .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head span { padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.cal-day { min-height: 108px; padding: 6px; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-inline-end: 0; }
.cal-day.blank { background: color-mix(in srgb, var(--line) 25%, transparent); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-n { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-day.today .cal-n { color: var(--accent); }
.cal-t { display: block; width: 100%; padding: 3px 6px; border: 0; border-radius: 6px; font: inherit; font-size: 11.5px; text-align: start; cursor: pointer; overflow: hidden; }
.cal-t span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-t.open, .cal-dot.open { background: var(--surface-2); color: var(--text); }
.cal-t.mine, .cal-dot.mine { background: var(--accent-soft, var(--em-10)); color: var(--accent-text, var(--accent)); }
.cal-t.review, .cal-dot.review { background: color-mix(in srgb, var(--info, #2F6FA3) 16%, transparent); color: var(--info, #2F6FA3); }
.cal-t.late, .cal-dot.late { background: color-mix(in srgb, var(--crit, #B4442E) 16%, transparent); color: var(--crit, #B4442E); }
.cal-t.done, .cal-dot.done { background: transparent; color: var(--muted); text-decoration: line-through; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 2px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-dot { width: 14px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .sc-in { flex-direction: column; align-items: stretch; } .sc-in .pj-ring { align-self: center; }
  .sc-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-t { padding: 2px 3px; font-size: 10px; }
  .cal-head span { font-size: 10.5px; padding: 6px 2px; }
  .rt-stars { justify-content: center; }
}

/* ------------------------------------------------------------------ v0.28 · chat the WhatsApp way (js/chatx.js, chat.js, dm.js) */
/* the channel files panel: tucked away by default, opened from the header, its inner edge drags to resize (chat.js panelGrip) */
.cx { grid-template-columns: 268px minmax(0, 1fr) var(--cx-pw, 288px); }
.cx.hide-panel { grid-template-columns: 268px minmax(0, 1fr); }
.cx-panel { position: relative; }
.cx-panel-x { display: inline-grid; }
.cx-info[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.cx-grip { position: absolute; inset-block: 0; inset-inline-start: -5px; width: 10px; cursor: col-resize; z-index: 3; touch-action: none; }
.cx-grip::after { content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: 4px; width: 2px; height: 40px; margin-block-start: -20px; border-radius: 2px; background: var(--line); transition: background .15s, height .15s, margin .15s; }
.cx-grip:hover::after, .cx-grip:focus-visible::after, .cx.resizing .cx-grip::after { background: var(--accent); height: 72px; margin-block-start: -36px; }
.cx-grip:focus-visible { outline: none; }
.cx.resizing { cursor: col-resize; user-select: none; }
.cx.will-hide .cx-panel { opacity: .4; transition: opacity .12s; }
@media (max-width: 1279px) {
  .cx, .cx.hide-panel { grid-template-columns: 270px minmax(0, 1fr); }
  .cx-grip { display: none; }
}
@media (max-width: 760px) { .cx, .cx.hide-panel { grid-template-columns: minmax(0, 1fr); } }

/* swipe to reply: the message slides, the reply arrow fills in behind it */
.cx-msg { touch-action: pan-y; }
.cx-swipe { position: absolute; inset-block-start: 50%; inset-inline-start: 6px; width: 30px; height: 30px; margin-block-start: -15px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow); opacity: var(--sw, 0); transform: scale(calc(.5 + var(--sw, 0) * .5)); pointer-events: none; }
.cx-msg:not(.swipe-on) .cx-swipe { visibility: hidden; }
/* phones: no hover toolbar under every bubble; press and hold opens the sheet instead */
@media (hover: none) { .cx-acts { display: none !important; } }
.cx-tick { cursor: pointer; }
.cx-msg[data-mine] .cx-tick:hover { color: var(--accent-text); }

/* the actions sheet and «معلومات الرسالة» (a centred card on computers, a bottom sheet on phones) */
.cx-sheet-bg { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--heading) 30%, transparent); }
.cx-sheet { width: min(340px, 100%); max-height: min(82vh, 680px); overflow: auto; overscroll-behavior: contain; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; }
.cx-sheet-reacts { display: flex; justify-content: space-between; gap: 4px; padding: 6px 4px 10px; margin-block-end: 6px; border-block-end: 1px solid var(--line); }
.cx-sheet-reacts button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; line-height: 1; cursor: pointer; transition: transform .15s; }
.cx-sheet-reacts button:hover, .cx-sheet-reacts button:focus-visible { transform: scale(1.14); outline: none; }
.cx-sheet-reacts button.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cx-sheet-list { display: flex; flex-direction: column; }
.cx-sheet-it { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; font-weight: 600; text-align: start; cursor: pointer; }
.cx-sheet-it:hover, .cx-sheet-it:focus-visible { background: var(--surface-2); outline: none; }
.cx-sheet-it .ic { color: var(--muted); }
.cx-sheet-it.danger, .cx-sheet-it.danger .ic { color: var(--unfav); }
.cx-sheet.mi { width: min(420px, 100%); padding: 0; }
.mi-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; background: var(--surface); border-block-end: 1px solid var(--line); }
.mi-head b { font-size: 16px; color: var(--heading); }
.mi-x { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.mi-bubble { margin: 14px 16px; padding: 10px 12px 8px; border-radius: 12px; background: var(--x-ours); display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.mi-bubble .xs { align-self: flex-end; font-size: 11px; }
.mi-sec { padding: 4px 16px 12px; border-block-start: 1px solid var(--line); }
.mi-sec-h { display: flex; align-items: center; gap: 6px; padding-block: 10px 6px; color: var(--accent-text); font-size: 13px; }
.mi-sec-h.wait { color: var(--muted); }
.mi-row { display: flex; align-items: center; gap: 10px; padding-block: 7px; min-width: 0; }
.mi-row .grow { display: flex; flex-direction: column; min-width: 0; }
.mi-row .grow b { font-size: 14px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-at { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 11.5px; font-weight: 600; color: var(--accent-text); }
.cx-sheet:focus { outline: none; }
.mi-at.wait { color: var(--muted); font-family: inherit; }
@media (max-width: 760px) {
  .cx-sheet-bg { align-items: end; padding: 0; }
  .cx-sheet, .cx-sheet.mi { width: 100%; max-height: 86vh; border-radius: 18px 18px 0 0; border-inline: 0; border-block-end: 0; padding-block-end: max(10px, env(safe-area-inset-bottom, 0px)); }
  .cx-sheet:not(.mi)::before { content: ""; display: block; width: 40px; height: 4px; margin: 2px auto 8px; border-radius: 4px; background: var(--line); }
}
@media (prefers-reduced-motion: no-preference) {
  .cx-sheet-bg { animation: cx-fade .16s ease-out; }
  .cx-sheet { animation: cx-rise .26s cubic-bezier(.22, 1, .36, 1); }
}
@keyframes cx-fade { from { opacity: 0; } }
@keyframes cx-rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }

/* document requests: «asked again», quick reasons */
.cx-again { color: var(--attn); font-weight: 700; }
.cx-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-quick .cx-chip { border: 1px solid var(--line); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.cx-quick .cx-chip:hover { background: var(--accent-soft); color: var(--accent-text); }
.cx-req-foot { flex-wrap: wrap; }
.cx-reqcard.drop-here, .cx-req.drop-here { outline: 2px dashed var(--accent); outline-offset: 2px; background: var(--accent-soft); }
@media (max-width: 760px) { .cx-hide-sm { display: none; } }

/* ------------------------------------------------------------------ v0.29 · «عرض الأدوار» (js/roles.js): the page and the strip while viewing */
#fh-viewbar { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; gap: 10px; min-height: 42px; padding-block: 6px; padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px));
  background: var(--brand-bg); color: #fff; font-size: 13px; box-shadow: 0 2px 10px rgba(11, 42, 28, .25); border-block-end: 2px solid var(--accent); }
#fh-viewbar .vb-eye { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-bg-3); flex: none; }
#fh-viewbar .vb-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#fh-viewbar .vb-txt small { opacity: .72; }
#fh-viewbar .vb-role { opacity: .85; }
#fh-viewbar .vb-time { display: inline-flex; align-items: center; gap: 4px; opacity: .8; flex: none; }
#fh-viewbar .vb-back { flex: none; height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: #fff; color: #0B2A1C; font: inherit; font-weight: 800; cursor: pointer; }
#fh-viewbar .vb-back:hover { background: #E8F3EC; }
@media (max-width: 760px) { #fh-viewbar .vb-txt small, #fh-viewbar .vb-role, #fh-viewbar .vb-time { display: none; } }

.rv-page { gap: 18px; }
.rv-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 22px 24px; border-radius: var(--r-2);
  background: radial-gradient(120% 140% at 100% 0%, var(--brand-bg-3) 0%, var(--brand-bg) 60%); color: #fff; }
.rv-hero-t { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rv-hero h1 { margin: 0; font-size: 26px; font-weight: 800; color: #fff; text-wrap: balance; }
.rv-hero p { margin: 0; max-width: 64ch; color: rgba(255, 255, 255, .78); line-height: 1.7; }
.rv-kicker { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.rv-stats { display: grid; grid-template-columns: repeat(4, minmax(64px, 1fr)); gap: 8px; }
.rv-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid var(--brand-rule); }
.rv-stats b { font-size: 22px; color: #fff; }
.rv-stats span { font-size: 11.5px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.rv-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-radius: var(--r-1); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; line-height: 1.7; }
.rv-note .ic { margin-block-start: 4px; flex: none; }
.rv-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-block: 8px; background: var(--bg); }
.rv-tabs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.rv-tab { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.rv-tab.on { background: var(--heading); border-color: var(--heading); color: var(--surface); }
.rv-find { display: flex; align-items: center; gap: 8px; flex: 0 1 300px; min-width: 200px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface); color: var(--muted); }
.rv-search { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.rv-sec { display: flex; flex-direction: column; gap: 10px; }
.rv-sec-h { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 16px; font-weight: 800; color: var(--heading); }
.rv-sec-n { padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 12px; }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.rv-card { --rv-c: var(--accent); display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface);
  border-block-start: 3px solid var(--rv-c); transition: transform .18s cubic-bezier(.22, 1, .36, 1), box-shadow .18s; }
.rv-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -16px rgba(11, 42, 28, .45); }
.rv-card.t-management { --rv-c: var(--heading); } .rv-card.t-marketing { --rv-c: #B08A4E; } .rv-card.t-shared { --rv-c: #5C7F92; } .rv-card.t-client { --rv-c: var(--muted); }
.rv-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rv-ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--rv-c, var(--accent)) 14%, var(--surface)); color: var(--rv-c, var(--accent-text)); }
.rv-h-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rv-h-t b { font-size: 15px; color: var(--heading); }
.rv-h-t span { font-size: 12px; color: var(--muted); }
.rv-n { min-width: 30px; height: 26px; display: grid; place-items: center; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--heading); font-size: 13px; font-weight: 700; }
.rv-meter { position: relative; height: 22px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rv-meter i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: color-mix(in srgb, var(--rv-c) 30%, var(--surface)); }
.rv-meter span { position: relative; display: block; padding-inline: 10px; line-height: 22px; font-size: 11.5px; font-weight: 700; color: var(--heading); }
.rv-can { display: flex; flex-wrap: wrap; gap: 5px; }
.rv-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; }
.rv-chip .ic { width: 12px; height: 12px; }
.rv-chip small { opacity: .75; font-weight: 500; }
.rv-chip small::before { content: "· "; }
.rv-chip.ok { background: var(--accent-soft); color: var(--accent-text); }
.rv-chip.no { background: var(--surface-3); color: var(--muted); }
.rv-cannot summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--muted); list-style: none; }
.rv-cannot summary::-webkit-details-marker { display: none; }
.rv-cannot[open] summary { margin-block-end: 6px; }
.rv-sep { height: 1px; background: var(--line); }
.rv-people { display: flex; flex-direction: column; gap: 4px; }
.rv-p { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border-radius: 10px; }
.rv-p:hover { background: var(--surface-2); }
.rv-p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rv-p-main b { font-size: 13.5px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-p-main span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-see { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--heading); background: var(--heading); color: var(--surface); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.rv-see:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.rv-see.ghost { background: transparent; color: var(--heading); }
.rv-see:disabled { opacity: .5; cursor: wait; }
.rv-more { align-self: flex-start; border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 4px 6px; }
.rv-none { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.rv-inv { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--attn); }
.rv-nothing { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .rv-hero { padding: 18px 16px; }
  .rv-stats { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .rv-find { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { .rv-card, .rv-card:hover { transition: none; transform: none; } }
.rv-hint { font-size: 12px; color: var(--muted); padding-inline: 6px; }

/* ------------------------------------------------------------------ v0.30 · deleting an account (control.js deleteUserDialog) */
.btn.danger { background: var(--unfav); border-color: var(--unfav); color: #fff; }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.du-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: var(--r-1); background: var(--surface-2); }
.du-who b { font-size: 15px; color: var(--heading); }
.du-hist { display: flex; flex-direction: column; gap: 6px; }
.du-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.du-chip { padding: 2px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; color: var(--text); }
.du-clean { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--accent-text); font-size: 13px; }
.du-opts { display: flex; flex-direction: column; gap: 8px; }
.du-opt { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-1); cursor: pointer; background: var(--surface); }
.du-opt input { margin-block-start: 5px; accent-color: var(--accent); }
.du-opt b { color: var(--heading); }
.du-opt p { margin: 2px 0 0; color: var(--muted); line-height: 1.6; }
.du-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.du-opt.off { opacity: .6; cursor: not-allowed; }
.du-why { display: flex; align-items: center; gap: 4px; color: var(--attn) !important; }
.du-former { color: var(--heading); white-space: nowrap; }
.du-open { padding: 10px 12px; border-radius: var(--r-1); background: var(--attn-soft); }
.du-open p { margin: 0 0 6px; color: var(--attn); }
.du-sure { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.du-sure input { accent-color: var(--unfav); width: 16px; height: 16px; }

/* ------------------------------------------------------------------ v0.30 · @mentions (chatx.js mentionBox / richText) */
.mx-host { position: relative; }
.mx-pop { position: absolute; inset-inline: 0; bottom: calc(100% + 8px); z-index: 30; max-width: 360px; max-height: 300px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px -18px rgba(11, 42, 28, .5); }
.mx-pop[hidden] { display: none; }
.mx-it { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.mx-it.on, .mx-it:hover { background: var(--accent-soft); }
.mx-t { display: flex; flex-direction: column; min-width: 0; }
.mx-t b { font-size: 13.5px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-t small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-at { display: inline; padding: 0 4px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); font-weight: 700; unicode-bidi: isolate; }
.cx-at.me { background: var(--accent); color: var(--on-accent, #fff); }
.cx-msg.at-me .cx-bubble { box-shadow: inset 0 0 0 1.5px var(--accent), 0 1px .5px rgba(11, 42, 28, .14); }
@media (prefers-reduced-motion: no-preference) { .mx-pop:not([hidden]) { animation: cx-rise .18s cubic-bezier(.22, 1, .36, 1); } }
.boot-paused h2 { margin: 0; font-size: 22px; font-weight: 800; color: var(--heading); }
.boot-paused .boot-left { color: var(--text); font-size: 14px; }
.boot-paused .boot-left b { color: var(--accent-text); font-size: 16px; padding-inline: 2px; }
