/* Arib — app styles. Logical properties only (RTL-safe); colours as tokens. */

:root {
  --ink: #1d1a16;
  --ink-2: #3d372f;
  --muted: #776e62;
  --paper: #f7f3ec;
  --paper-2: #efe8dc;
  --card: #fffdf9;
  --line: #e4dccd;
  --line-2: #d6ccba;
  --clay: #b4492a;
  --clay-deep: #93361b;
  --clay-soft: #f6e3d8;
  --ok: #2f6b45;
  --ok-soft: #e3f0e6;
  --err: #b3261e;
  --err-soft: #fbe5e2;
  --warn: #8a5a00;
  --warn-soft: #fbefd5;
  --night: #17140f;
  --night-2: #231f19;
  --night-line: #383128;
  --night-text: #efe7da;
  --night-muted: #a99f8e;
  --mark-ink: #f7f3ec;
  --mark-accent: #e0784f;

  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Fraunces", Georgia, serif;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(29, 26, 22, .05), 0 8px 24px -12px rgba(29, 26, 22, .18);
  --side-w: 248px;
}
:lang(ar) {
  --f-ui: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
  --f-display: "IBM Plex Sans Arabic", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--f-ui); -webkit-font-smoothing: antialiased;
}
:lang(ar) body { font-size: 15.5px; line-height: 1.75; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.45; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
a { color: var(--clay); }
img { max-width: 100%; }
code { font: 13px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ico { flex: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: grid; gap: 18px; align-content: start; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--clay); margin-bottom: 8px; }
:lang(ar) .eyebrow { letter-spacing: 0; font-size: 13px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 12px; font-weight: 500; }

/* ── Buttons & inputs ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--ink);
  background: var(--ink); color: #fff; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--ink-2); }
.btn--primary { background: var(--clay); border-color: var(--clay); }
.btn--primary:hover { background: var(--clay-deep); border-color: var(--clay-deep); }
.btn--ghost { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: #fff; border-color: var(--ink); }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 13.5px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn--ghost.is-busy::after { border-color: var(--line-2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--clay); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link { color: var(--clay); text-decoration: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }

.form { display: grid; gap: 14px; }
.form label, .field-label { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; font: inherit; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--clay); box-shadow: 0 0 0 3px rgba(180, 73, 42, .14); }
input:disabled, select:disabled { background: var(--paper-2); color: var(--muted); }
.hint { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.hint--ok { color: var(--ok); }
.hint--err { color: var(--err); }
.form-err { margin: 0; color: var(--err); font-size: 14px; min-height: 0; }
.form-err:empty { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
.note { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper-2); font-size: 14px; }
.note p:last-child { margin: 0; }
.note--ok { background: var(--ok-soft); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form select { width: auto; }
.inline-form--wrap { flex-wrap: wrap; }
.inline-form--wrap input { flex: 1 1 220px; }

.slug-field { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.slug-field:focus-within { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(180, 73, 42, .14); }
.slug-prefix { display: flex; align-items: center; padding-inline: 10px; background: var(--paper-2); color: var(--muted); font-weight: 400; font-size: 13.5px; white-space: nowrap; }
.slug-field input { border: 0; box-shadow: none !important; min-width: 0; }

.copy-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.copy-row code { flex: 1 1 240px; min-width: 0; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }

/* ── Splash ───────────────────────────────────────────── */
.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.arib-mark { display: inline-grid; color: var(--ink); flex: none; }
.arib-mark svg { display: block; }

/* ── Auth ─────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; }
.auth-side {
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px;
  background: radial-gradient(ellipse 80% 60% at 20% 0%, rgba(180, 73, 42, .28), transparent 70%), var(--night);
  color: var(--night-text);
}
.auth-side .arib-mark { color: var(--night-text); --mark-ink: var(--night); }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 20px; }
.auth-pitch h1 { font-family: var(--f-display); font-weight: 500; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.12; margin-bottom: 16px; }
:lang(ar) .auth-pitch h1 { font-weight: 700; line-height: 1.4; }
.auth-pitch p { color: var(--night-muted); font-size: 16px; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: var(--night-text); }
.auth-points .ico { color: var(--mark-accent); }
.auth-foot { margin: 0; color: var(--night-muted); font-size: 13px; }
.auth-main { display: flex; flex-direction: column; padding: 24px; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-card { width: 100%; max-width: 400px; margin: auto; padding-block: 32px; }
.auth-card h2 { font-size: 26px; margin-bottom: 20px; }
.auth-switch { margin-top: 20px; color: var(--muted); font-size: 14px; }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.lang-btn:hover { border-color: var(--ink); }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px; gap: 16px; }
  .auth-pitch h1 { font-size: 26px; }
  .auth-points, .auth-foot, .auth-pitch p { display: none; }
}

/* ── Centred pages (workspace picker, onboarding, join) ─ */
.center { min-height: 100vh; display: flex; flex-direction: column; }
.center-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; }
.brandline { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); text-decoration: none; font-size: 17px; }
.center-actions { display: flex; align-items: center; gap: 10px; }
.center-main { flex: 1; display: grid; place-items: start center; padding: 24px 16px 64px; }
.panel { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 4vw, 36px); box-shadow: var(--shadow); }
.panel--wide { max-width: 760px; }
.panel h2 { font-size: 24px; }
.panel > .btn { margin-top: 8px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--paper-2); }
.steps span.is-on { background: var(--clay); }
.done-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); margin-bottom: 16px; }
.join-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.join-head h2 { margin: 0; }
.verify { margin-top: 8px; }
.ws-list { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; gap: 8px; }
.ws-list a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; }
.ws-list a:hover { border-color: var(--ink); }
.ws-list span span { display: block; }
@media (max-width: 520px) { .hide-sm { display: none; } }

/* ── Avatars ──────────────────────────────────────────── */
.ws-avatar { border-radius: 10px; object-fit: contain; background: #fff; flex: none; }
.ws-avatar--text { display: inline-grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px; }
.p-avatar { display: inline-grid; place-items: center; border-radius: 50%; font-size: 12.5px; font-weight: 600; flex: none; }

/* ── App shell ────────────────────────────────────────── */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--side-w) 1fr; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 12px;
  padding: 16px 12px; background: var(--night); color: var(--night-text); overflow-y: auto;
}
.side-ws { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--night-line); }
.side-ws-text { display: grid; min-width: 0; }
.side-ws-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-ws-text span { color: var(--night-muted); font-size: 12.5px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-foot a, .side-foot button {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--night-muted); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: start; width: 100%;
}
.side-nav a:hover, .side-foot a:hover, .side-foot button:hover { color: var(--night-text); background: var(--night-2); }
.side-nav a.is-active { color: #fff; background: var(--night-2); box-shadow: inset 3px 0 0 var(--ws-color, var(--clay)); }
[dir=rtl] .side-nav a.is-active { box-shadow: inset -3px 0 0 var(--ws-color, var(--clay)); }
.side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--night-line); }
.side-brand { display: flex; align-items: center; gap: 8px; padding: 10px 10px 2px; color: var(--night-muted); font-size: 13px; }
.side-brand .arib-mark { color: var(--night-text); --mark-ink: var(--night); }
.side-scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(247, 243, 236, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { margin: 0; font-size: 19px; }
.topbar-actions { margin-inline-start: auto; display: flex; gap: 8px; }
.only-sm { display: none; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 28px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.content { padding: 24px 28px 64px; max-width: 1240px; width: 100%; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(84vw, 300px); z-index: 30; transform: translateX(-105%); transition: transform .2s ease; }
  [dir=rtl] .side { transform: translateX(105%); }
  .side.is-open { transform: none; }
  .side.is-open + .side-scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(23, 20, 15, .45); }
  .only-sm { display: inline-grid; }
  .topbar, .banner { padding-inline: 16px; }
  .content { padding: 18px 16px 48px; }
}

/* ── Cards & page content ─────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card--soft { background: linear-gradient(160deg, var(--clay-soft), var(--card) 60%); }
.cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
.hello h2 { font-size: 24px; margin-bottom: 16px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.soon-icon, .empty-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--clay); border: 1px solid var(--line); margin-bottom: 12px; }
.empty { max-width: 520px; margin: 48px auto; text-align: center; display: grid; justify-items: center; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; }

.checklist-head { display: flex; justify-content: space-between; align-items: baseline; }
.checklist ul { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist li.is-done span:last-child { color: var(--muted); text-decoration: line-through; }
.tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; }
.is-done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.progress { height: 6px; border-radius: 6px; background: var(--paper-2); margin-top: 8px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 6px; }
.panel .checklist { margin: 20px 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }

/* Logo + colour */
.logo-field { display: flex; gap: 16px; align-items: center; }
.logo-field .ws-avatar { border: 1px solid var(--line); }
.file-btn { cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -6px; }
.swatch { position: relative; width: 32px; height: 32px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.swatch input:checked + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch--custom input[type=color] { opacity: 1; width: 32px; height: 32px; padding: 0; border: 1px dashed var(--line-2); border-radius: 50%; background: none; }

/* Chips (brands) */
.chips { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; padding-inline: 12px 6px; border-radius: 999px; background: var(--paper-2); font-size: 14px; }
.chip-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.chip-x:hover { background: var(--line); color: var(--ink); }

/* People */
.people { list-style: none; padding: 0; margin: 8px 0 0; display: grid; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.person { display: grid; min-width: 0; flex: 1; }
.person strong, .person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people select { width: auto; min-height: 34px; padding-block: 4px; }
.role-tag { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
.role-tag--owner { background: var(--clay-soft); color: var(--clay-deep); }

/* Public form links */
.form-link { padding: 12px 0; border-top: 1px solid var(--line); }
.form-link-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 400; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { inset-inline-start: 18px; }
.switch input:focus-visible + span { outline: 2px solid var(--clay); outline-offset: 2px; }
.switch em { font-style: normal; color: var(--muted); }

/* Toasts */
#toasts { position: fixed; inset-block-end: 20px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 100; pointer-events: none; padding-inline: 16px; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; max-width: 520px; }
.toast--err { background: var(--err); }
.toast.is-out { opacity: 0; transform: translateY(8px); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Nav counters */
.nav-n { margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.nav-n:empty { display: none; }

/* Toolbar + tabs */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tab:hover { background: var(--paper-2); }
.tab.is-on { background: var(--ink); color: #fff; }
.tab-n { font-size: 12px; opacity: .7; }
.search { width: 220px; min-height: 36px; padding-block: 6px; }

/* List + detail */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.split:has(.split-detail[hidden]) { grid-template-columns: minmax(0, 1fr); }
.split-detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.req-row { width: 100%; display: grid; gap: 4px; text-align: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: inherit; font: inherit; cursor: pointer; }
.req-row:hover { border-color: var(--line-2); }
.req-row.is-on { border-color: var(--clay); box-shadow: 0 0 0 1px var(--clay); }
.req-row-top { display: flex; align-items: center; gap: 8px; }
.req-row-ago { margin-inline-start: auto; }
.req-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty--inline { margin: 24px auto; }
.empty-line { padding: 24px 0; text-align: center; }
.row--center { justify-content: center; }
.overdue { color: var(--err); font-weight: 600; }

/* Status pills */
.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--paper-2); color: var(--ink-2); }
.status--new { background: var(--clay-soft); color: var(--clay-deep); }
.status--accepted { background: #e2ebf5; color: #2f5d8a; }
.status--in_progress { background: var(--warn-soft); color: var(--warn); }
.status--delivered { background: var(--ok-soft); color: var(--ok); }
.status--rejected { background: var(--paper-2); color: var(--muted); }

/* Request detail */
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail-head > div { display: flex; align-items: center; gap: 8px; }
.detail-head h3 { margin: 0; }
.detail-title { margin: 12px 0 4px; font-size: 20px; }
.detail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 16px; margin: 0 0 16px; padding: 14px; background: var(--paper); border-radius: var(--radius-sm); }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.detail-actions { margin-bottom: 14px; }
.decline-box { padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.detail-field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.detail-sub { margin: 20px 0 8px; font-size: 14px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.history li { padding-inline-start: 14px; border-inline-start: 2px solid var(--line); }
.history q { color: var(--ink-2); font-style: italic; margin-inline: 4px; }
.history .muted { display: block; }

@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-detail { position: static; max-height: none; order: -1; }
  .search { width: 100%; }
  .toolbar-end { width: 100%; }
}

/* Public form pages (/request, /lead) */
.public-body { background: var(--paper); }
.public { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px clamp(16px, 4vw, 32px); border-top: 4px solid var(--ws-color, var(--clay)); }
.public-ws { display: flex; align-items: center; gap: 10px; font-size: 17px; min-width: 0; }
.public-main { display: grid; justify-items: center; align-content: start; padding: 8px 16px 32px; }
.public-foot { padding: 20px; text-align: center; }
.public-foot a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 4px; margin: 4px 0 0; }
.fieldset legend { padding-inline: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--clay); }
.ref-code { font-size: 22px; font-weight: 700; letter-spacing: .04em; padding: 10px 16px; background: var(--paper-2); border-radius: var(--radius-sm); display: inline-block; }

/* Dialogs */
.dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; background: var(--card); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(29, 26, 22, .45); }
.dialog::backdrop { background: rgba(29, 26, 22, .4); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dialog-head h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn--danger { color: var(--err); }
.btn--danger:hover { border-color: var(--err); }
.push-end { margin-inline-start: auto; }
.radios { display: grid; gap: 8px; }
.radios label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.radios input { width: auto; min-height: 0; }
.subform { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper); display: grid; gap: 12px; }
.conv-lines { display: grid; gap: 8px; }
.conv-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 150px auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .conv-line { grid-template-columns: 1fr 1fr auto; } .conv-line [data-l=title] { grid-column: 1 / -1; } }
.convert-btn { margin-bottom: 14px; }

/* Channels as toggle chips */
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span { display: inline-block; padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; font-weight: 400; cursor: pointer; }
.check-chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.check-chip input:focus-visible + span { outline: 2px solid var(--clay); outline-offset: 2px; }
.check-chip input:disabled + span { cursor: default; opacity: .7; }

/* Campaign status + progress */
.status--c-planned { background: #e2ebf5; color: #2f5d8a; }
.status--c-active { background: var(--ok-soft); color: var(--ok); }
.status--c-done { background: var(--paper-2); color: var(--muted); }
.progress--thin { height: 4px; margin: 4px 0 2px; }
.detail-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.detail-sub-head .detail-sub { margin: 0; }
.work-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; }
.work-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.work-list li:last-child { border-bottom: 0; }
.work-title { flex: 1; min-width: 0; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status dots */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-2); }
.dot--in_progress { background: var(--warn); }
.dot--review { background: #2f5d8a; }
.dot--done { background: var(--ok); }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-2); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button.is-on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.toolbar-end select { width: auto; min-height: 36px; padding-block: 6px; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--paper-2); border-radius: var(--radius); padding: 10px; min-height: 180px; transition: box-shadow .15s; }
.col.is-over { box-shadow: inset 0 0 0 2px var(--clay); }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 4px 4px 10px; }
.col-head .tab-n { margin-inline-start: auto; }
.col-body { display: grid; gap: 8px; }
.col-empty { text-align: center; padding: 16px 0; }
.tcard { display: grid; gap: 6px; width: 100%; text-align: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: inherit; font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(29, 26, 22, .05); }
.tcard[draggable=true] { cursor: grab; }
.tcard:hover { border-color: var(--line-2); }
.tcard.is-dragging { opacity: .5; }
.tcard--high { border-inline-start: 3px solid var(--clay); }
.tcard-title { font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.tcard-camp { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.kind-tag { display: inline-block; margin-inline-end: 6px; padding: 1px 7px; border-radius: 6px; background: var(--clay-soft); color: var(--clay-deep); font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.board-hint { margin-top: 8px; }
@media (max-width: 900px) { .board { grid-template-columns: repeat(4, minmax(240px, 80vw)); } }

/* Leads */
.dialog--wide { width: min(820px, calc(100vw - 32px)); }
.toolbar--filters { justify-content: flex-start; }
.toolbar--filters .search { width: 300px; max-width: 100%; }
.toolbar--filters select { width: auto; min-height: 36px; padding-block: 6px; }
.lead-tabs { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.card--flush { padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; }
.table--leads tbody tr { cursor: pointer; }
.table--leads tbody tr:hover, .table--leads tbody tr:focus-visible { background: var(--paper); outline: none; }
.dup-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-weight: 600; }
.status--l-new { background: var(--clay-soft); color: var(--clay-deep); }
.status--l-contacted { background: #e2ebf5; color: #2f5d8a; }
.status--l-qualified { background: var(--warn-soft); color: var(--warn); }
.status--l-won { background: var(--ok-soft); color: var(--ok); }
.status--l-lost { background: var(--paper-2); color: var(--muted); }
.dot--l-new { background: var(--clay); }
.dot--l-contacted { background: #2f5d8a; }
.dot--l-qualified { background: var(--warn); }
.dot--l-won { background: var(--ok); }
.board--5 { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
@media (max-width: 900px) { .board--5 { grid-template-columns: repeat(5, minmax(230px, 78vw)); } }
.col-sum { padding: 0 4px 8px; margin-top: -6px; }
.stages { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 12px; }
.stage-btn { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.stage-btn:disabled { cursor: default; }
.stage-btn.is-on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.stage-btn--won.is-on { background: var(--ok); border-color: var(--ok); }
.stage-btn--lost.is-on { background: var(--muted); border-color: var(--muted); }
.contact-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.note--warn { background: var(--warn-soft); color: var(--warn); margin-bottom: 12px; }
.quote { padding: 10px 14px; border-inline-start: 3px solid var(--line-2); background: var(--paper); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 12px; }
.quote p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.map-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 500; }
.consent { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 400 !important; font-size: 14px; margin: 8px 0; }
.consent input { width: auto; min-height: 0; margin-top: 3px; }

/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }
