/* =====================================================================================
   Smart Audit portal design system.
   Ported from the CAREweb Project Risk Management prototype (prm-prototype.html) that the
   user picked as the reference look — same tokens, shell, cards, KPI tiles, tables, pills,
   forms, buttons and modals — rewritten with logical properties so it works in RTL (Arabic,
   the default) and LTR (English). Deliberately unrelated to ALMawrid's accounting styles.
   ===================================================================================== */

:root {
    --ink: #0B2A4A; --ink2: #0F3D7A; --blue: #1E74E8; --blue-d: #155ec4; --blue-soft: #3FA9FF; --sky: #8CC8FF;
    --teal: #00C2D1; --amber: #F2A33A; --alert: #E04A42; --green: #1a9d5a; --purple: #7b3fb0;
    --bg: #EEF2F7; --panel: #fff; --line: #E4EAF2; --line2: #D3DCE8; --muted: #5A6B82; --dim: #93A0B5;
    --r: 10px; --sans: 'Cairo', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --shadow-sm: 0 1px 2px rgba(11,42,74,.05), 0 2px 8px rgba(11,42,74,.05);
    --shadow-md: 0 6px 18px rgba(11,42,74,.10), 0 2px 5px rgba(11,42,74,.06);
    --shadow-lg: 0 24px 60px rgba(11,42,74,.22), 0 8px 20px rgba(11,42,74,.12);
    --crit: #c0392b; --high: #E04A42; --mod: #F2A33A; --low: #1a9d5a;
    /* Theme tokens: surfaces and tints that flip in dark mode. */
    --panel: #fff; --sunken: #F5F8FC; --subtle: #FAFCFF; --hover: #F1F5FA; --skeleton: #E9EEF5; --shine: rgba(255,255,255,.65);
    --tint-blue: #E7F1FE; --tint-blue-line: #cfe2fb; --tint-blue-2: #EEF5FF; --tint-info: #EAF3FE; --tint-gray: #EEF2F7;
    --tint-crit: #FDECEB; --tint-crit-line: #f3cac6; --tint-crit-2: #FDF3F2; --tint-mod: #FFF4E0; --tint-low: #E4F6EC; --tint-low-line: #bfe3cf;
    --tint-purple: #F3ECFB; --tint-warn: #FFF9E8; --tint-warn-line: #F0E0A8; --tint-changed: #FFF8D6; --tint-diff: #FFFBEB;
    --row-alert: #FDF6F5; --row-alert-h: #FCEEEC; --chart-bar: #86B6EF; --status-code: #EEF4FC;
    --t-crit: #c0392b; --t-crit2: #a5352c; --t-mod: #9a6a12; --t-mod2: #8a6d12; --t-low: #1a9d5a; --t-blue: #1E74E8;
    --t-purple: #7b3fb0; --t-gray: #5A6B82; --t-info: #155ec4; --t-new: #0d7a4a;
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); font-family: var(--sans); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font-family: var(--sans); }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- shell ---------- */
.app { max-width: 1440px; margin: 16px auto; background: var(--bg); border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); }
.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--panel); padding: 9px 18px; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--blue), var(--ink2)); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.brand-name b { color: var(--blue); font-weight: 800; }
.mod-pill { font-size: 11px; font-weight: 700; color: var(--blue); background: var(--tint-blue); border: 1px solid var(--tint-blue-line); border-radius: 20px; padding: 5px 12px; white-space: nowrap; }
.tb-ctx { font-size: 12.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.tb-ic { width: 32px; height: 32px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); display: flex; align-items: center; justify-content: center; color: var(--muted); position: relative; padding: 0; }
.tb-ic:hover { border-color: var(--blue); color: var(--blue); }
.tb-ic svg { width: 17px; height: 17px; }
.lang-sel { border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 8px; height: 32px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--ink2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: none; padding: 0; }
.menu { position: relative; }
.menu-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px; display: none; z-index: 60; }
.menu.on .menu-pop { display: block; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head .nm { font-weight: 800; font-size: 13px; }
.menu-head .em { font-size: 11.5px; color: var(--dim); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; text-align: start; padding: 8px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.menu-item:hover { background: var(--hover); color: var(--blue); }
.menu-item svg { width: 15px; height: 15px; }
.hintbar { background: #0B2A4A; color: #cfe2fb; font-size: 11.5px; padding: 6px 18px; display: flex; align-items: center; gap: 8px; }
.hintbar b { color: #fff; }
.hintbar .x { margin-inline-start: auto; cursor: pointer; color: #8CC8FF; font-weight: 700; background: none; border: none; font-size: 13px; }
.body { display: flex; min-height: 720px; }
.side { width: 214px; flex: 0 0 214px; background: var(--panel); border-inline-end: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; }
.main { flex: 1; min-width: 0; padding: 18px 22px 28px; overflow: auto; }
.grp { font-size: 10px; color: var(--dim); font-weight: 700; padding: 12px 10px 4px; letter-spacing: .04em; text-transform: uppercase; }
.grp:first-child { padding-top: 4px; }
.navitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 2px; text-decoration: none !important; }
.navitem svg { width: 17px; height: 17px; flex: 0 0 auto; }
.navitem:hover { background: var(--hover); color: var(--ink); }
.navitem.on { background: var(--tint-blue); color: var(--blue); }
.navitem .badge { margin-inline-start: auto; font-size: 10px; background: var(--alert); color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 700; }
.navitem.soon { opacity: .5; pointer-events: none; }
.navitem.soon::after { content: attr(data-soon); margin-inline-start: auto; font-size: 9.5px; font-weight: 700; color: var(--dim); background: var(--bg); border-radius: 10px; padding: 1px 7px; }
.side-toggle { display: none; }

/* ---------- page header ---------- */
.crumb { font-size: 11px; color: var(--dim); margin-bottom: 2px; }
.crumb a { color: var(--dim); }
.pgtitle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pgtitle h1 { font-size: 20px; font-weight: 800; }
.pgtitle .sp { flex: 1; }
.back { width: 30px; height: 30px; border: 1px solid var(--line2); border-radius: 8px; background: var(--panel); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.back svg { width: 16px; height: 16px; }
[dir=rtl] .back svg { transform: scaleX(-1); }
.pgsub { font-size: 12.5px; color: var(--muted); margin: 2px 0 16px; }

/* ---------- cards / kpi / grid ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.pad { padding: 16px; }
.pad-sm { padding: 11px 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-main-side { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.stack-lg > * + * { margin-top: 14px; }
.sec-title { font-size: 13px; font-weight: 800; color: var(--ink2); margin: 2px 0 10px; display: flex; align-items: center; gap: 7px; }
.sec-title::before { content: ""; width: 4px; height: 15px; background: var(--blue); border-radius: 3px; flex: 0 0 auto; }
.sec-title .sp { flex: 1; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; box-shadow: var(--shadow-sm); display: block; color: inherit; text-decoration: none !important; }
a.kpi:hover { box-shadow: var(--shadow-md); }
.kpi.acc { border-top: 3px solid var(--blue); }
.kpi.acc.crit { border-top-color: var(--crit); } .kpi.acc.high { border-top-color: var(--high); }
.kpi.acc.mod { border-top-color: var(--mod); } .kpi.acc.low { border-top-color: var(--low); }
.kpi.acc.teal { border-top-color: var(--teal); }
.kpi .t { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.kpi .n { font-size: 27px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .n span { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi .n.crit { color: var(--crit); } .kpi .n.mod { color: var(--mod); } .kpi .n.low { color: var(--low); }
.kpi .foot { font-size: 10.5px; color: var(--dim); margin-top: 5px; }
/* Month-on-month line: a direction cue only — more usage/clients isn't "bad", so no red/green verdict. */
.kpi .foot.trend { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; }
.kpi .foot.trend .ltr { font-weight: 800; }
.kpi .foot.trend.up .ltr { color: var(--blue); }
.kpi .foot.trend.down .ltr { color: var(--muted); }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 18px; }
.dl .k { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.dl .v { font-size: 13px; font-weight: 700; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
.card > .tbl-wrap { border: none; border-radius: 0 0 var(--r) var(--r); border-top: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--panel); }
table.tbl th { background: var(--sunken); color: var(--muted); font-weight: 700; padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--line); font-size: 11px; white-space: nowrap; }
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover, table.tbl th.sortable:focus-visible { color: var(--ink); outline: none; }
table.tbl th .arrow { display: inline-block; width: 10px; margin-inline-start: 4px; font-size: 9px; opacity: .35; }
table.tbl th .arrow::after { content: "▲▼"; letter-spacing: -2px; font-size: 7px; }
table.tbl th[aria-sort=ascending] .arrow, table.tbl th[aria-sort=descending] .arrow { opacity: 1; color: var(--blue); }
table.tbl th[aria-sort=ascending] .arrow::after { content: "▲"; font-size: 9px; }
table.tbl th[aria-sort=descending] .arrow::after { content: "▼"; font-size: 9px; }
table.tbl th[aria-sort=ascending], table.tbl th[aria-sort=descending] { color: var(--blue); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: var(--subtle); }
table.tbl td.end, table.tbl th.end { text-align: end; }
table.tbl .ttl { font-weight: 700; color: var(--ink); }
table.tbl .sub { font-size: 11px; color: var(--dim); }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pill.crit, .pill.high { background: var(--tint-crit); color: var(--t-crit); }
.pill.mod { background: var(--tint-mod); color: var(--t-mod); }
.pill.low { background: var(--tint-low); color: var(--t-low); }
.pill.blue { background: var(--tint-blue); color: var(--t-blue); }
.pill.purple { background: var(--tint-purple); color: var(--t-purple); }
.pill.gray { background: var(--tint-gray); color: var(--t-gray); }
.pill.health { display: inline-flex; align-items: center; gap: 5px; }
.pill.health .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; background: var(--panel); min-width: 230px; }
.search svg { width: 15px; height: 15px; color: var(--dim); flex: 0 0 auto; }
.search input { border: none; outline: none; font-family: var(--sans); font-size: 12.5px; width: 100%; background: transparent; }
.chip-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11.5px; font-weight: 600; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .n { font-size: 10px; font-weight: 800; background: var(--bg); color: var(--muted); border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; }
.chip.on .n { background: rgba(255,255,255,.22); color: #fff; }
.chip.zero { opacity: .55; }
.meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.meter > i.mod { background: var(--mod); } .meter > i.crit { background: var(--crit); }
/* Empty state: says why the list is empty and offers the next step as a button. */
.empty { text-align: center; padding: 40px 16px 36px; color: var(--muted); }
.empty-ic { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; background: var(--tint-blue); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.empty-ic svg { width: 26px; height: 26px; }
.empty .ttl { font-weight: 800; color: var(--ink); font-size: 14.5px; }
.empty .sub { font-size: 12.5px; margin: 4px auto 0; max-width: 420px; line-height: 1.7; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.empty.compact { padding: 22px 12px 20px; }
.empty.compact .empty-ic { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 8px; }
.empty.compact .empty-ic svg { width: 19px; height: 19px; }
.empty.compact .ttl { font-size: 13px; }
.empty.compact .sub { font-size: 11.5px; }
.empty.compact .empty-actions { margin-top: 12px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label, .field .lbl { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--ink2); }
.field .hint { font-size: 11px; color: var(--dim); margin-top: 4px; }
.req { color: var(--alert); }
.inp, .sel { width: 100%; padding: 8px 11px; border: 1px solid var(--line2); border-radius: 8px; font-family: var(--sans); font-size: 12.5px; background: var(--panel); color: var(--ink); min-height: 38px; }
.inp:focus, .sel:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,116,232,.12); }
.inp[disabled], .inp[readonly] { background: var(--sunken); color: var(--muted); }
textarea.inp { resize: vertical; min-height: 64px; }
.inp.input-validation-error, .sel.input-validation-error { border-color: var(--alert); }
.field-validation-error, .err { display: block; color: var(--alert); font-size: 11px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; }
.span2 { grid-column: span 2; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 2px; margin: 0 0 14px; background: var(--panel); }
legend { font-size: 11.5px; font-weight: 800; color: var(--ink2); padding: 0 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; }
.check-grid { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-bottom: 12px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; padding: 13px 16px; border-top: 1px solid var(--line); background: var(--subtle); border-radius: 0 0 var(--r) var(--r); }
.validation-summary-valid { display: none; }

/* ---------- buttons / banners ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-size: 12.5px; font-weight: 700; text-decoration: none !important; white-space: nowrap; line-height: 1.4; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn svg { width: 14px; height: 14px; }
.btn.p { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.p:hover { background: var(--blue-d); color: #fff; }
.btn.g { background: var(--green); color: #fff; border-color: var(--green); }
.btn.r { background: var(--alert); color: #fff; border-color: var(--alert); }
.btn.ghost-r { color: var(--alert); }
.btn.ghost-r:hover { border-color: var(--alert); color: var(--alert); background: var(--tint-crit-2); }
.btn.ghost-a { color: var(--t-mod); }
.btn.ghost-a:hover { border-color: var(--amber); background: var(--tint-warn); }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn.xs { padding: 4px 8px; font-size: 11px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .spin { width: 13px; height: 13px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.note-banner { background: var(--tint-warn); border: 1px solid var(--tint-warn-line); color: var(--t-mod2); border-radius: 8px; padding: 9px 13px; font-size: 12px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.note-banner svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; }
.note-banner.info { background: var(--tint-info); border-color: var(--tint-blue-line); color: var(--t-info); }
.note-banner.crit { background: var(--tint-crit); border-color: var(--tint-crit-line); color: var(--t-crit2); }
.note-banner .grow { flex: 1; min-width: 0; }
.note-banner ul { margin: 0; padding-inline-start: 16px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .bold { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.flexrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.copybox { display: flex; gap: 6px; margin-top: 8px; }
.copybox .inp { font-size: 11.5px; }
.pos { color: var(--green); } .neg { color: var(--alert); }

/* ---------- toast / modal ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 30px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: .25s; z-index: 200; display: flex; align-items: center; gap: 9px; pointer-events: none; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast .ic { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.toast.err .ic { background: var(--alert); }
.overlay { position: fixed; inset: 0; background: rgba(11,42,74,.45); display: none; align-items: flex-start; justify-content: center; z-index: 150; padding: 80px 16px; overflow: auto; }
.overlay.on { display: flex; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; overflow: hidden; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; font-weight: 800; }
.modal-close { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-body { padding: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.modal-foot { display: flex; gap: 9px; padding: 13px 18px; border-top: 1px solid var(--line); background: var(--subtle); justify-content: flex-end; }

/* ---------- sign-in / invitation (outside the app shell) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(380px, 520px); }
.auth-aside { background: linear-gradient(160deg, #0B2A4A 0%, #0F3D7A 60%, #155ec4 100%); color: #cfe2fb; padding: 40px 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(140,200,255,.08); }
[dir=rtl] .auth-aside::after { inset: auto auto -160px -120px; }
.auth-aside .brand { color: #fff; }
.auth-aside .brand-name b { color: var(--sky); }
.auth-aside .brand-mark { background: rgba(255,255,255,.12); }
.auth-pitch { margin-top: auto; margin-bottom: auto; max-width: 440px; position: relative; z-index: 1; }
.auth-pitch h2 { color: #fff; font-size: 26px; font-weight: 800; line-height: 1.35; margin-bottom: 12px; }
.auth-pitch p { font-size: 13.5px; line-height: 1.8; }
.auth-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.auth-points svg { width: 18px; height: 18px; color: var(--sky); flex: 0 0 auto; margin-top: 2px; }
.auth-foot { font-size: 11px; color: rgba(207,226,251,.6); position: relative; z-index: 1; }
.auth-main { background: var(--panel); display: flex; flex-direction: column; padding: 28px 44px; }
.auth-top { display: flex; justify-content: flex-end; gap: 8px; }
.auth-form { margin: auto 0; width: 100%; max-width: 380px; align-self: center; }
.auth-form h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-form .pgsub { margin-bottom: 22px; }
.pw { position: relative; }
.pw .inp { padding-inline-end: 38px; }
.pw button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--dim); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.pw button svg { width: 16px; height: 16px; }
.auth-secure { display: flex; gap: 10px; align-items: flex-start; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 22px; }
.auth-secure svg { width: 18px; height: 18px; color: var(--green); flex: 0 0 auto; }
.denied { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ---------- skeleton loading (shimmering placeholders shaped like the content) ---------- */
.sk { position: relative; overflow: hidden; background: var(--skeleton); border-radius: 6px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--shine), transparent); animation: sk-shine 1.2s ease-in-out infinite; }
[dir=rtl] .sk::after { animation-name: sk-shine-rtl; }
@keyframes sk-shine { to { transform: translateX(100%); } }
@keyframes sk-shine-rtl { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.sk-line { height: 11px; margin: 6px 0; }
.sk-title { height: 18px; width: 45%; margin-bottom: 10px; }
.sk-pill { height: 18px; width: 64px; border-radius: 20px; display: inline-block; }
.sk-kpi { height: 86px; border-radius: 12px; }
.sk-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 16px; align-items: center; padding: 13px 12px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: none; }
.sk-head { background: var(--sunken); padding: 11px 12px; }
.sk-busy { pointer-events: none; }

/* ---------- command palette (Ctrl+K) ---------- */
.tb-search { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--sunken); color: var(--dim); font-size: 12px; min-width: 200px; }
.tb-search:hover { border-color: var(--blue); color: var(--blue); }
.tb-search svg { width: 15px; height: 15px; }
.tb-search span { flex: 1; text-align: start; }
kbd { font-family: var(--sans); font-size: 10px; font-weight: 700; color: var(--muted); background: var(--panel); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; direction: ltr; unicode-bidi: isolate; }
.palette-overlay { padding-top: 12vh; }
.palette { width: 100%; max-width: 620px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease; align-self: flex-start; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; color: var(--blue); flex: 0 0 auto; }
.palette-input input { flex: 1; border: none; outline: none; font-family: var(--sans); font-size: 15px; color: var(--ink); background: none; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 10.5px; font-weight: 800; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none !important; }
.palette-item.on { background: var(--tint-blue); }
.pi-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.palette-item.on .pi-ic { background: var(--blue); color: #fff; }
.pi-ic svg { width: 15px; height: 15px; }
.pi-txt { display: flex; flex-direction: column; min-width: 0; }
.pi-txt .t { font-size: 13px; font-weight: 700; }
.pi-txt .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-empty, .palette-hint { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 10px; }
.palette-hint { font-size: 11.5px; color: var(--dim); padding: 10px; }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--subtle); font-size: 11px; color: var(--dim); }
.palette-foot kbd { margin-inline-end: 3px; }
@media (max-width: 860px) { .tb-search { min-width: 0; } .tb-search span, .tb-search kbd { display: none; } }

/* ---------- tabs (reference design) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 9px 14px; font-size: 12.5px; font-weight: 700; color: var(--muted); border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--blue); border-bottom-color: var(--blue); }
.tab .n { font-size: 10px; background: var(--line); color: var(--muted); border-radius: 8px; padding: 0 6px; font-weight: 800; }
.tab.on .n { background: var(--tint-blue); color: var(--blue); }
[data-tab-panel] { animation: pop .16s ease; }

/* ---------- contact form: required note, name group, changed-field tint + undo, account lookup ---------- */
.contact-form { max-width: none; }
.req-note { text-align: start; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.info-dot { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--muted); color: #fff; font-size: 10px; font-weight: 800; font-style: normal; margin-inline-start: 4px; vertical-align: 1px; cursor: help; }
.field.trackable { position: relative; border-radius: 8px; transition: background .15s; }
.field.trackable.changed, fieldset.name-group.changed { background: var(--tint-changed); box-shadow: 0 0 0 6px var(--tint-changed); }
fieldset.name-group.changed .field.changed { box-shadow: none; }
.field-undo { position: absolute; top: -2px; inset-inline-end: 0; width: 22px; height: 22px; border: none; background: none; color: var(--dim); padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.field-undo:hover { color: var(--blue); background: rgba(30,116,232,.08); }
.field-undo svg { width: 14px; height: 14px; }
.combo { position: relative; }
/* The posted id field: present for validation, invisible and unreachable for the user. */
.combo-value { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; inset-inline-start: 0; bottom: 0; border: 0; padding: 0; }
.combo:has(.combo-value.input-validation-error) .combo-input { border-color: var(--alert); }
.combo-ic { position: absolute; inset-inline-start: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; background: #5B6BDB; color: #fff; display: none; align-items: center; justify-content: center; pointer-events: none; }
.combo-ic svg { width: 13px; height: 13px; }
.combo.has-value .combo-ic { display: flex; }
.combo.has-value .combo-input { padding-inline-start: 38px; font-weight: 600; }
.combo-input { padding-inline-end: 34px; }
.combo-clear { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: none; background: none; color: var(--muted); font-size: 14px; border-radius: 6px; }
.combo-clear:hover { background: var(--bg); color: var(--ink); }
.combo-list { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 30; list-style: none; margin: 0; padding: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; }
.combo-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.combo-list li svg { width: 14px; height: 14px; color: #5B6BDB; flex: 0 0 auto; }
.combo-list li.on, .combo-list li[data-value]:hover { background: var(--tint-blue); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.contact-actions { justify-content: center; }
.contact-actions .save-btn { min-width: 220px; justify-content: center; }
.contact-card-name { display: flex; align-items: center; gap: 12px; }
.avatar-lg { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--ink2)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex: 0 0 auto; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: var(--tint-blue); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 11px; flex: 0 0 auto; }

/* ---------- sessions ---------- */
.session-list { display: grid; gap: 10px; }
.session-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.session-card.current { border-color: var(--tint-low-line); box-shadow: 0 0 0 3px rgba(26,157,90,.08), var(--shadow-sm); }
.session-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--tint-blue); color: var(--blue); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.session-card.current .session-ic { background: var(--tint-low); color: var(--green); }
.session-ic svg { width: 20px; height: 20px; }
.session-main { flex: 1; min-width: 0; }
.session-main .ttl { font-weight: 800; font-size: 13.5px; }
.session-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-inline-end: 5px; animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- audit log ---------- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 11.5px; }
table.tbl tr.row-alert td { background: var(--row-alert); }
table.tbl tr.row-alert:hover td { background: var(--row-alert-h); }
.diff-tbl td { vertical-align: top; word-break: break-word; }
.diff-tbl tr.chg td { background: var(--tint-diff); }
.diff-tbl tr.chg td.old { color: var(--t-crit2); text-decoration: line-through; text-decoration-color: rgba(165,53,44,.4); }
.diff-tbl tr.chg td.new { color: var(--t-new); font-weight: 700; }
.drawer-foot svg { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- client health card ---------- */
.health-ok { display: flex; gap: 8px; align-items: center; color: var(--green); font-size: 12.5px; font-weight: 600; }
.health-ok svg { width: 18px; height: 18px; flex: 0 0 auto; }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.health-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; font-weight: 600; padding: 8px 10px; border-radius: 8px; }
.health-list li svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; }
.health-list li.crit { background: var(--tint-crit); color: var(--t-crit2); }
.health-list li.mod { background: var(--tint-mod); color: var(--t-mod2); }

/* ---------- timeline (activity tab) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 15px; width: 2px; background: var(--line); }
.tl-day { position: relative; font-size: 11px; font-weight: 800; color: var(--dim); padding: 10px 0 6px 0; padding-inline-start: 44px; }
.tl-day:first-child { padding-top: 0; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 6px 0 12px; }
.tl-ic { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 3px solid var(--panel); }
.tl-ic svg { width: 14px; height: 14px; }
.tl-ic.blue { background: var(--tint-blue); color: var(--blue); }
.tl-ic.low { background: var(--tint-low); color: var(--green); }
.tl-ic.mod { background: var(--tint-mod); color: var(--t-mod); }
.tl-ic.crit { background: var(--tint-crit); color: var(--t-crit); }
.tl-ic.gray { background: var(--bg); color: var(--muted); }
.tl-ic.purple { background: var(--tint-purple); color: var(--purple); }
.drawer-head .tl-ic { border: none; flex: 0 0 auto; }
.drawer-head .tl-ic svg { width: 18px; height: 18px; }
.tl-body { padding-top: 4px; min-width: 0; }
.tl-sum { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.tl-meta { font-size: 11px; color: var(--dim); margin-top: 1px; }

/* ---------- stepper (multi-step form) ---------- */
.stepper { list-style: none; margin: 0; padding: 14px 16px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); background: var(--subtle); border-radius: var(--r) var(--r) 0 0; }
.step { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.step:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--line2); border-radius: 2px; min-width: 12px; }
.step.done:not(:last-child)::after { background: var(--blue); }
.step-btn { display: flex; align-items: center; gap: 9px; background: none; border: none; padding: 4px; border-radius: 9px; text-align: start; color: inherit; min-width: 0; }
.step-btn:not([disabled]):hover .t { color: var(--blue); }
.step-btn[disabled] { cursor: default; }
.step-no { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line2); background: var(--panel); color: var(--dim); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; transition: .15s; }
.step-no .ok { display: none; }
.step-no .ok svg { width: 15px; height: 15px; }
.step.on .step-no { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 4px rgba(30,116,232,.12); }
.step.done .step-no { background: var(--blue); border-color: var(--blue); color: #fff; }
.step.done .step-no .num { display: none; }
.step.done .step-no .ok { display: block; }
.step-txt { display: flex; flex-direction: column; min-width: 0; }
.step-txt .t { font-size: 12.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.step.on .step-txt .t, .step.done .step-txt .t { color: var(--ink); }
.step-txt .s { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.step-panel { animation: pop .18s ease; }
.step-h { font-size: 16px; font-weight: 800; margin-bottom: 2px; }
.step-lead { font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }
.stepper-actions { align-items: center; }
.stepper-actions .sp { flex: 1; }
.step-count { font-size: 11.5px; }
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.review-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.review-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: var(--sunken); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 800; color: var(--ink2); }
.review-card dl { margin: 0; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; font-size: 12.5px; }
.review-card dt { color: var(--muted); font-weight: 600; }
.review-card dd { margin: 0; font-weight: 700; word-break: break-word; }
.review-card dd.ltr { text-align: start; }
@media (max-width: 1100px) { .review-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
    .stepper { overflow-x: auto; }
    .step-txt .s { display: none; }
    .step:not(.on) .step-txt { display: none; }
}

/* ---------- help bubbles (click/focus any element with data-help) ---------- */
.help-bubble { position: fixed; z-index: 230; background: #0B2A4A; color: #E7F1FE; font-size: 12px; line-height: 1.7; padding: 9px 12px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: flex-start; animation: pop .14s ease; }
.help-bubble .ic { color: var(--sky); flex: 0 0 auto; margin-top: 3px; }
.help-bubble .ic svg { width: 14px; height: 14px; display: block; }
[data-help]:not(input):not(select):not(textarea) { cursor: help; }
.kpi[data-help] .t::after { content: "ⓘ"; margin-inline-start: 5px; color: var(--dim); font-size: 10.5px; }

/* ---------- drawer (slide-in side panel), from the reference design ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(11,42,74,.35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 140; }
.drawer-overlay.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(640px, 96vw); background: var(--panel); z-index: 145; box-shadow: -10px 0 40px rgba(11,42,74,.25); transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column; outline: none; }
[dir=rtl] .drawer { transform: translateX(-105%); box-shadow: 10px 0 40px rgba(11,42,74,.25); }
.drawer.on { transform: none !important; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .ttl { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 17px; font-weight: 800; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px; }
.drawer-foot { padding: 13px 20px; border-top: 1px solid var(--line); background: var(--subtle); display: flex; gap: 9px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.drawer-loading { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--blue); }
.drawer-loading .spin { width: 26px; height: 26px; border-width: 3px; }
table.tbl tr[data-drawer-url] { cursor: pointer; }
table.tbl tr[data-drawer-url].sel td { background: var(--tint-blue-2); }

/* ---------- notification bell ---------- */
.bell-count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--alert); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--panel); line-height: 1; }
.bell-count.info { background: var(--blue); }
.bell-pop { width: 340px; padding: 0; overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 13px; }
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--hover); }
.bell-ic { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.bell-ic svg { width: 15px; height: 15px; }
.bell-ic.crit { background: var(--tint-crit); color: var(--t-crit); }
.bell-ic.mod { background: var(--tint-mod); color: var(--t-mod); }
.bell-ic.info { background: var(--tint-blue); color: var(--blue); }
.bell-txt { display: flex; flex-direction: column; min-width: 0; }
.bell-txt .s { font-size: 12.5px; font-weight: 700; }
.bell-txt .m { font-size: 11.5px; color: var(--muted); }
.bell-empty { text-align: center; padding: 22px 16px; }
.bell-empty .empty-ic { width: 40px; height: 40px; border-radius: 12px; margin: 0 auto 8px; background: var(--tint-low); color: var(--green); }
.bell-empty .empty-ic svg { width: 19px; height: 19px; }
.bell-empty .ttl { font-weight: 800; font-size: 13px; }
.bell-empty .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 520px) { .bell-pop { width: calc(100vw - 24px); inset-inline-end: -90px; } }

/* ---------- charts (single-series bars, donut) ---------- */
.chart-card { display: flex; flex-direction: column; }
.chart-sub { font-size: 11.5px; color: var(--muted); margin: -4px 0 8px; }
.chart-plot svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--line2); stroke-width: 1; }
.chart-axis { fill: var(--dim); font-size: 10.5px; font-family: var(--sans); }
.chart-val { fill: var(--ink); font-size: 11px; font-weight: 700; font-family: var(--sans); }
.chart-bar .bar { fill: var(--chart-bar); transition: fill .15s; }
.chart-bar.hi .bar { fill: var(--blue); }
.chart-bar .hit { fill: transparent; }
.chart-bar:hover .bar, .chart-bar:focus .bar { fill: var(--blue-d); }
.chart-bar:focus { outline: none; }
.chart-view-toggle { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; padding: 2px 10px; }
.chart-view-toggle[aria-pressed=true] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chart-table { margin-top: 4px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; flex: 0 0 auto; }
.donut-slice { transition: stroke-width .15s; cursor: default; }
.donut-slice:hover, .donut-slice:focus { stroke-width: 26; outline: none; }
.donut-total { fill: var(--ink); font-size: 30px; font-weight: 800; font-family: var(--sans); }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: grid; gap: 9px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend .lbl { flex: 1; color: var(--ink); font-weight: 600; }
.legend .val { font-weight: 800; color: var(--ink); }
.legend .pct { color: var(--muted); width: 40px; text-align: end; }
.chart-tip { position: fixed; z-index: 220; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; pointer-events: none; box-shadow: var(--shadow-md); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }

/* ---------- status pages (404, 403, 500…) ---------- */
.status-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; gap: 22px; }
.status-brand { text-decoration: none !important; }
.status-card { position: relative; width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md); padding: 40px 28px 30px; text-align: center; overflow: hidden; }
.status-code { position: absolute; inset-inline: 0; top: -18px; font-size: 140px; font-weight: 800; line-height: 1; color: var(--status-code); letter-spacing: -4px; pointer-events: none; font-variant-numeric: tabular-nums; }
.status-card > *:not(.status-code) { position: relative; }
.status-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--tint-blue); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.status-ic svg { width: 30px; height: 30px; }
.status-card h1 { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.status-card p { color: var(--muted); font-size: 13px; line-height: 1.8; max-width: 400px; margin: 0 auto; }
.status-path { margin: 12px auto 0; display: inline-block; font-size: 11.5px; color: var(--dim); background: var(--bg); border-radius: 6px; padding: 3px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-foot { font-size: 11px; color: var(--dim); }

/* ---------- compact density (top-bar toggle) — more rows on screen for long lists ---------- */
.tb-ic[aria-pressed=true] { background: var(--tint-blue); border-color: var(--tint-blue-line); color: var(--blue); }
[data-density=compact] table.tbl { font-size: 12px; }
[data-density=compact] table.tbl th { padding: 6px 10px; }
[data-density=compact] table.tbl td { padding: 5px 10px; }
[data-density=compact] table.tbl .sub { font-size: 10.5px; }
[data-density=compact] .pill { padding: 2px 8px; font-size: 10px; }
[data-density=compact] .card.pad, [data-density=compact] .pad { padding: 12px; }
[data-density=compact] .kpi { padding: 10px 12px; }
[data-density=compact] .kpi .n { font-size: 22px; }
[data-density=compact] .main { padding: 14px 18px 22px; }
[data-density=compact] .grid4, [data-density=compact] .grid2, [data-density=compact] .grid3, [data-density=compact] .grid-main-side { gap: 10px; }
[data-density=compact] .navitem { padding: 6px 12px; }
[data-density=compact] .field { margin-bottom: 10px; }
[data-density=compact] .inp, [data-density=compact] .sel { min-height: 32px; padding: 5px 10px; }
[data-density=compact] .sk-row { padding: 8px 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .grid4 { grid-template-columns: repeat(2, 1fr); }
    .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app { margin: 0; border-radius: 0; border: none; }
    .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
    [dir=rtl] .side { transform: translateX(100%); }
    .side.on { transform: none !important; }
    .side-toggle { display: flex; }
    .mod-pill, .tb-ctx { display: none; }
    .main { padding: 16px; }
    .grid2, .grid3, .row2, .row3, .row4 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-main { padding: 22px; }
}
@media (max-width: 520px) {
    .grid4 { grid-template-columns: 1fr; }
}
/* dir="auto" resolves an EMPTY input to LTR, so the Arabic placeholder jumped to the left edge. */
[dir=rtl] input[dir=auto]:placeholder-shown, [dir=rtl] textarea[dir=auto]:placeholder-shown { direction: rtl; }

/* Roles screen: permission matrix (screens × actions). */
.perm-matrix th.c, .perm-matrix td.c { text-align: center; width: 110px; }
.perm-matrix td.c input { width: 17px; height: 17px; accent-color: var(--blue); }
.perm-matrix tbody tr:hover { background: var(--bg); }

/* =====================================================================================
   Dark theme. html[data-theme] comes from the user's choice (avatar menu); with no choice
   ("system") the OS preference decides. Only tokens change — components never test the theme.
   ===================================================================================== */
:root[data-theme="dark"] {
    --ink: #E6EDF7; --ink2: #B9CBEA; --blue: #4C93F0; --blue-d: #3B82E6; --muted: #9AABC4; --dim: #6F819E;
    --bg: #0E1726; --panel: #152033; --line: #24324A; --line2: #31415E;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35); --shadow-md: 0 6px 18px rgba(0,0,0,.45); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
    --sunken: #111B2B; --subtle: #172438; --hover: #1C2B43; --skeleton: #1E2B40; --shine: rgba(255,255,255,.06);
    --tint-blue: #17305A; --tint-blue-line: #24497F; --tint-blue-2: #1A3358; --tint-info: #152B4A; --tint-gray: #22304A;
    --tint-crit: #3A1D20; --tint-crit-line: #5C2A2A; --tint-crit-2: #2E1A1C; --tint-mod: #3A2C14; --tint-low: #133326; --tint-low-line: #22573C;
    --tint-purple: #2B1F3F; --tint-warn: #33290F; --tint-warn-line: #5A4A1C; --tint-changed: #3A3312; --tint-diff: #2F2A14;
    --row-alert: #2A1A1D; --row-alert-h: #331E21; --chart-bar: #3D6FB3; --status-code: #18253A;
    --t-crit: #FF8A80; --t-crit2: #FF9A90; --t-mod: #F5C26B; --t-mod2: #E9C46A; --t-low: #5FD39A; --t-blue: #7FB3FF;
    --t-purple: #C39BEA; --t-gray: #A9B6C9; --t-info: #8CBCFF; --t-new: #6EE0A8;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
    --ink: #E6EDF7; --ink2: #B9CBEA; --blue: #4C93F0; --blue-d: #3B82E6; --muted: #9AABC4; --dim: #6F819E;
    --bg: #0E1726; --panel: #152033; --line: #24324A; --line2: #31415E;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35); --shadow-md: 0 6px 18px rgba(0,0,0,.45); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
    --sunken: #111B2B; --subtle: #172438; --hover: #1C2B43; --skeleton: #1E2B40; --shine: rgba(255,255,255,.06);
    --tint-blue: #17305A; --tint-blue-line: #24497F; --tint-blue-2: #1A3358; --tint-info: #152B4A; --tint-gray: #22304A;
    --tint-crit: #3A1D20; --tint-crit-line: #5C2A2A; --tint-crit-2: #2E1A1C; --tint-mod: #3A2C14; --tint-low: #133326; --tint-low-line: #22573C;
    --tint-purple: #2B1F3F; --tint-warn: #33290F; --tint-warn-line: #5A4A1C; --tint-changed: #3A3312; --tint-diff: #2F2A14;
    --row-alert: #2A1A1D; --row-alert-h: #331E21; --chart-bar: #3D6FB3; --status-code: #18253A;
    --t-crit: #FF8A80; --t-crit2: #FF9A90; --t-mod: #F5C26B; --t-mod2: #E9C46A; --t-low: #5FD39A; --t-blue: #7FB3FF;
    --t-purple: #C39BEA; --t-gray: #A9B6C9; --t-info: #8CBCFF; --t-new: #6EE0A8;
    color-scheme: dark;
    }
}
/* Images and the brand gradient stay as they are; native inputs follow color-scheme. */

/* Pieces that sit on a fixed dark or brand background: give them fixed colours in dark mode
   instead of tokens that flip (e.g. --ink turns light, which would hide white text). */
:root[data-theme="dark"] { --chrome: #0A1424; --brand-grad: linear-gradient(135deg, #1E74E8, #0F3D7A); --btn-p: #2F7BE0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chrome: #0A1424; --brand-grad: linear-gradient(135deg, #1E74E8, #0F3D7A); --btn-p: #2F7BE0; } }
:root { --chrome: #0B2A4A; --brand-grad: linear-gradient(135deg, var(--blue), var(--ink2)); --btn-p: var(--blue); }
.hintbar, .help-bubble, .toast, .chart-tip { background: var(--chrome); }
.toast, .chart-tip { color: #fff; }
.brand-mark, .avatar, .avatar-lg { background: var(--brand-grad); }
.btn.p, .chip.on, .step.done .step-no, .palette-item.on .pi-ic, .chart-view-toggle[aria-pressed=true] { background: var(--btn-p); border-color: var(--btn-p); }
.info-dot { color: var(--panel); }

/* Avatar menu: appearance picker (segmented). */
.theme-pick { padding: 6px 4px 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.menu-lbl { font-size: 10.5px; font-weight: 700; color: var(--dim); padding: 0 6px 6px; }
.seg { display: flex; gap: 3px; background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: none; border-radius: 6px; padding: 5px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.seg button svg { width: 13px; height: 13px; }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--blue); box-shadow: var(--shadow-sm); }

/* «حسابي» */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.profile-grid > .card { display: flex; flex-direction: column; }
.profile-sessions { display: flex; align-items: center; gap: 12px; }
.seg-lg { max-width: 360px; }
.seg-lg button { padding: 7px 8px; font-size: 12.5px; }
.menu-head a.nm { color: var(--ink); }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* =====================================================================================
   Phones and tablets. Tables become one card per row on phones (labels come from the
   header — portal.js copies them into data-label), scroll strips replace wrapping rows of
   tabs/chips, and the top bar keeps only what fits (language lives in «حسابي»).
   ===================================================================================== */
.side-backdrop { display: none; }
@media (max-width: 860px) {
    .side-backdrop { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(11,42,74,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
    .side.on ~ .side-backdrop, body.side-open .side-backdrop { opacity: 1; pointer-events: auto; }
    body.side-open { overflow: hidden; }
    .side { width: min(290px, 84vw); flex-basis: auto; }
    .tabs, .chip-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .tabs::-webkit-scrollbar, .chip-filters::-webkit-scrollbar { display: none; }
    .tab, .chip { flex: 0 0 auto; }
    .page-head { flex-wrap: wrap; }
}
@media (max-width: 640px) {
    .topbar { padding: 8px 10px; }
    .tb-left, .tb-right { gap: 8px; }
    .topbar form:has(.lang-sel), [data-density-toggle] { display: none; }
    .brand { font-size: 15px; }
    .hintbar { font-size: 11px; padding: 6px 12px; }
    .main { padding: 14px 12px 22px; }
    .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 11px 12px; }
    .kpi .n { font-size: 22px; }
    .card .pad, .pad { padding: 14px; }
    fieldset { padding: 10px 11px 2px; }
    .form-actions { flex-wrap: wrap; }
    .form-actions .btn { flex: 1 1 auto; justify-content: center; }
    .toolbar { flex-wrap: wrap; }
    .toolbar .search { min-width: 0; flex: 1 1 100%; }
    .modal, .palette { max-width: none; }
    .overlay { padding: 16px 10px; }

    /* Table → cards */
    table.tbl-cards thead { display: none; }
    table.tbl-cards, table.tbl-cards tbody, table.tbl-cards tr { display: block; width: 100%; }
    table.tbl-cards tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
    table.tbl-cards tr:last-child { border-bottom: 0; }
    table.tbl-cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: end; white-space: normal; min-height: 26px; }
    table.tbl-cards td::before { content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--muted); text-align: start; flex: 0 0 auto; max-width: 45%; }
    table.tbl-cards td:not([data-label])::before, table.tbl-cards td[data-label=""]::before { display: none; }
    /* the first column (the name) is the card's title */
    table.tbl-cards td:first-child { justify-content: flex-start; text-align: start; padding-bottom: 8px; font-size: 13.5px; }
    table.tbl-cards td:first-child::before { display: none; }
    table.tbl-cards tbody tr:hover td { background: none; }
    table.tbl-cards td.c { justify-content: space-between; text-align: end; width: auto; }
    table.tbl-cards td:empty, table.tbl-cards td.na { display: none; }
    .tbl-wrap { overflow-x: visible; }
}

/* Client dashboard: "needs your attention" list and top AI users. */
.attn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attn-list li { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; background: var(--tint-info); color: var(--t-info); }
.attn-list li.mod { background: var(--tint-mod); color: var(--t-mod); }
.attn-list li.crit { background: var(--tint-crit); color: var(--t-crit2); }
.attn-list .attn-ic svg { width: 16px; height: 16px; display: block; }
.attn-list .btn { padding: 5px 10px; font-size: 11.5px; flex: 0 0 auto; }
.attn-ok { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 9px; background: var(--tint-low); color: var(--t-low); font-size: 12.5px; font-weight: 600; }
.attn-ok svg { width: 18px; height: 18px; }
.top-users { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.top-users .ttl { font-size: 12.5px; font-weight: 700; }
.top-users .mono { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .attn-list li { flex-wrap: wrap; } .attn-list .btn { margin-inline-start: auto; } }
.top-users + .hint { font-size: 11px; color: var(--dim); line-height: 1.6; }

/* Confirmation dialog: title, concrete impact, undo note, optional type-to-confirm. */
.confirm-modal .modal-head { gap: 10px; }
.confirm-modal .modal-head h3 { flex: 1; }
.confirm-ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--tint-crit); color: var(--t-crit); }
.confirm-ic svg { width: 17px; height: 17px; }
.confirm-modal[data-tone=warn] .confirm-ic { background: var(--tint-mod); color: var(--t-mod); }
.confirm-modal[data-tone=neutral] .confirm-ic { background: var(--tint-blue); color: var(--blue); }
.confirm-msg { font-size: 13px; line-height: 1.8; margin: 0 0 10px; }
.confirm-impact { background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; margin-bottom: 10px; }
.confirm-lbl { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.confirm-impact ul { margin: 0; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.9; }
.confirm-undo { font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 8px; background: var(--tint-low); color: var(--t-low); margin-bottom: 10px; }
.confirm-undo.permanent { background: var(--tint-crit); color: var(--t-crit2); }
.confirm-type { display: block; font-size: 12px; font-weight: 600; }
.confirm-type span { display: block; margin-bottom: 6px; }
.btn.a { background: var(--amber); border-color: var(--amber); color: #3a2600; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* First-sign-in tour: a cut-out spotlight (huge box-shadow) over the target + a bubble. */
.tour-shade { position: fixed; inset: 0; z-index: 300; background: rgba(11,42,74,.55); display: none; }
.tour-spot { position: fixed; z-index: 300; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(11,42,74,.55), 0 0 0 3px var(--blue); pointer-events: none; transition: all .25s ease; }
.tour-tip { position: fixed; z-index: 301; width: min(340px, calc(100vw - 24px)); background: var(--panel); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px 16px 12px; transition: top .25s ease, left .25s ease; }
.tour-tip.center { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); text-align: center; }
.tour-tip.center .tour-foot { justify-content: center; }
.tour-count { font-size: 11px; font-weight: 700; color: var(--blue); margin-bottom: 4px; }
.tour-tip h3 { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.tour-tip p { font-size: 12.5px; line-height: 1.8; color: var(--muted); margin-bottom: 12px; }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-foot .sp { flex: 1; }
.tour-skip { border: 0; background: none; color: var(--dim); font-size: 12px; font-weight: 700; padding: 6px 2px; }
.tour-skip:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-tip { transition: none; } }

/* "Your last filter was restored · clear" note above a list's filter bar. */
.filters-restored { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--t-info); background: var(--tint-info); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }
.filters-restored a { font-weight: 700; }

/* Bulk selection: checkbox column + floating selection bar. */
.bulk-col { width: 36px; text-align: center; }
.bulk-col input { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; vertical-align: middle; }
table.tbl tr.picked td { background: var(--tint-blue); }
.bulk-bar { position: fixed; inset-inline: 0; bottom: 18px; margin-inline: auto; z-index: 120; width: min(760px, calc(100vw - 24px));
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-radius: 12px;
    background: var(--panel); border: 1px solid var(--line2); box-shadow: var(--shadow-lg); animation: pop .15s ease; }
.bulk-bar .sp { flex: 1; }
.bulk-count { font-size: 12.5px; font-weight: 700; }
.bulk-count b { color: var(--blue); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
@media (max-width: 640px) {
    .bulk-bar { bottom: 10px; }
    .bulk-bar .btn { flex: 1 1 auto; justify-content: center; }
    .bulk-bar .sp { display: none; }
    /* card mode: the checkbox sits in the card's corner; the next cell is the title */
    table.tbl-cards tr { position: relative; }
    table.tbl-cards td.bulk-col { position: absolute; top: 12px; inset-inline-end: 14px; width: auto; min-height: 0; padding: 0; }
    table.tbl-cards td.bulk-col::before { display: none; }
    table.tbl-cards td.bulk-col + td { justify-content: flex-start; text-align: start; padding-bottom: 8px; padding-inline-end: 30px; font-size: 13.5px; }
    table.tbl-cards td.bulk-col + td::before { display: none; }
}

/* Usage sparkline in client lists (single series: de-emphasis hue, current month in the accent). */
.spark { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.spark svg { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--chart-bar); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-now { fill: var(--blue); stroke: var(--panel); stroke-width: 2; pointer-events: none; }
.spark-hit { fill: transparent; cursor: default; }
.spark g:hover .spark-hit, .spark g:focus .spark-hit { fill: var(--tint-blue); }
.spark-val { font-size: 12px; font-weight: 700; color: var(--ink); }
.spark-delta { font-size: 11px; color: var(--muted); }
.spark-none { font-size: 11.5px; }

/* Client page: highlights strip (CRM-style key facts under the title). */
.highlights { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.highlights .k { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.highlights .v { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; min-height: 24px; }
.highlights .avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }
@media (max-width: 860px) { .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Per-row Edit / Delete buttons at the end of a list row. */
td.row-actions { white-space: nowrap; }
td.row-actions > * { display: inline-flex; vertical-align: middle; }
td.row-actions form { margin: 0; }
td.row-actions .btn + form, td.row-actions .btn + .btn { margin-inline-start: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { table.tbl-cards td.row-actions { justify-content: flex-end; gap: 6px; padding-top: 8px; } }

/* Icon-only row buttons (label in aria-label + tooltip). */
.btn.icon { padding: 5px 7px; gap: 0; }
.btn.icon svg { width: 15px; height: 15px; }
td.row-actions { width: 1%; }

/* Usage screen: monthly bars + per-user bars (no chart library; tokens follow dark mode) */
.ubars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 8px; }
.ubar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; text-decoration: none; color: inherit; min-width: 0; border-radius: 8px; padding: 2px 0; }
.ubar:hover, .ubar:focus-visible { background: var(--hover); outline: none; }
.ubar .v { font-size: 11px; color: var(--muted); height: 16px; }
.ubar .col { flex: 1; width: 100%; max-width: 46px; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line2); }
.ubar .col i { display: block; width: 100%; background: var(--chart-bar); border-radius: 4px 4px 0 0; min-height: 0; transition: height .3s; }
.ubar.on .col i { background: var(--blue); }
.ubar.on .v { color: var(--ink); font-weight: 700; }
.ubar .m { font-size: 11px; color: var(--muted); margin-top: 6px; }
.ubar.on .m { color: var(--ink); font-weight: 700; }
.hbars { display: flex; flex-direction: column; gap: 9px; padding-top: 6px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.hbar .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.hbar .v { color: var(--muted); min-width: 44px; text-align: end; }
@media print { .ubar .col i, .hbar .track i { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* Bell: read / unread */
.bell-row { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.bell-row .bell-item { flex: 1; min-width: 0; }
.bell-row.read { opacity: .55; }
.bell-row.read .bell-ic { filter: grayscale(1); }
.bell-mark { flex: none; width: 28px; height: 28px; border: 0; background: transparent; color: var(--dim); border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-inline-end: 4px; }
.bell-mark:hover, .bell-mark:focus-visible { background: var(--hover); color: var(--blue); outline: none; }
.bell-mark svg { width: 15px; height: 15px; }
.bell-head .sp { flex: 1; }
.bell-readall { border: 0; background: transparent; color: var(--blue); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.bell-readall:hover { background: var(--hover); }

/* Plans side by side */
.plan-compare th.pc-head { text-align: center; vertical-align: bottom; min-width: 150px; }
.plan-compare th.pc-label { font-weight: 700; color: var(--muted); text-align: start; background: var(--subtle); }
.plan-compare td { text-align: center; }
.plan-compare tr.pc-diff td, .plan-compare tr.pc-diff th.pc-label { background: var(--tint-blue-2); }
.plan-compare td.pc-best { font-weight: 800; color: var(--t-blue); }
.pc-star { font-size: 10px; margin-inline-start: 4px; color: var(--blue); }
@media print { .plan-compare tr.pc-diff td, .plan-compare tr.pc-diff th.pc-label { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }

/* ---- Plan pricing cards (Plans/Cards) ---- */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: stretch; padding-top: 12px; }
.price-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 20px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.price-card.hot { border: 2px solid var(--blue); }
.price-tag { position: absolute; top: -11px; inset-inline-start: 18px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.price-name { font-size: 18px; font-weight: 800; }
.price-code { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.price-amount { margin: 16px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.price-amount .n { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.price-amount .u { font-size: 12.5px; color: var(--muted); }
.price-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 9px; font-size: 13px; flex: 1; align-content: start; }
.price-list li { display: flex; align-items: center; gap: 8px; }
.price-list li svg { width: 16px; height: 16px; color: var(--blue); flex: none; }
@media print { .price-card { break-inside: avoid; box-shadow: none; } .price-foot .btn { display: none; } }

/* ---- Email signature editor (CKEditor 5 decoupled), Email Settings ---- */
.sig-editor { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.sig-toolbar .ck.ck-toolbar { border: 0; border-bottom: 1px solid var(--line); background: var(--bg, #F4F6FA); }
.sig-body { min-height: 110px; padding: 8px 14px; font-size: 13.5px; }
.sig-body.ck-focused { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }
.sig-body p { margin: 0 0 4px; }
fieldset:disabled .sig-body { background: var(--bg, #F4F6FA); color: var(--muted); }
