:root {
  /* Odoo-style palette: purple sidebar and primary actions, teal links and highlights */
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --border: #dee2e6;
  --border-strong: #ced4da;
  --text: #374151;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --accent: #714B67;
  --accent-2: #5d3d55;
  --accent-soft: #f3edf2;
  --link: #017E84;
  --teal: #017E84;
  --teal-soft: #e0f2f1;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #9a6200;
  --warn-soft: #fdf3e0;
  --ok: #1e7a3c;
  --ok-soft: #e6f4ea;
  --side: #714B67;
  --side-text: #f3eaf1;
  --side-active: #5d3d55;
  --side-line: rgba(255, 255, 255, .16);
  --radius: 6px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 3px 10px rgba(17, 24, 39, .05);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; font-family: var(--font); color: inherit; }
svg text { font-family: var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }
[dir=rtl] .num, [dir=rtl] td.num, [dir=rtl] th.num { text-align: left; }
[dir=ltr] .num, [dir=ltr] td.num, [dir=ltr] th.num { text-align: right; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-2); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; }
.brand:hover { text-decoration: none; color: #fff; }
.brand:hover .logo { transform: scale(1.05); }
.brand .logo { transition: transform .15s; }
.brand .logo { width: 36px; height: 36px; display: grid; place-items: center; flex-shrink: 0; }
.brand .logo svg { width: 36px; height: 36px; display: block; }
.brand .logo img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand .bname { display: flex; flex-direction: column; line-height: 1.1; flex: 1; min-width: 0; }
.brand .bname b { font-size: 18px; font-weight: 700; }
.brand .erp-tag { font-size: 10.5px; font-weight: 700; background: var(--teal); color: #fff; border-radius: 5px; padding: 2px 7px; letter-spacing: .04em; }
.nav { padding: 6px 10px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, .6); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; color: var(--side-text); font-family: var(--font); font-size: 14px; font-weight: 600;
}
.nav a:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset -3px 0 0 #fff; }
[dir=ltr] .nav a.active { box-shadow: inset 3px 0 0 #fff; }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
/* module accordion */
.nav-home { margin: 6px 0 8px; }
.mod { margin-bottom: 2px; }
.mod-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: 6px; border: 0; background: none; cursor: pointer;
  color: var(--side-text); font-family: var(--font); font-size: 14px; font-weight: 600; text-align: start;
}
.mod-head:hover { background: var(--side-active); color: #fff; }
.mod-head svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.mod-head .chev { width: 15px; height: 15px; margin-inline-start: auto; opacity: .6; transition: transform .15s; transform: rotate(-90deg); }
[dir=rtl] .mod-head .chev { transform: rotate(90deg); }
.mod.open > .mod-head .chev { transform: none; }
.mod.has-active > .mod-head { color: #fff; }
.mod-items { display: none; padding: 2px 0 8px; }
.mod.open { background: rgba(255, 255, 255, .09); border-radius: 8px; }
.mod.open > .mod-head { color: #fff; }
.mod.open > .mod-items { background: rgba(255, 255, 255, .06); border-radius: 0 0 8px 8px; }
.nav .mod.open .mod-items a:hover { background: rgba(255, 255, 255, .14); }
.nav .mod.open .mod-items a.active { background: rgba(255, 255, 255, .2); }
.mod.open > .mod-items { display: block; }
.nav .mod-items a { padding: 7px 10px; padding-inline-start: 37px; font-size: 13.5px; font-weight: 500; }
.side-foot { padding: 14px 18px; border-top: 1px solid var(--side-line); font-size: 12.5px; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.side-foot button { margin-top: 8px; background: none; border: 1px solid rgba(255, 255, 255, .32); color: var(--side-text); padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.side-foot button:hover { background: var(--side-active); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20;
}
.topbar button { background: none; border: 0; color: #fff; padding: 6px; margin: -6px 0; cursor: pointer; display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; }
.topbar button svg { width: 24px; height: 24px; flex-shrink: 0; display: block; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.nbadge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e8a33a; color: #2b1d0a;
  font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; font-variant-numeric: tabular-nums; }
.mod-head .nbadge { margin-inline-start: 0; }
.deskbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 10px 28px 0; max-width: 1400px; width: 100%; }
.bell { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; width: 40px; height: 40px;
  display: grid; place-items: center; cursor: pointer; color: var(--accent); }
.bell:hover { background: var(--accent-soft); }
.bell svg { width: 20px; height: 20px; }
.bell .nb { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #c2410c;
  color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.bell .nb:empty { display: none; }
.bell-pop { position: absolute; top: 46px; inset-inline-end: 0; width: 320px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(17,24,39,.14); z-index: 60; overflow: hidden; }
.bell-pop h4 { margin: 0; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--accent); }
.bell-pop a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.bell-pop a:last-child { border-bottom: 0; }
.bell-pop a:hover { background: var(--accent-soft); text-decoration: none; }
.bell-pop a b { background: var(--accent); color: #fff; border-radius: 999px; min-width: 24px; padding: 1px 8px; text-align: center; font-size: 12px; }
.bell-pop .empty { padding: 18px 14px; color: var(--text-2); text-align: center; }
.bell-wrap { position: relative; }
.topbar .bell { width: 36px; height: 36px; background: transparent; border-color: rgba(255,255,255,.35); color: #fff; margin-inline-start: auto; }
.topbar .bell .nb { border-color: var(--side); }
/* mobile: the bell sits next to the title, so anchor the panel to the whole bar instead of the bell (it used to run off-screen) */
.topbar .bell-wrap { position: static; }
.topbar .bell-pop { top: 100%; margin-top: 6px; inset-inline: 10px; width: auto; max-width: none; }
/* cost & profitability cycle */
.cc-cycle { display: flex; align-items: stretch; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.cc-step { flex: 1 1 150px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.cc-step.cc-final { background: var(--accent); border-color: var(--accent); color: #fff; }
.cc-step.cc-final .cc-k, .cc-step.cc-final .cc-d, .cc-step.cc-final .cc-n { color: rgba(255,255,255,.85); }
.cc-step.cc-final .cc-v { color: #fff; }
.cc-n { font-size: 11px; font-weight: 700; color: var(--teal); }
.cc-k { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.cc-v { font-size: 19px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }
[dir=rtl] .cc-v { text-align: right; }
.cc-v.neg { color: var(--danger); }
.cc-d { font-size: 11.5px; color: var(--text-2); }
.cc-arr { align-self: center; color: var(--accent); font-weight: 700; }
[dir=ltr] .cc-arr { transform: scaleX(-1); }
.cc-how ol { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.cc-tbl td:first-child { white-space: nowrap; }
.cc-tbl td.neg, .cc-tbl .neg { color: var(--danger); }
.cc-tbl td.pos { color: var(--ok); }
.cc-sum td { border-top: 2px solid var(--border-strong); }
@media (max-width: 900px) { .cc-arr { display: none; } }

/* purchase cycle stepper */
.flow-steps { display: flex; align-items: center; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; flex-wrap: wrap; row-gap: 8px; }
.flow-steps .fs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.flow-steps .fs span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.flow-steps .fs.done { color: var(--ok); }
.flow-steps .fs.done span { background: var(--ok); border-color: var(--ok); color: #fff; }
.flow-steps .fs.now { color: var(--accent); }
.flow-steps .fs.now span { background: var(--accent); border-color: var(--accent); color: #fff; }
.flow-steps i { flex: 1; min-width: 24px; height: 2px; background: var(--border); margin: 0 10px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 700; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--text-2); font-size: 12.5px; }
.kpi .value { font-size: 21px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; direction: ltr; }
[dir=rtl] .kpi .value { text-align: right; }
[dir=ltr] .kpi .value { text-align: left; }
.kpi .value.neg { color: var(--danger); }
.kpi a { color: inherit; }

/* ---------- Forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-danger { color: var(--danger); border-color: #e6b8b4; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-icon { padding: 5px 8px; }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.field .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); min-height: 36px;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--text-2); }
[dir=rtl] input.input.num { text-align: left; }
[dir=ltr] input.input.num { text-align: right; }
textarea.input { min-height: 64px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 140px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: start; font-weight: 600; color: var(--text-2); font-size: 12.5px;
  background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafbf9; }
.tbl tr.clickable { cursor: pointer; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.tbl .empty { text-align: center; color: var(--text-3); padding: 28px; }
.tbl tr.warn td { background: var(--warn-soft); }

.lines td { padding: 5px 6px; }
.lines .input { min-height: 32px; padding: 5px 8px; }
.lines .c-no { width: 36px; text-align: center; color: var(--text-3); }
.lines .c-item { min-width: 260px; }
.lines .c-n { width: 110px; }
.lines .c-sm { width: 80px; }
.lines .c-tot { width: 130px; }
.lines .c-x { width: 40px; }
.stock-hint { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.stock-hint.low { color: var(--danger); }

.totals { margin-inline-start: auto; width: 320px; max-width: 100%; }
.totals .row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.totals .row.grand { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 700; }
.totals .input { width: 120px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-draft { background: var(--warn-soft); color: var(--warn); }
.b-posted { background: var(--ok-soft); color: var(--ok); }
.b-cancelled { background: var(--danger-soft); color: var(--danger); }
.b-pending_receipt { background: var(--teal-soft); color: var(--teal); }
.b-received { background: var(--accent-soft); color: var(--accent); }
.b-dl-pending { background: var(--warn-soft); color: var(--warn); }
.b-dl-delivered { background: var(--ok-soft); color: var(--ok); }
.b-neutral { background: #eef0ed; color: var(--text-2); }

/* ---------- Chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bar .col { width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar .col.neg { background: var(--danger); }
.bar .v { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; direction: ltr; }
.bar .m { font-size: 11.5px; color: var(--text-2); direction: ltr; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #13201c 0%, #1b3a33 100%); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lang-btn { background: none; border: 1px solid rgba(255, 255, 255, .32); color: var(--side-text); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.lang-btn.light { border-color: var(--border-strong); color: var(--text); background: var(--surface); flex-shrink: 0; }
.lang-btn.light:hover { background: var(--surface-2); }
.auth .tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 7px; padding: 4px; margin: 18px 0; }
.auth .tabs button { flex: 1; border: 0; background: none; padding: 7px; border-radius: 5px; cursor: pointer; font-weight: 500; }
.auth .tabs button.on { background: var(--surface); box-shadow: var(--shadow); }
.auth .field { margin-bottom: 12px; }
.auth .btn { width: 100%; margin-top: 6px; padding: 9px; }
.auth .lang-btn { width: auto; }
.auth .link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; margin-top: 12px; font-size: 13px; }

/* ---------- Modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 22, 19, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.sm { max-width: 420px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-head button { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-2); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-start; }

#toast-root { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 7px; box-shadow: var(--shadow); max-width: 420px; font-size: 13.5px; animation: tin .18s ease-out; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.notice { padding: 10px 14px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); font-size: 13.5px; margin-bottom: 14px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.err { background: var(--danger-soft); color: var(--danger); }

.doc-meta { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.doc-meta b { color: var(--text); font-weight: 600; }

/* ---------- Print ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  #app, #modal-root, #toast-root { display: none !important; }
  #print-root { display: block; }
}
.pr { color: #000; font-family: var(--font); }
.pr-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 14px; gap: 20px; }
.pr-head .co { font-size: 18px; font-weight: 700; }
.pr-head .co-sub { font-size: 11.5px; color: #333; margin-top: 2px; }
.pr-title { text-align: center; font-size: 17px; font-weight: 700; margin: 0 0 12px; }
.pr-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin-bottom: 14px; font-size: 12.5px; }
.pr-meta div span { color: #444; }
.pr-sub { font-size: 10.5px; color: #555; margin-top: 2px; }
.pr table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pr th, .pr td { border: 1px solid #555; padding: 5px 7px; text-align: start; }
.pr th { background: #eee; font-weight: 700; }
[dir=rtl] .pr td.num, [dir=rtl] .pr th.num { text-align: left; }
[dir=ltr] .pr td.num, [dir=ltr] .pr th.num { text-align: right; }
.pr-date { text-align: end; }
.pr-totals { width: 280px; margin-inline-start: auto; margin-top: 10px; font-size: 12.5px; }
.pr-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.pr-totals .g { border-top: 2px solid #000; font-weight: 700; font-size: 14px; padding-top: 6px; }
.pr-sign { display: flex; justify-content: space-between; margin-top: 50px; font-size: 12.5px; }
.pr-sign div { border-top: 1px solid #000; padding-top: 6px; width: 180px; text-align: center; }
.pr-foot { margin-top: 24px; font-size: 11px; color: #444; text-align: center; }
.pr-stamp { display: inline-block; border: 2px solid #b00; color: #b00; padding: 2px 12px; font-weight: 700; margin-inline-start: 10px; font-size: 13px; }

/* ---------- Printed price list (ERP identity) ---------- */
.plp { --plp-p: #714B67; --plp-p2: #5a3a52; --plp-t: #017E84; --plp-ink: #1f2230; --plp-soft: #626577; --plp-line: #e4dfe3; --plp-tint: #f6f1f5;
  color: var(--plp-ink); font-family: var(--font); font-size: 11.5px; line-height: 1.6; -webkit-print-color-adjust: exact; print-color-adjust: exact;
  padding: 12mm; }
.plp-band { background: var(--plp-p); color: #fff; border-radius: 10px; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.plp-brand { display: flex; align-items: center; gap: 14px; }
.plp-logo { width: 58px; height: 58px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.plp-logo img { max-width: 46px; max-height: 46px; object-fit: contain; }
.plp-logo span { color: var(--plp-p); font-size: 28px; font-weight: 700; }
.plp-co { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.plp-tag { font-size: 11px; opacity: .8; }
.plp-head { text-align: end; }
.plp-kicker { font-size: 10px; letter-spacing: 2.5px; opacity: .75; font-weight: 600; }
.plp-title { font-size: 26px; font-weight: 700; line-height: 1.25; }
.plp-aud { display: inline-block; margin-top: 4px; background: var(--plp-t); color: #fff; border-radius: 999px; padding: 2px 12px; font-size: 11.5px; font-weight: 600; }
.plp-meta { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--plp-line); border-radius: 8px; margin: 12px 0 8px; overflow: hidden; }
.plp-meta > div { padding: 8px 12px; display: grid; gap: 1px; }
.plp-meta > div + div { border-inline-start: 1px solid var(--plp-line); }
.plp-meta span { font-size: 9.5px; color: var(--plp-soft); letter-spacing: .3px; }
.plp-meta b { font-size: 12px; white-space: nowrap; }
.plp-vat { font-size: 10.5px; color: var(--plp-soft); margin-bottom: 6px; }
/* each group's heading lives in its table head, with a spacer row above it: when a table runs onto the next page the
   browser repeats the head, so the continued page gets a top margin and the group name again (the page margin is 0) */
.plp .plp-tbl { margin-top: calc(16px - 12mm); }
.plp .plp-tbl tr.plp-sp td { height: 12mm; padding: 0; border: 0; background: none; }
.plp .plp-tbl tr.plp-grp td { padding: 0 0 5px; border: 0; border-bottom: 2px solid var(--plp-p); background: none; }
.plp .plp-tbl tr.plp-grp td { text-align: start; }
.plp-grp span { font-size: 14px; font-weight: 700; color: var(--plp-p); }
.plp-grp em { font-style: normal; font-size: 10px; color: var(--plp-soft); float: inline-end; margin-top: 4px; }
.plp .plp-tbl tr.plp-grp + tr th { border-top: 0; }
.plp .plp-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.plp .plp-tbl th { background: var(--plp-tint); color: var(--plp-p2); font-weight: 700; font-size: 10.5px; padding: 7px 8px; border: 0; border-bottom: 1px solid var(--plp-line); text-align: start; }
.plp .plp-tbl td { padding: 7px 8px; border: 0; border-bottom: 1px solid var(--plp-line); vertical-align: middle; }
.plp .plp-tbl tr { break-inside: avoid; page-break-inside: avoid; }
.plp .plp-tbl tbody tr:nth-child(even) td { background: #fbf9fb; }
.plp .plp-tbl .c { text-align: center; }
.plp-n { color: var(--plp-soft); }
.plp-it { font-weight: 600; }
.plp-p { font-size: 13.5px; font-weight: 700; color: var(--plp-p); white-space: nowrap; }
.plp-k { color: var(--plp-t); font-weight: 600; white-space: nowrap; }
.plp-notes { margin-top: 16px; border: 1px solid var(--plp-line); border-inline-start: 3px solid var(--plp-t); border-radius: 6px; padding: 9px 12px; break-inside: avoid; }
.plp-lbl { font-size: 10px; font-weight: 700; color: var(--plp-t); letter-spacing: .4px; margin-bottom: 3px; }
.plp-foot { display: flex; justify-content: space-between; gap: 24px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--plp-line); font-size: 10.5px; break-inside: avoid; }
.plp-contact { text-align: end; }
.plp-soft { color: var(--plp-soft); }
.plp-issued { margin-top: 10px; font-size: 9.5px; color: var(--plp-soft); text-align: center; }

/* printed invoices share the price list identity */
.pv-party { margin: 4px 0 2px; padding: 10px 12px; border: 1px solid var(--plp-line); border-radius: 8px; }
.pv-pname { font-size: 15px; font-weight: 700; }
.pv-chip { display: inline-block; font-size: 10px; font-weight: 600; color: var(--plp-t); border: 1px solid var(--plp-t); border-radius: 999px; padding: 0 8px; vertical-align: middle; }
.pv-pinfo { font-size: 11px; color: var(--plp-soft); }
.pv-sub { font-size: 10px; color: var(--plp-soft); font-weight: 400; }
.pv-amt { font-weight: 700; color: var(--plp-p); white-space: nowrap; }
.pv .plp-tbl { margin-top: calc(10px - 12mm); }
.pv-sum { display: flex; justify-content: space-between; gap: 24px; margin-top: 14px; break-inside: avoid; align-items: flex-start; }
.pv-left { flex: 1; min-width: 0; }
.pv-words { font-size: 11.5px; }
.pv-bal { display: flex; border: 1px solid var(--plp-line); border-radius: 6px; overflow: hidden; margin-top: 3px; }
.pv-bal > div { flex: 1; padding: 6px 10px; display: grid; }
.pv-bal > div + div { border-inline-start: 1px solid var(--plp-line); }
.pv-bal span { font-size: 9.5px; color: var(--plp-soft); }
.pv-bal-new { background: var(--plp-tint); }
.pv-tot { width: 270px; border: 1px solid var(--plp-line); border-radius: 8px; overflow: hidden; }
.pv-tot > div { display: flex; justify-content: space-between; padding: 6px 12px; border-bottom: 1px solid var(--plp-line); }
.pv-tot > div span { color: var(--plp-soft); }
.pv-tot .pv-grand { background: var(--plp-p); color: #fff; border-bottom: 0; font-size: 14px; }
.pv-tot .pv-grand span { color: #fff; }
.pv-stamp { background: #b3261e; }
.pv-thanks { text-align: center; margin-top: 16px; font-size: 12px; color: var(--plp-p); font-weight: 600; }

/* ---------- Printed invoice (minimal layout) ---------- */
.pi { --pi-ink: #1b1b1b; --pi-soft: #555; --pi-rule: #9d9d9d;
  --pi-display: 'Italiana', 'Didot', 'Bodoni 72', 'Playfair Display', 'Liberation Serif', Georgia, serif;
  --pi-body: 'Lato', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
  color: var(--pi-ink); font-family: var(--pi-body); font-size: 11.5px; line-height: 1.55;
  min-height: calc(297mm - 24mm - 2px); display: flex; flex-direction: column; padding: 6mm 5mm 0; box-sizing: border-box; }
.pi.pi-ar { --pi-display: var(--font); --pi-body: var(--font); font-size: 12px; }
.pi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; gap: 20px; }
.pi-logo { width: 82px; height: 82px; display: flex; align-items: center; justify-content: center; }
.pi-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pi-mono { width: 74px; height: 74px; border-radius: 50%; background: #000; color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--pi-display); font-size: 34px; line-height: 1; }
.pi-title { font-family: var(--pi-display); font-size: 50px; line-height: 1; letter-spacing: .02em; font-weight: 400; display: flex; align-items: center; gap: 14px; }
.pi-ar .pi-title { font-weight: 300; font-size: 44px; letter-spacing: 0; }
.pi-stamp { font-family: var(--pi-body); font-size: 12px; font-weight: 700; letter-spacing: .08em; color: #b00; border: 2px solid #b00; padding: 3px 10px; transform: rotate(-6deg); }
.pi-info { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.pi-lbl { font-weight: 700; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 3px; }
.pi-ar .pi-lbl { font-size: 11.5px; letter-spacing: 0; }
.pi-party { font-weight: 700; font-size: 12.5px; }
.pi-sub { color: var(--pi-soft); font-size: 10px; }
.pi-ltr { text-align: start; unicode-bidi: plaintext; }
.pi-doc { text-align: end; }
.pi-doc span { color: var(--pi-soft); }
.pi-no { font-size: 14px; margin-bottom: 2px; }
.pi-no b { font-weight: 400; }
.pi table.pi-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11.5px; }
.pi .pi-tbl th, .pi .pi-tbl td { border: 0; border-bottom: 1px solid var(--pi-rule); padding: 9px 6px; background: none; vertical-align: middle; }
.pi .pi-tbl thead th { border-top: 1px solid var(--pi-ink); border-bottom: 1px solid var(--pi-ink); font-weight: 700; font-size: 11px; }
.pi .pi-tbl .pi-n { text-align: center; color: var(--pi-soft); }
.pi .pi-tbl .pi-it { text-align: start; overflow-wrap: anywhere; }
.pi .pi-tbl .pi-c { text-align: center; white-space: nowrap; }
.pi .pi-tbl .pi-b { font-weight: 700; }
.pi .pi-tbl tbody tr { break-inside: avoid; }
.pi-sum { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-top: 4px; break-inside: avoid; }
.pi-left { flex: 1; padding-top: 12px; min-width: 0; }
.pi-words { font-style: italic; margin-bottom: 16px; }
.pi-ar .pi-words { font-style: normal; }
.pi-bal-row { display: flex; border: 1px solid var(--pi-rule); }
.pi-bal-row > div { flex: 1; padding: 6px 10px; display: flex; flex-direction: column; gap: 1px; }
.pi-bal-row > div + div { border-inline-start: 1px solid var(--pi-rule); }
.pi-bal-row span { color: var(--pi-soft); font-size: 10px; }
.pi-bal-row b { font-size: 12.5px; white-space: nowrap; }
.pi-bal-new { background: #f1f1ee; }
.pi-totals { width: 36%; min-width: 230px; }
.pi-totals > div { display: flex; justify-content: space-between; padding: 8px 6px; border-bottom: 1px solid var(--pi-rule); }
.pi-totals > div span { font-weight: 700; font-size: 11px; }
.pi-totals > div b { font-weight: 400; white-space: nowrap; }
.pi-totals .pi-grand { border-bottom: 0; border-top: 1px solid var(--pi-ink); margin-top: -1px; padding-top: 14px; align-items: center; }
.pi-totals .pi-grand span { font-size: 17px; }
.pi-totals .pi-grand b { font-size: 21px; }
.pi-notes { margin-top: 18px; font-size: 11px; }
.pi-totals b, .pi-bal-row b, .pi .pi-tbl td.pi-c { direction: ltr; unicode-bidi: isolate; }
.pi-totals .pi-grand { gap: 12px; }
.pi-ar .pi-totals .pi-grand span { font-size: 15px; }
.pi-ar .pi-totals { width: 40%; }
.pi-foot { margin-top: auto; padding-top: 34px; break-inside: avoid; }
.pi-thanks { font-size: 17px; margin-bottom: 26px; }
.pi-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding-bottom: 2mm; }
.pi-pay { font-size: 10.5px; }
.pi-co { text-align: end; font-size: 10px; color: #333; }
.pi-coname { font-family: var(--pi-display); font-size: 22px; color: var(--pi-ink); line-height: 1.2; margin-bottom: 2px; }
.pi-ar .pi-coname { font-weight: 600; font-size: 19px; }

/* settings: logo preview */
.logo-edit { display: flex; gap: 16px; align-items: center; }
.logo-prev { width: 96px; height: 96px; border: 1px dashed var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 6px; text-align: center; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .content { min-width: 0; }
  .side { position: fixed; inset: 0 0 0 auto; width: 260px; z-index: 50; transform: translateX(100%); transition: transform .2s; }
  [dir=ltr] .side { inset: 0 auto 0 0; transform: translateX(-100%); }
  [dir=ltr] .shell.nav-open .side { transform: none; }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
  .topbar { display: flex; }
  .deskbar { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .label { overflow-wrap: anywhere; }
  .kpi .value { font-size: 17px; }
  .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .totals { width: 100%; }
}

/* ---------- Tasks & KPIs ---------- */
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #17622f; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 3px; align-self: flex-end; flex-wrap: wrap; max-width: 100%; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 5px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pr-low { background: #eef0ed; color: var(--text-2); }
.pr-normal { background: #e8eef7; color: #2d5a8c; }
.pr-high { background: var(--warn-soft); color: var(--warn); }
.pr-urgent { background: var(--danger-soft); color: var(--danger); }
.ts-todo { background: #eef0ed; color: var(--text-2); }
.ts-in_progress { background: var(--accent-soft); color: var(--accent-2); }
.ts-paused { background: var(--warn-soft); color: var(--warn); }
.ts-done { background: var(--ok-soft); color: var(--ok); }
.ts-cancelled { background: var(--danger-soft); color: var(--danger); }
.band-ex { background: var(--ok-soft); color: var(--ok); }
.band-good { background: var(--accent-soft); color: var(--accent-2); }
.band-fair { background: var(--warn-soft); color: var(--warn); }
.band-poor { background: var(--danger-soft); color: var(--danger); }
.neg { color: var(--danger); }
.tbl tr.row-live td { background: #f1f8f6; }
.live { color: var(--accent); font-variant-numeric: tabular-nums; }
.stars { color: #d99a00; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d9ddd7; }
.stars-input { display: inline-flex; gap: 2px; }
.stars-input button { border: 0; background: none; font-size: 26px; line-height: 1; color: #d9ddd7; cursor: pointer; padding: 0 2px; }
.stars-input button.on { color: #d99a00; }

.now-card { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 14px; border-radius: var(--radius);
  background: linear-gradient(135deg, #714B67, #4f3448); color: #fff; box-shadow: var(--shadow); flex-wrap: wrap; }
.now-card .muted { color: #b9d6d0; }
.now-dot { width: 10px; height: 10px; border-radius: 50%; background: #5fe0b5; box-shadow: 0 0 0 0 rgba(95,224,181,.7); animation: pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(95,224,181,.6); } 70% { box-shadow: 0 0 0 10px rgba(95,224,181,0); } 100% { box-shadow: 0 0 0 0 rgba(95,224,181,0); } }
.now-body { flex: 1; min-width: 160px; }
.now-title { font-weight: 700; font-size: 16px; }
.now-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; }
.now-card .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.now-card .btn-ok { background: #fff; color: var(--accent-2); border-color: #fff; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13.5px; }
.detail-block { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.pre { white-space: pre-wrap; margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 0; padding-inline-start: 16px; border-inline-start: 2px solid var(--border); position: relative; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.kbar { height: 8px; background: #eceee9; border-radius: 99px; overflow: hidden; margin-bottom: 3px; }
.kbar span { display: block; height: 100%; border-radius: 99px; }
.kbar .ok { background: var(--ok); }
.kbar .mid { background: #d99a00; }
.kbar .low { background: var(--danger); }
.score-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.score-ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-content: center; text-align: center; flex-shrink: 0; border: 8px solid currentColor; }
.score-ring.b-neutral { color: #cdd2cb; }
.score-ring .v { font-size: 24px; font-weight: 700; color: var(--text); direction: ltr; }
.score-ring .l { font-size: 11.5px; color: var(--text-2); }
.score-ring.band-ex, .score-ring.band-good, .score-ring.band-fair, .score-ring.band-poor { background: none; }
.score-info { flex: 1; min-width: 220px; }
.score-info .who { font-size: 18px; font-weight: 700; }
.mini-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.mini-stats div, .m-stats div { display: flex; flex-direction: column; }
.mini-stats b, .m-stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.mini-stats span, .m-stats span { font-size: 11.5px; color: var(--text-2); }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.member { padding: 16px; display: flex; flex-direction: column; gap: 12px; border-top: 3px solid #cdd2cb; }
.member.working { border-top-color: var(--accent); }
.m-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.m-name { flex: 1; min-width: 0; }
.state { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #eef0ed; color: var(--text-2); white-space: nowrap; }
.state.on { background: var(--accent-soft); color: var(--accent-2); }
.m-now { background: var(--surface-2); border-radius: 7px; padding: 10px 12px; min-height: 64px; }
.m-task { font-weight: 600; display: block; margin-top: 2px; }
.m-clock { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); direction: ltr; text-align: start; }
[dir=rtl] .m-clock { text-align: right; }
.m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.m-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.m-actions { display: flex; gap: 6px; }
@media (max-width: 520px) { .meta-grid { grid-template-columns: 1fr; } .m-stats { grid-template-columns: repeat(2, 1fr); } }
.m-stats b, .mini-stats b { white-space: nowrap; }
.m-stats b { font-size: 15px; }
.tbl td.num { white-space: nowrap; }
.now-card { flex-direction: column; align-items: stretch; gap: 10px; }
.now-head { display: flex; align-items: center; gap: 10px; }
.now-item { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.15); }
.now-step { font-size: 13px; color: #d9ece8; margin-top: 2px; }
.step-line { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.m-cur { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.m-cur:last-child { border-bottom: 0; }
.m-cur-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.m-cur .m-clock { font-size: 15px; flex-shrink: 0; }
.m-step { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.m-cur-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.m-cur-right .btn-icon { padding: 2px 7px; font-size: 11px; }

/* ---------- CRM ---------- */
.cs-new { background: #eef0ed; color: var(--text-2); }
.cs-contacted { background: #e8eef7; color: #2d5a8c; }
.cs-interested { background: var(--accent-soft); color: var(--accent-2); }
.cs-quote { background: var(--warn-soft); color: var(--warn); }
.cs-won { background: var(--ok-soft); color: var(--ok); }
.cs-lost { background: var(--danger-soft); color: var(--danger); }
.due-over { background: var(--danger-soft); color: var(--danger); }
.due-today { background: var(--warn-soft); color: var(--warn); }
.due-later { background: #eef0ed; color: var(--text-2); }
.ak { background: #eef0ed; color: var(--text-2); font-weight: 600; }
.ak-call, .ak-whatsapp { background: var(--ok-soft); color: var(--ok); }
.ak-visit, .ak-meeting { background: var(--accent-soft); color: var(--accent-2); }
.ak-message, .ak-email { background: #e8eef7; color: #2d5a8c; }
.ak-stage { background: var(--warn-soft); color: var(--warn); }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.board-empty { text-align: center; padding: 16px 0; }
.lead-card { padding: 10px 12px; margin-bottom: 8px; box-shadow: none; }
.lead-title { font-weight: 600; color: var(--text); display: block; }
.lead-title:hover { color: var(--accent); }
.lead-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lead-move { margin-inline-start: auto; display: inline-flex; gap: 4px; }
.lead-move .btn-icon { padding: 2px 9px; font-size: 15px; line-height: 1.1; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.stepper .step { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.stepper .step:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.stepper .step.done { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); }
.stepper .step.cur { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.stepper .step:disabled { cursor: default; }
.info-rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.info-rows > div:last-child { border-bottom: 0; }
.info-rows span { color: var(--text-2); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.crm-tl li { padding-bottom: 10px; }
.tl-next { margin-top: 3px; color: var(--text-2); }
.tl-stage { color: var(--text-2); }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .board { grid-template-columns: 1fr; } }

/* ---------- Online store ---------- */
.badge.b-online { background: #e6f0ec; color: #1f6b4f; }
.notice.shop-notice { border-inline-start: 3px solid #1f6b4f; }
.pi-cat { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--pi-ink); padding: 1px 7px; margin: 1px 0 4px; }
.pi-ar .pi-cat { font-size: 10.5px; letter-spacing: 0; }
.btn.btn-wa { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }
.btn.btn-wa:hover { background: #197a42; }
.tbl.tbl-compact { font-size: 12.5px; }
.tbl.tbl-compact th, .tbl.tbl-compact td { padding-inline: 8px; white-space: nowrap; }

/* batches & expiry */
.batch-row { display: flex; gap: 6px; margin-top: 4px; }
.batch-row .input-sm, .input-sm { height: 30px; padding: 4px 8px; font-size: 12.5px; }
.batch-row input[data-f=batch_no] { flex: 1 1 55%; min-width: 0; }
.batch-row input[type=date] { flex: 1 1 45%; min-width: 0; }
.batch-row select { flex: 1; min-width: 0; }
.batch-row select[data-shelf] { flex: 0 0 96px; }
.line-batch { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.badge.exp-over { background: #fde8e8; color: #b42318; }
.badge.exp-soon { background: #fff1e0; color: #b54708; }
.badge.exp-mid { background: #fef9e0; color: #8a6d00; }
.badge.exp-ok { background: #e8f5ec; color: #1f7a3d; }
.pi-batch { font-size: 10.5px; color: #666; margin-top: 2px; }
/* reorder planning */
.badge.ro-out { background: #fde8e8; color: #b42318; }
.badge.ro-order_now { background: #fff1e0; color: #b54708; }
.badge.ro-soon { background: #fef9e0; color: #8a6d00; }
.badge.ro-ok { background: #e8f5ec; color: #1f7a3d; }
.badge.ro-no_sales { background: var(--surface-2); color: var(--text-3); }
.trend { font-size: 12px; white-space: nowrap; color: var(--text-2); }
.trend.up { color: #1f7a3d; }
.trend.down { color: #b42318; }
/* price lists */
.price-grid td .input-sm { width: 96px; text-align: end; }
.input.dirty { border-color: var(--accent); background: var(--accent-soft); }
/* aging */
.age-0 { color: var(--text-2); }
.age-3, .age-4 { color: var(--danger); font-weight: 600; }
.pl-tbl td.lbl { white-space: nowrap; }
.pl-tbl tr.pl-sum td { font-weight: 700; border-top: 2px solid var(--border); }
.pl-tbl tr.pl-net td { font-weight: 700; font-size: 15px; background: var(--surface-2); }
.pl-tbl tr.pl-sub td.lbl { padding-inline-start: 28px; color: var(--text-2); }
.pl-tbl td.neg { color: var(--danger); }
.neg-amt { color: var(--ok); }
.exp-bars { display: grid; gap: 8px; max-width: 720px; }
.exp-bar { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 110px 40px; gap: 10px; align-items: center; font-size: 13px; }
.exp-bar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.exp-bar .track span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
@media (max-width: 640px) { .exp-bar { grid-template-columns: 1fr 90px; } .exp-bar .track, .exp-bar .small { display: none; } }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.row-actions .btn { justify-content: center; white-space: nowrap; }
/* import */
.imp-drop { margin-top: 16px; border: 2px dashed var(--border); border-radius: 10px; padding: 26px 16px; text-align: center; display: grid; gap: 6px; justify-items: center; background: var(--surface-2); }
.imp-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-drop .btn { margin-top: 6px; }
.imp-cols { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.badge.b-pack { background: #eef0ff; color: #3b3fa8; }
.tbl tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Dashboard ---------- */
.dash-head { align-items: flex-start; }
.dash-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.dash-clock { font-weight: 600; font-size: 15px; color: var(--text); white-space: nowrap; }
.heroes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.card.hero { display: flex; flex-direction: column; padding: 16px 16px 12px; color: inherit; min-height: 150px; border-radius: 12px; transition: box-shadow .15s, transform .15s; }
.card.hero:hover { text-decoration: none; box-shadow: 0 2px 4px rgba(16,24,40,.06), 0 10px 24px rgba(16,24,40,.08); transform: translateY(-1px); }
.hero-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hero-l { min-width: 0; }
.hero .label { font-weight: 600; font-size: 14px; color: var(--text); }
.hero-val { font-variant-numeric: tabular-nums; font-size: 27px; font-weight: 700; margin-top: 4px; line-height: 1.15; overflow-wrap: anywhere; }
.hero-sub { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.hero-sub .pos, .pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--danger); }
.hero-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.hero-ic svg { width: 22px; height: 22px; }
.tone-green { background: #e3f4ea; color: #2e9e62; }
.tone-amber { background: #fcefd6; color: #c98517; }
.tone-blue { background: var(--accent-soft); color: var(--accent); }
.tone-mint { background: var(--teal-soft); color: var(--teal); }
.spark { width: 100%; height: 48px; display: block; margin-top: auto; padding-top: 8px; }
.spark-empty { height: 48px; margin-top: auto; border-bottom: 2px dashed var(--border); }
.prog { height: 9px; background: #e9edf2; border-radius: 99px; overflow: hidden; margin-top: 12px; }
.prog span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.dash-row2 { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.dash-row2 > .card, .dash-row3 > .card { border-radius: 12px; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-h h2 { margin: 0; }
.card-pad.card-h { padding-bottom: 10px; }
.combo { width: 100%; margin-top: 10px; min-height: 260px; }
.combo svg { display: block; }
.combo .grid { stroke: #e8ebef; stroke-width: 1; }
.combo .ax0 { stroke: #c9cfd6; stroke-width: 1; }
.combo .tick { font-size: 11.5px; fill: var(--text-2); font-family: var(--font); }
.chart-legend { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sq { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.chart-legend .ln { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }
.donut { width: 190px; height: 190px; }
.donut .d-lbl { font-size: 12px; fill: var(--text-2); font-family: var(--font); }
.donut .d-val { font-size: 20px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.legend { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .pc { color: var(--text-2); }
.empty-state { color: var(--text-3); text-align: center; padding: 28px 10px; font-size: 13px; }
.empty-state.tall { padding: 110px 10px; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card.mini { padding: 10px 14px; color: inherit; border-radius: 10px; }
.card.mini:hover { text-decoration: none; border-color: var(--border-strong); }
.card.mini .label { font-size: 12px; color: var(--text-2); }
.mini-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.dash-row3 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(0, .9fr); gap: 14px; }
.tbl-dash td { vertical-align: middle; }
.tbl-dash td.code { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.rank { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; }
.ti-name { font-weight: 500; }
.share { height: 4px; background: #eef1f4; border-radius: 99px; margin-top: 5px; overflow: hidden; max-width: 180px; }
.share span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.lvl { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; min-width: 64px; text-align: center; }
.lvl-out { background: #e5534b; color: #fff; }
.lvl-low { background: #f2c14e; color: #3d2c00; }
.lvl-near { background: #d9f0e3; color: #1e6b41; }
.feed { list-style: none; margin: 0; padding: 0 16px 14px; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; }
.f-ic { width: 30px; height: 30px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; flex-shrink: 0; }
.f-ic svg { width: 16px; height: 16px; }
.f-body { min-width: 0; flex: 1; }
.f-title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-text { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.f-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.av { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; }
@media (max-width: 1250px) {
  .heroes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-row3 > .card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .dash-row2 { grid-template-columns: minmax(0, 1fr); }
  .dash-row3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .heroes { grid-template-columns: minmax(0, 1fr); }
  .hero-val { font-size: 24px; }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-clock { font-size: 13px; }
}
.late-card { border-color: #f1c7c3; margin-bottom: 14px; border-radius: 12px; }
.late-card h2 { display: flex; align-items: center; gap: 8px; color: var(--danger); }
.late-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); display: inline-block; box-shadow: 0 0 0 4px var(--danger-soft); }
/* ---------- forecast ---------- */
.fc-bars { display: flex; gap: 10px; align-items: flex-end; overflow-x: auto; padding: 8px 2px 4px; min-height: 210px; }
.fc-m { flex: 1; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fc-cols { height: 160px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.fc-cols span { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.fc-f { background: #c9d3de; }
.fc-a { background: var(--accent); }
.fc-a.under { background: #e07a5f; }
.fc-lbl { font-size: 11.5px; color: var(--text-2); white-space: nowrap; direction: ltr; }
.fc-p { font-size: 12px; font-weight: 700; }
.warn-txt { color: var(--warn); }
.center { text-align: center; }
.input--cell { width: 110px; min-height: 34px; padding: 4px 8px; text-align: end; }

/* balance sheet */
.bs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.bs-tbl td { padding: 9px 16px; }
.bs-tbl tr.bs-h td { font-weight: 700; color: var(--accent); background: var(--surface-2); padding-top: 10px; }
.bs-tbl tr.bs-sub td { font-weight: 700; border-top: 1px solid var(--border); }
.bs-tbl tfoot td { font-weight: 800; border-top: 2px solid var(--border-strong); background: var(--accent-soft); }
@media (max-width: 860px) { .bs-grid { grid-template-columns: 1fr; } }

/* employee governance */
.ts-awaiting_acceptance { background: #fff4e0; color: #9a5b00; }
.ts-clarification { background: #fde8e8; color: #b42318; }
.ts-awaiting_commitment { background: #eef2ff; color: #3b4cc0; }
.ts-returned { background: #fde8e8; color: #b42318; }
.ts-pending_review { background: var(--teal-soft); color: var(--teal); }
.gov-req { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface-2); }
.gov-req h3 { margin: 0 0 8px; font-size: 16px; }
.gov-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; font-size: 13.5px; }
.gov-grid .k { color: var(--text-2); font-size: 12px; }
.gov-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.gov-sec h4 { margin: 0 0 8px; font-size: 14px; color: var(--accent); }
.gov-comp { display: grid; grid-template-columns: 150px 1fr 48px 84px; gap: 6px 10px; align-items: center; font-size: 13px; }
.gov-comp .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.gov-comp .track span { display: block; height: 100%; background: var(--accent); }
.gov-score { font-size: 28px; font-weight: 800; color: var(--accent); }
.gov-flag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.gov-flag.early { background: var(--ok-soft); color: var(--ok); }
.gov-flag.on_time { background: var(--ok-soft); color: var(--ok); }
.gov-flag.extended { background: var(--warn-soft); color: var(--warn); }
.gov-flag.late { background: var(--danger-soft); color: var(--danger); }
.gov-tabs { margin-bottom: 14px; }
.gov-list { display: grid; gap: 10px; }
.gov-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.gov-item .t { font-weight: 700; }
.gov-bars .row { display: grid; grid-template-columns: 130px 1fr 140px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.gov-bars .track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.gov-bars .track span { display: block; height: 100%; background: var(--teal); }
.gov-bars .track span.over { background: var(--danger); }
.att-list { display: flex; flex-wrap: wrap; gap: 8px; }
.att-list a { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; }
.cmt { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
@media (max-width: 720px) { .gov-grid { grid-template-columns: 1fr 1fr; } .gov-comp { grid-template-columns: 110px 1fr 40px 50px; } .gov-bars .row { grid-template-columns: 100px 1fr 70px; } }

/* ------------------------------------------------------------------ users, roles & permissions */
.denied { max-width: 620px; margin: 40px auto; padding: 32px 28px; text-align: center; }
.denied h2 { margin: 10px 0 8px; }
.denied p { margin: 6px 0; }
.denied code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.denied-ic { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); }
.denied-ic svg { width: 28px; height: 28px; }
.ud-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ud-head .badge { margin-inline-end: 4px; }
.ud-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.ud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.ud-grid > div { display: flex; flex-direction: column; gap: 3px; }
.ud-grid span { color: var(--text-2); font-size: 12.5px; }
@media (max-width: 640px) { .ud-grid { grid-template-columns: 1fr; } }
.role-pick { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0; }
.role-pick .check { gap: 6px; }
.role-pick input[type=radio] { margin-inline-start: 4px; accent-color: var(--accent); }
ul.plain { list-style: none; padding: 0; margin: 0; columns: 2; }
ul.plain li { padding: 3px 0; }
.pm-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pm-tools .input { max-width: 340px; }
.pm-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.pm-mod { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; overflow: hidden; background: var(--surface); }
.pm-mod-head { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--surface-2); flex-wrap: wrap; }
.pm-bulk { display: inline-flex; gap: 8px; margin-inline-start: auto; }
.pm-res .pm-bulk { margin-inline-start: 8px; opacity: .65; }
.pm-row { display: grid; grid-template-columns: 210px 1fr; border-top: 1px solid var(--border); }
.pm-res { padding: 9px 14px; font-weight: 600; font-size: 13.5px; display: flex; align-items: flex-start; }
.pm-acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 10px; }
.pm-cell { display: inline-flex; align-items: center; gap: 4px; }
.pm-pill { border: 1px solid var(--border-strong, var(--border)); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; background: var(--surface); color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-family: inherit; line-height: 1.6; }
.pm-pill:disabled { cursor: default; }
.pm-pill.allow { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.pm-pill.deny { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); font-weight: 600; text-decoration: line-through; }
.pm-pill.eff-on { border-style: dashed; color: var(--text); }
.pm-pill .pm-eff { font-style: normal; color: var(--ok); font-weight: 700; min-width: .6em; }
.pm-pill.deny .pm-eff { color: var(--danger); }
.pm-pill .pm-sens { font-style: normal; color: var(--warn); font-size: 11px; }
.pm-scope { font-size: 12px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pm-sc { font-size: 11.5px; color: var(--text-3, var(--text-2)); }
@media (max-width: 700px) { .pm-row { grid-template-columns: 1fr; } .pm-res { padding-bottom: 0; } }
.badge.au-security { background: var(--accent-soft); color: var(--accent); }
.badge.au-admin { background: var(--teal-soft); color: var(--teal); }
.badge.au-data { background: #eef0ed; color: var(--text-2); }

/* pages whose export permission the user lacks */
.no-export #csv { display: none !important; }

/* ------------------------------------------------------------------ AI customer service (pages/cs.js) */
.aics-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.aics-p { background: #eef0ed; color: var(--text-2); }
.aics-p-messenger { background: #e8eef7; color: #2d5a8c; }
.aics-p-instagram { background: #f6e9f0; color: #8c2d63; }
.aics-p-tiktok { background: #e9eef0; color: #1f3b47; }
.aics-inbox { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.aics-list { display: flex; flex-direction: column; max-height: calc(100vh - 210px); min-height: 420px; }
.aics-list-tools { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.aics-list-tools .seg button { padding: 4px 9px; font-size: 12.5px; }
.aics-list-row { display: flex; gap: 8px; }
.aics-list-row .input { min-width: 0; flex: 1; }
#list { overflow-y: auto; flex: 1; }
.aics-conv { display: block; width: 100%; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; }
.aics-conv:hover { background: var(--surface-2); }
.aics-conv.on { background: var(--accent-soft); }
.aics-conv-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.aics-conv-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.aics-conv-meta .badge { font-size: 11px; padding: 1px 7px; }
.aics-thread { display: flex; flex-direction: column; max-height: calc(100vh - 210px); min-height: 420px; }
.aics-thread-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.aics-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.aics-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.aics-msg { display: flex; flex-direction: column; max-width: 78%; }
.aics-msg.in { align-self: flex-start; }
.aics-msg.out { align-self: flex-end; align-items: flex-end; }
.aics-bubble { padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); white-space: normal; overflow-wrap: anywhere; }
.aics-msg.out .aics-bubble, .aics-bubble.out { background: var(--accent-soft); border-color: transparent; }
.aics-msg.aics-s-agent .aics-bubble { background: var(--teal-soft); }
.aics-msg.aics-s-system .aics-bubble { background: var(--warn-soft); }
.aics-msg-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.aics-msg-meta .badge { font-size: 11px; padding: 0 7px; }
.aics-err { color: var(--danger); }
.aics-reply { border-top: 1px solid var(--border); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.aics-reply textarea { resize: vertical; min-height: 54px; }
.aics-reply-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.aics-try-res { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.aics-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.aics-h3 { margin: 0; padding: 12px 16px; font-size: 15px; }
.aics-meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.aics-meter span { display: block; height: 100%; background: var(--teal); }
.aics-meter span.hot { background: var(--danger); }
.aics-form .span-3 { grid-column: span 3; }
@media (max-width: 900px) {
  .aics-inbox, .aics-grid2 { grid-template-columns: 1fr; }
  .aics-list, .aics-thread { max-height: none; min-height: 0; }
  #list { max-height: 50vh; }
  .aics-msgs { max-height: 60vh; }
  .aics-msg { max-width: 92%; }
  .aics-form .span-3 { grid-column: auto; }
}

/* ------------------------------------------------------------------ marketing & attribution (pages/marketing.js) */
.mk-p { background: #eef0ed; color: var(--text-2); }
.mk-p-facebook { background: #e8eef7; color: #2d5a8c; }
.mk-p-instagram { background: #f6e9f0; color: #8c2d63; }
.mk-p-tiktok { background: #e9eef0; color: #1f3b47; }
.mk-p-google { background: #eaf3ea; color: #2c6b34; }
.mk-filters { margin-bottom: 8px; }
.mk-fresh { margin: 0 2px 12px; }
.mk-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mk-kpis .value { font-size: 20px; }
.mk-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: start; }
.mk-grid4 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; align-items: start; }
.mk-h3 { margin: 0; padding: 12px 16px; font-size: 15px; }
.mk-bar-col { width: 34%; }
.mk-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.mk-bar span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
table.mk-sort th[data-s] { cursor: pointer; user-select: none; }
table.mk-sort th[data-dir="asc"]::after { content: " ▲"; font-size: 10px; }
table.mk-sort th[data-dir="desc"]::after { content: " ▼"; font-size: 10px; }
.mk-plats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mk-plat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mk-utm-out { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.mk-utm-url { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; word-break: break-all; font-family: ui-monospace, monospace; font-size: 13px; width: 100%; text-align: left; }
.mk-checks { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.mk-attr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mk-tl { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
@media (max-width: 1100px) { .mk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .mk-grid2, .mk-grid4 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .mk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mk-plats { grid-template-columns: 1fr; } .mk-bar-col { display: none; } }
.mk-grid2 > *, .mk-grid4 > *, .mk-plats > * { min-width: 0; }
.mk-plat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mk-diff { font-weight: 600; color: var(--warn, #b45309); }
.mk-causes { margin-top: 12px; font-size: 13px; }
.mk-causes ul { margin: 6px 0 0; padding-inline-start: 20px; }
.mk-ins-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.mk-ins-list li { padding: 8px 12px; border-inline-start: 3px solid var(--line, #cbd5e1); background: var(--bg-soft, rgba(0,0,0,.03)); border-radius: 6px; }
.mk-ins-list li.mk-ins-warn { border-inline-start-color: var(--warn, #b45309); }
