/* Receivly — hand-written, dependency-free stylesheet. Mobile first, light & dark. */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #f1f3f0;
  --border: #e2e5e0;
  --border-strong: #cfd4cc;
  --text: #17201c;
  --text-2: #4b5751;
  --muted: #6b7670;
  --primary: #0f766e;
  --primary-hover: #0b5f58;
  --primary-soft: #e3f3f1;
  --on-primary: #ffffff;
  --accent: #b45309;
  --warn: #b42318;
  --warn-soft: #fdecea;
  --good: #15803d;
  --good-soft: #e8f5ec;
  --info: #1d4ed8;
  --info-soft: #e8efff;
  --amber-soft: #fff4e0;
  --violet: #6d28d9;
  --violet-soft: #f1ebff;
  --whatsapp: #128c7e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 20 / 6%), 0 4px 16px rgb(16 24 20 / 5%);
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #161d1a;
    --surface-2: #1c2521;
    --border: #27312c;
    --border-strong: #35413b;
    --text: #e8eeea;
    --text-2: #b9c4be;
    --muted: #8d9a93;
    --primary: #2dd4bf;
    --primary-hover: #5eead4;
    --primary-soft: #12302c;
    --on-primary: #06231f;
    --accent: #f59e0b;
    --warn: #f87171;
    --warn-soft: #3a1717;
    --good: #4ade80;
    --good-soft: #12301d;
    --info: #93b4ff;
    --info-soft: #172341;
    --amber-soft: #33260f;
    --violet: #c4b5fd;
    --violet-soft: #261d3d;
    --whatsapp: #25d366;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--primary); color: var(--on-primary); padding: .5rem 1rem; z-index: 100; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.r { text-align: end; }
.pre { white-space: pre-wrap; word-break: break-word; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-warn { color: var(--warn); font-weight: 600; }
.text-error { color: var(--warn); }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.icon { display: inline-flex; width: 1.1em; height: 1.1em; vertical-align: -0.18em; }
.icon svg, .logo-mark { width: 100%; height: 100%; }
.icon svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { min-height: 32px; padding: .25rem .65rem; font-size: .85rem; }
.btn-lg { min-height: 48px; padding: .75rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { min-width: 40px; padding: .5rem; }
.btn-whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { filter: brightness(.95); background: var(--whatsapp); }
.btn-action { min-width: 12rem; }
.act-dispute { border-color: var(--violet); color: var(--violet); }
.act-call, .act-escalate { border-color: var(--warn); color: var(--warn); }
.act-verify { border-color: var(--good); color: var(--good); }
.act-remind { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.act-remind:hover { background: var(--primary-hover); }
.linklike { background: none; border: 0; padding: .45rem .75rem; font: inherit; color: var(--text); cursor: pointer; text-align: start; width: 100%; }
.linklike:hover { background: var(--surface-2); }
.linklike.danger { color: var(--warn); }
.inline-form { display: inline; margin: 0; }

/* Badges & chips */
.badges { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-draft { background: var(--surface-2); }
.badge-unpaid { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-partially_paid { background: var(--amber-soft); color: var(--accent); border-color: transparent; }
.badge-paid { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-cancelled { text-decoration: line-through; }
.badge-overdue { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-dispute { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.badge-promise-pending { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-promise-kept { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-promise-broken { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-imp-new { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-imp-error { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-imp-possible_duplicate { background: var(--amber-soft); color: var(--accent); border-color: transparent; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .9rem; font-weight: 500; }
.chip:hover { text-decoration: none; border-color: var(--border-strong); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.count { display: inline-flex; min-width: 1.6rem; justify-content: center; padding: 0 .4rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .85rem; }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin: 0 0 1rem; border: 1px solid transparent; }
.alert ul { margin: .25rem 0 0; padding-inline-start: 1.2rem; }
.alert-success { background: var(--good-soft); color: var(--good); }
.alert-error { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--amber-soft); color: var(--accent); }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.narrow { max-width: 560px; margin: 2rem auto; }

/* Forms */
.form { margin: 0; }
.grid-form { display: grid; gap: .9rem 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid-form { grid-template-columns: 1fr 1fr; } .inline-grid { grid-template-columns: repeat(4, 1fr); } .inline-grid .field-wide { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, legend { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.req { color: var(--warn); }
.hint { color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: .55rem .7rem; min-height: 42px; width: 100%; }
textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
input[type='checkbox'] { width: auto; min-height: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--primary-soft); }
fieldset { border: 0; padding: 0; margin: 0 0 .5rem; min-width: 0; }
fieldset legend { margin-bottom: .6rem; font-size: 1rem; color: var(--text); }
fieldset[disabled] { opacity: .75; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-top: .5rem; }
.form-actions .field { min-width: 11rem; flex: 0 0 auto; }
.check { display: inline-flex; gap: .5rem; align-items: center; font-weight: 500; }
.filters { margin-bottom: 1rem; }
.filter-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-row input[type='search'] { flex: 1 1 16rem; width: auto; }
.filter-row select { width: auto; }
.copy-input { font-family: var(--mono); font-size: .85rem; margin-bottom: .6rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .6rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table td.r, .table th.r { text-align: end; }
.table tfoot td { font-weight: 700; border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
@media (max-width: 720px) {
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .6rem; padding: .4rem .2rem; background: var(--surface); }
  .table.responsive td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .3rem .6rem; text-align: end; }
  .table.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: start; }
  .table.responsive tfoot { display: none; }
}
.bars th { width: 7rem; text-transform: none; font-size: .9rem; color: var(--text-2); }
.bar-cell { width: 55%; vertical-align: middle; }
progress { width: 100%; height: 10px; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.bar-d31_60::-webkit-progress-value, .bar-d1_30::-webkit-progress-value { background: var(--accent); }
.bar-d61_90::-webkit-progress-value, .bar-d90_plus::-webkit-progress-value { background: var(--warn); }
.bar-d31_60::-moz-progress-bar, .bar-d1_30::-moz-progress-bar { background: var(--accent); }
.bar-d61_90::-moz-progress-bar, .bar-d90_plus::-moz-progress-bar { background: var(--warn); }
.bar-good::-webkit-progress-value { background: var(--good); }
.bar-good::-moz-progress-bar { background: var(--good); }
.progress { margin-top: 1rem; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: .75rem; gap: .5rem; }

/* App shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-mark rect { fill: var(--primary); }
.logo-mark path { stroke: var(--on-primary); }
.ws-switch select { width: auto; min-height: 36px; padding: .3rem .6rem; font-weight: 600; max-width: 14rem; }
.ws-name { font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { margin-inline-start: auto; position: relative; }
.user-menu summary, .more-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker, .more-menu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .35rem 0; z-index: 30; display: flex; flex-direction: column; }
.menu a { padding: .45rem .75rem; color: var(--text); }
.menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu-head { padding: .5rem .75rem; border-bottom: 1px solid var(--border); margin-bottom: .25rem; display: flex; flex-direction: column; }
.more-menu { position: relative; display: inline-block; }
.shell { display: flex; min-height: calc(100vh - 57px); }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; padding: 1rem 1rem 6rem; max-width: 1240px; margin: 0 auto; width: 100%; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tabbar .nav-item { flex-direction: column; gap: .15rem; padding: .45rem .2rem; font-size: .68rem; border-radius: 0; text-align: center; justify-content: center; }
.tabbar .nav-item .icon { width: 1.35em; height: 1.35em; }
@media (min-width: 960px) {
  .sidebar { display: flex; flex-direction: column; gap: .2rem; width: 230px; padding: 1rem .75rem; border-inline-end: 1px solid var(--border); background: var(--surface); position: sticky; top: 57px; height: calc(100vh - 57px); }
  .tabbar { display: none; }
  .content { padding: 1.5rem 2rem 3rem; }
}
.crumbs { display: flex; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.subtitle { color: var(--muted); margin: .2rem 0 0; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* KPIs */
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.35rem; font-weight: 800; margin: .2rem 0; overflow-wrap: anywhere; }
.kpi-sub { color: var(--muted); font-size: .82rem; }
.kpi-warn .kpi-value { color: var(--warn); }
.kpi-good .kpi-value { color: var(--good); }
.kpis-small .kpi-value { font-size: 1.2rem; }

/* Queue */
.queue { list-style: none; margin: 0; padding: 0; }
.queue-item { display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: 0; }
.queue-score { grid-row: span 2; display: flex; align-items: flex-start; }
.queue-score span { display: inline-flex; width: 2.6rem; height: 2.6rem; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; background: var(--primary-soft); color: var(--primary); }
.queue-title { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.queue-title a { color: var(--text); }
.queue-meta { color: var(--muted); font-size: .88rem; }
.queue-action { grid-column: 2; display: flex; gap: .4rem; flex-wrap: wrap; }
@media (min-width: 900px) {
  .queue-item { grid-template-columns: auto 1fr auto; }
  .queue-score { grid-row: auto; }
  .queue-action { grid-column: auto; align-items: flex-start; }
}
.queue-compact .queue-score span { width: 2.1rem; height: 2.1rem; font-size: .85rem; background: var(--surface-2); color: var(--muted); }
.why { margin-top: .3rem; font-size: .88rem; }
.why summary { cursor: pointer; color: var(--muted); }
.why ul, .reasons { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-direction: column; gap: .25rem; }
.pts { display: inline-flex; min-width: 2.6rem; justify-content: center; margin-inline-end: .5rem; border-radius: 6px; font-weight: 700; font-size: .8rem; padding: 0 .3rem; }
.pts-up { background: var(--warn-soft); color: var(--warn); }
.pts-down { background: var(--good-soft); color: var(--good); }
.score-pill { background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: .15rem .7rem; font-weight: 700; font-size: .85rem; }
.next-action { font-size: 1.05rem; }

/* Onboarding */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.checklist li { display: flex; gap: .6rem; align-items: center; }
.checklist li a { margin-inline-start: auto; font-size: .9rem; font-weight: 600; }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.checklist .icon { color: var(--good); }
.dot { width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; }

/* Detail pages */
.detail-head { margin: -.4rem 0 1rem; }
.detail-grid { display: grid; gap: 1rem; }
@media (min-width: 1100px) { .detail-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); } }
.summary-grid { display: grid; gap: .9rem 1.2rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.summary-grid .label { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .15rem; }
.summary-grid .emph { font-size: 1.15rem; font-weight: 800; }
.summary-grid .span2 { grid-column: 1 / -1; }
.seg-group { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg a { padding: .35rem .75rem; color: var(--text-2); font-size: .88rem; font-weight: 500; border-inline-end: 1px solid var(--border); }
.seg a:last-child { border-inline-end: 0; }
.seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg a.active { background: var(--primary); color: var(--on-primary); }
.composer textarea[dir='rtl'], .composer input[dir='rtl'] { font-size: 1.05rem; }
.composer-send { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.sent-list ul { list-style: none; padding: 0; display: grid; gap: .6rem; }
.promise-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.promise { padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; padding-inline-start: 1rem; border-inline-start: 2px solid var(--border); display: grid; gap: .8rem; }
.tl { position: relative; }
.tl::before { content: ''; position: absolute; inset-inline-start: -1.38rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--surface); }
.tl-payment_recorded::before, .tl-promise_kept::before { background: var(--good); }
.tl-promise_broken::before, .tl-dispute_opened::before { background: var(--warn); }
.tl-reminder_sent::before, .tl-call::before, .tl-whatsapp::before, .tl-email::before { background: var(--primary); }
.tl-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--text-2); }
.empty-icon { width: 2.6rem; height: 2.6rem; margin: 0 auto .6rem; color: var(--muted); }
.empty-icon svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.howto { padding-inline-start: 1.2rem; display: grid; gap: .35rem; }
.link-list, .plain-list { list-style: none; padding: 0; display: grid; gap: .45rem; }
.summary-text { font-family: var(--mono); font-size: .85rem; margin-bottom: .6rem; }
.roles-help { margin-top: .75rem; color: var(--text-2); }
.detail-side .inline-grid { grid-template-columns: 1fr; }
.import-table .row-error { background: color-mix(in srgb, var(--warn-soft) 50%, transparent); }

/* Public site */
.public { background: var(--surface); }
.public-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 10; }
.public-nav { display: flex; gap: 1rem; align-items: center; }
.public-nav > a:not(.btn) { color: var(--text-2); font-weight: 500; }
@media (max-width: 560px) { .public-nav > a:not(.btn) { display: none; } .public-nav { gap: .5rem; } }
.public main { min-height: 70vh; }
.public main > .alert { max-width: 560px; margin: 1rem auto; }
.public-footer { padding: 2.5rem clamp(1rem, 4vw, 3rem) 1.5rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }
.hero { display: grid; gap: 2rem; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem); max-width: 1200px; margin: 0 auto; align-items: center; }
@media (min-width: 960px) { .hero { grid-template-columns: 1.15fr 1fr; } }
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); letter-spacing: -0.025em; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--primary); }
.lead { font-size: 1.12rem; color: var(--text-2); max-width: 38rem; }
.hero-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0 .75rem; }
.hero-card { background: var(--bg); border: 1px solid var(--border); border-radius: 18px; padding: 1rem; box-shadow: 0 20px 50px rgb(16 24 20 / 10%); }
.mock-head { font-weight: 700; padding: .3rem .4rem .7rem; color: var(--text-2); }
.mock-row { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .65rem .7rem; margin-bottom: .5rem; }
.mock-row small { display: block; color: var(--muted); }
.mock-action { font-size: .8rem; font-weight: 700; color: var(--primary); }
.band { background: var(--bg); border-block: 1px solid var(--border); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; text-align: center; gap: 1rem; }
.stats strong { display: block; font-size: 1.5rem; color: var(--primary); }
.stats span { color: var(--muted); font-size: .9rem; }
.section { max-width: 1100px; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 2rem); }
.section > h2 { font-size: 1.6rem; text-align: center; margin-bottom: 1.5rem; }
.steps { list-style: none; padding: 0; display: grid; gap: 1rem; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(2, 1fr); } }
.step { display: flex; gap: 1rem; padding: 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step-n { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.features { display: grid; gap: 1rem; }
@media (min-width: 700px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 1.2rem; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.feature .icon { width: 1.6rem; height: 1.6rem; color: var(--primary); margin-bottom: .5rem; }
.plans { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 800px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.pay-options { display: flex; flex-direction: column; gap: .4rem; }
.pay-options form, .pay-options .btn { width: 100%; }
.plan { position: relative; padding: 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: .6rem; }
.plan ul { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: .35rem; flex: 1; align-content: start; }
.plan li { display: flex; gap: .4rem; align-items: baseline; }
.plan li .icon { color: var(--good); }
.plan-featured { border: 2px solid var(--primary); box-shadow: 0 10px 30px rgb(15 118 110 / 12%); }
.plan-tag { position: absolute; top: -.75rem; inset-inline-start: 1.2rem; background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; }
.price { font-size: 1.8rem; font-weight: 800; margin: 0; }
.price small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.faq details { border-bottom: 1px solid var(--border); padding: .9rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: .5rem 0 0; color: var(--text-2); }
.cta-band { text-align: center; }
.auth { max-width: 460px; margin: 2.5rem auto; }
.auth .form { display: grid; gap: .9rem; margin: 1rem 0; }
.prose p { color: var(--text-2); }

@media print {
  .topbar, .sidebar, .tabbar, .page-actions, form, .why summary { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Small phones: keep amounts and long action labels inside their cards */
@media (max-width: 600px) {
  .kpi { padding: .75rem .8rem; }
  .kpi-value { font-size: 1.02rem; }
  .kpi-value .num { white-space: normal; }
  .btn { white-space: normal; text-align: center; }
  .btn-action { min-width: 0; width: 100%; }
  .queue-action { flex-direction: column; align-items: stretch; }
  .page-head .page-actions { width: 100%; }
  .summary-grid .emph { font-size: 1.02rem; }
  .seg a { padding: .35rem .55rem; }
}

/* ---- Languages & right-to-left ---------------------------------------- */
.lang-switch { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .88rem; }
.lang-switch a { color: var(--text-2); }
.lang-switch a.active { color: var(--text); font-weight: 600; }
.menu .lang-switch { border-top: 1px solid var(--border); margin-top: .25rem; padding: .4rem .75rem .2rem; gap: .1rem .6rem; flex-direction: row; }
.menu .lang-switch a { padding: .2rem 0; }
.lang-picker { position: relative; }
.lang-picker summary { list-style: none; cursor: pointer; padding: .35rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.lang-picker summary::-webkit-details-marker { display: none; }
.lang-picker .lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; min-width: 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .35rem 0; }
.lang-picker .lang-menu a { padding: .4rem .8rem; }
.lang-picker .lang-menu a:hover { background: var(--surface-2); text-decoration: none; }
.public-footer .lang-switch { justify-content: center; }
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif; }
[dir="rtl"] .num, [dir="rtl"] code, [dir="rtl"] input[type="email"], [dir="rtl"] input[type="tel"] { direction: ltr; unicode-bidi: isolate; }

/* ---- Trust, support, assistant (v2) ------------------------------------ */
.grid-3 { display: grid; gap: 1rem; }
@media (min-width: 800px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.narrow-form { max-width: 720px; }
.hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

.announce { display: flex; align-items: center; gap: .6rem; justify-content: center; flex-wrap: wrap; padding: .5rem 1rem; font-size: .9rem; font-weight: 500; background: var(--info-soft); color: var(--info); border-bottom: 1px solid var(--border); }
.announce .icon { width: 1rem; height: 1rem; }
.announce a { color: inherit; text-decoration: underline; }
.announce-warning { background: var(--amber-soft); color: var(--accent); }
.announce-incident { background: var(--warn-soft); color: var(--warn); }

.top-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; color: var(--text-2); }
.top-icon:hover { background: var(--surface-2); text-decoration: none; }
.top-icon .icon { width: 1.25rem; height: 1.25rem; }
.topbar .top-icon:first-of-type { margin-inline-start: auto; }
.topbar .top-icon ~ .user-menu { margin-inline-start: 0; }
.bell-count { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--warn); color: #fff; font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.foot-grid { display: grid; gap: 1.5rem; max-width: 1100px; margin: 0 auto; }
@media (min-width: 800px) { .foot-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.foot-brand p { margin: .5rem 0 1rem; max-width: 32ch; }
.foot-col { display: flex; flex-direction: column; gap: .35rem; }
.foot-col h4 { margin: 0 0 .3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); }
.foot-col a { color: var(--text-2); }
.foot-bottom { max-width: 1100px; margin: 1.5rem auto 0; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.public-footer .lang-switch { justify-content: flex-start; }

.social { margin-top: 1rem; display: grid; gap: .5rem; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-social { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }

.qr { display: inline-block; padding: .5rem; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.qr svg { display: block; width: 200px; height: 200px; }
.secret { font-size: .95rem; letter-spacing: .05em; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; list-style: none; padding: 0; margin: 1rem 0; }
.codes code { display: block; padding: .4rem .6rem; background: var(--surface-2); border-radius: 6px; text-align: center; font-size: 1rem; }
.danger-zone { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.btn.danger { background: var(--warn); border-color: var(--warn); color: #fff; }
.account-links .btn { white-space: normal; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif .linklike { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem .25rem; }
.notif.unread .linklike span { font-weight: 600; }
.notif.unread { background: linear-gradient(90deg, var(--primary-soft), transparent 40%); }

.help-cards { margin-bottom: 1rem; }
.help-card { display: block; color: var(--text); transition: border-color .15s, transform .15s; }
.help-card:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.help-card .icon { width: 1.6rem; height: 1.6rem; color: var(--primary); }
.help-card h3 { margin: .5rem 0 .25rem; font-size: 1.05rem; }
.page-hero { max-width: 820px; margin: 0 auto; padding: clamp(2rem, 6vw, 3.5rem) clamp(1rem, 4vw, 2rem) 1.5rem; text-align: center; }
.page-hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); letter-spacing: -0.02em; }
.help-search { display: flex; gap: .5rem; max-width: 620px; margin: 1.5rem auto 0; }
.help-search input { flex: 1; min-height: 44px; padding: .5rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.public main > .grid-3, .public main > .section.center { max-width: 1100px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.how { list-style: none; max-width: 860px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); display: grid; gap: 1rem; }
.how-step { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.how-n { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 999px; background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.how-step .icon { width: 1.3rem; height: 1.3rem; color: var(--primary); float: inline-end; }
.how-step h3 { margin: .1rem 0 .3rem; }
.how-step p { margin: 0; color: var(--text-2); }

.legal { max-width: 820px; }
.legal h2 { font-size: 1.1rem; margin-top: 1.6rem; }
.legal-nav { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; }
.legal-nav a[aria-current] { font-weight: 700; color: var(--text); }

.status-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .5rem; }
.status-row { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.status-row .muted { margin-inline-start: auto; }
.dot { width: .7rem; height: .7rem; border-radius: 999px; flex: none; }
.dot-ok { background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); }
.dot-bad { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }

.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.msg { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.msg-staff { background: var(--primary-soft); border-inline-start: 3px solid var(--primary); }
.msg-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }
.staff { max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem); }
.staff-nav { margin-bottom: 1rem; flex-wrap: wrap; }
.contact-list > li { display: block; }
.contact-list .unread { border-inline-start: 3px solid var(--primary); }

.assistant { max-width: 860px; }
.chat { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.bubble { max-width: 85%; padding: .75rem 1rem; border-radius: 16px; line-height: 1.5; box-shadow: var(--shadow); }
.bubble .line { display: block; }
.bubble.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-end-start-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-end-end-radius: 4px; }
.bubble .chip { margin: .4rem .3rem 0 0; }
.chip { display: inline-flex; align-items: center; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover { border-color: var(--primary); text-decoration: none; }
.suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chat-form { display: flex; gap: .5rem; padding: .25rem 0 .75rem; }
.chat-form input { flex: 1; min-height: 46px; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; }
.assistant-intro p { margin: .2rem 0; }

.trust { display: grid; gap: 1rem; }
@media (min-width: 800px) { .trust { grid-template-columns: repeat(4, 1fr); } }
.trust-item { padding: 1.1rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.trust-item .icon { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.trust-item h3 { font-size: 1rem; margin: .5rem 0 .25rem; }
.trust-item p { margin: 0; color: var(--text-2); font-size: .92rem; }

/* ---- Portal, risk grades, forecast, monthly report (v3) ----------------- */
.link-box { width: 100%; min-height: 40px; padding: .45rem .7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; font-size: .85rem; margin: .4rem 0; }
.subs { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.sub { padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; gap: .3rem; }
.sub.new { border-color: var(--primary); background: var(--primary-soft); }
.sub small { margin-inline-start: .4rem; }

.grade { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem; border-radius: 6px; font-weight: 800; font-size: .85rem; background: var(--surface-2); color: var(--muted); }
.grade-A { background: var(--good-soft); color: var(--good); }
.grade-B { background: #e6f4f1; color: var(--primary); }
.grade-C { background: var(--amber-soft); color: var(--accent); }
.grade-D { background: var(--warn-soft); color: var(--warn); }
.grade-E { background: var(--warn); color: #fff; }
.grade-link { display: inline-flex; align-items: center; gap: .35rem; }
.grade-link:hover { text-decoration: none; }
.grade-card .reasons { margin: .25rem 0 .5rem; padding-inline-start: 1.1rem; color: var(--text-2); }

.bar-info::-webkit-progress-value { background: var(--info); }
.bar-info::-moz-progress-bar { background: var(--info); }
.forecast th { white-space: nowrap; font-weight: 500; }
.kpi-inline { font-size: 1.05rem; margin: 1rem 0 .5rem; }

.report-sheet { padding: 1.5rem; }
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; border-bottom: 2px solid var(--primary); padding-bottom: .75rem; margin-bottom: 1rem; }
.report-head h2 { margin: 0; }
@media print {
  .no-print, .announce, .bell-count, .top-icon { display: none !important; }
  .report-sheet { border: 0; padding: 0; }
  .content { padding: 0 !important; }
  .page-head { margin-bottom: .5rem; }
}

.portal .portal-header { position: static; }
.portal-initial { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-weight: 800; }
.portal-wrap { max-width: 1000px; margin: 1.5rem auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.portal-invoice h1 { margin: .2rem 0 .3rem; }
.portal-facts { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1rem 0; }
@media (min-width: 760px) { .portal-facts { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.portal-facts div { padding: .6rem .7rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.portal-facts dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.portal-facts dd { margin: .15rem 0 0; font-weight: 700; }
.portal-balance { background: var(--primary-soft) !important; }
.portal-balance dd { color: var(--primary); font-size: 1.15rem; }
.portal-pay { margin-top: 1rem; }
.portal-pay h2 { font-size: 1rem; }
.portal-actions h2 { font-size: 1.05rem; }
.portal-footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .85rem; }
.portal-footer a { color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.portal-footer .logo-mark { width: 18px; height: 18px; }
