/* SAFE SMART ALM – enterprise UI. No external dependencies (works fully offline on-premises). */
:root {
  --brand: #0b3d91; --brand-2: #1557c0; --brand-soft: #e8eef9; --accent: #0f9d8a; --accent-soft: #e3f5f2;
  --ok: #138a4b; --ok-soft: #e4f5ea; --warn: #c27a00; --warn-soft: #fff4dd; --bad: #c62828; --bad-soft: #fde7e7; --info: #1f6fd1;
  --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f8fafc; --line: #e2e7ef; --line-2: #eef1f6; --text: #1b2433; --muted: #5d6b82; --faint: #93a0b5;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08); --shadow-lg: 0 10px 30px rgba(16,24,40,.14);
  --radius: 10px; --sidebar: 248px; --header: 58px;
  --c1: #1557c0; --c2: #0f9d8a; --c3: #e07b00; --c4: #8e44ad; --c5: #d64545; --c6: #2a9df4; --c7: #7f8c8d; --c8: #c0a000;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Arabic", Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0f1522; --panel: #161e2e; --panel-2: #1b2537; --line: #2a3650; --line-2: #222d42; --text: #e6ebf4; --muted: #9fb0c9; --faint: #6c7d98;
  --brand-soft: #1c2b4a; --accent-soft: #123a37; --ok-soft: #12321f; --warn-soft: #3a2c0b; --bad-soft: #3d1515; --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; } .col { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(135deg, #0b3d91 0%, #1557c0 55%, #0f9d8a 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero h1 { font-size: 34px; margin: 18px 0 10px; } .login-hero p { opacity: .9; max-width: 520px; line-height: 1.6; }
.login-hero .feat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin-top: 26px; font-size: 13px; opacity: .95; }
.login-hero .feat div::before { content: "✓ "; color: #9ff0e3; font-weight: 700; }
.login-hero svg.bg { position: absolute; right: -80px; bottom: -60px; opacity: .12; width: 520px; }
.login-card { display: flex; align-items: center; justify-content: center; padding: 30px; }
.login-box { width: 100%; max-width: 430px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px; }
.login-box h2 { margin-bottom: 4px; } .login-box .field { margin-top: 14px; }
.demo-list { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; max-height: 260px; overflow: auto; }
.demo-list button { display: flex; width: 100%; justify-content: space-between; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 7px 10px; margin-top: 6px; cursor: pointer; font-size: 12.5px; }
.demo-list button:hover { border-color: var(--brand-2); background: var(--brand-soft); }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--header) 1fr; min-height: 100vh; }
.app.collapsed { --sidebar: 64px; }
header.top { grid-column: 1 / -1; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
header.top .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: .2px; min-width: calc(var(--sidebar) - 32px); cursor: pointer; }
header.top .logo .mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,#fff,#9ff0e3); color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
header.top select, header.top .hbtn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
header.top select option { color: #000; }
header.top .hbtn { display: inline-flex; align-items: center; gap: 6px; position: relative; }
header.top .hbtn:hover { background: rgba(255,255,255,.2); }
header.top .badge-dot { position: absolute; top: -6px; right: -6px; background: #ff5252; color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 5px; font-weight: 700; }
header.top .search { flex: 1; max-width: 420px; position: relative; }
header.top .search input { width: 100%; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #fff; border-radius: 8px; padding: 7px 12px; }
header.top .search input::placeholder { color: rgba(255,255,255,.7); }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); color: var(--text); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 380px; overflow: auto; z-index: 50; }
.search-results a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line-2); color: var(--text); }
.search-results a:hover { background: var(--brand-soft); text-decoration: none; }
.asof-chip { background: rgba(255,255,255,.15); border-radius: 20px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
nav.side { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; position: sticky; top: var(--header); height: calc(100vh - var(--header)); padding: 10px 8px 30px; }
nav.side .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); padding: 14px 12px 6px; white-space: nowrap; overflow: hidden; }
nav.side a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--text); white-space: nowrap; overflow: hidden; font-size: 13.5px; }
nav.side a:hover { background: var(--panel-2); text-decoration: none; }
nav.side a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
nav.side a svg { width: 18px; height: 18px; flex: none; }
.app.collapsed nav.side .grp, .app.collapsed nav.side a span { display: none; }
main { padding: 20px 24px 50px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .icon-badge { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.page-head .icon-badge svg { width: 22px; height: 22px; }
.crumbs { font-size: 12px; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card > .card-h { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; }
.card > .card-h h3 { flex: 1; }
.card.flush { padding: 0; } .card.flush > .card-h { padding: 14px 16px 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 13px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; } .btn.primary:hover { background: var(--brand); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); } .btn.danger:hover { border-color: var(--bad); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
input.inp, select.inp, textarea.inp { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 10px; width: 100%; }
input.inp:focus, select.inp:focus, textarea.inp:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-2); }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok, .pill.done, .pill.approved, .pill.submitted, .pill.sent { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn, .pill.warning, .pill.pending, .pill.active, .pill.under-review, .pill.inprogress, .pill.simulated, .pill.draft, .pill.monitoring { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad, .pill.breach, .pill.alert, .pill.rejected, .pill.failed, .pill.overdue, .pill.critical { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: none; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--brand-2); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .k-value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.kpi .k-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.kpi.warning::before { background: var(--warn); } .kpi.breach::before { background: var(--bad); } .kpi.neutral::before { background: var(--brand-2); }
.delta-up { color: var(--ok); } .delta-down { color: var(--bad); }
.table-wrap { overflow: auto; max-width: 100%; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.8px; }
table.tbl th { text-align: left; background: var(--panel-2); color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; cursor: default; font-size: 12px; }
table.tbl th.sortable { cursor: pointer; } table.tbl th.sortable:hover { color: var(--brand); }
table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.tbl tr:hover td { background: var(--panel-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl tr.total td { font-weight: 700; background: var(--brand-soft); }
table.tbl tr.subtotal td { font-weight: 600; background: var(--panel-2); }
table.tbl tr.ratio td { color: var(--muted); font-style: italic; }
table.tbl tr.flag td, table.tbl tr.breach td { background: var(--bad-soft); }
table.tbl tr.warning td { background: var(--warn-soft); }
table.tbl tr.muted td { color: var(--faint); }
table.tbl tr.section td { background: var(--brand); color: #fff; font-weight: 600; }
table.tbl td.neg { color: var(--bad); }
table.tbl tr.clickable { cursor: pointer; }
.tbl-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tbl-tools input { max-width: 260px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 8px; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--faint); padding: 26px; }
.toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1b2433; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 420px; font-size: 13px; animation: fadein .2s; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.warn { background: var(--warn); }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow: auto; }
.modal { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; }
.modal.wide { max-width: 1100px; }
.modal .m-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; } .modal .m-h h3 { flex: 1; }
.modal .m-b { padding: 18px; max-height: 70vh; overflow: auto; }
.modal .m-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.note { background: var(--brand-soft); border-left: 3px solid var(--brand-2); padding: 9px 12px; border-radius: 6px; font-size: 12.5px; color: var(--text); }
.note.warn { background: var(--warn-soft); border-color: var(--warn); } .note.bad { background: var(--bad-soft); border-color: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; } .kv div:nth-child(odd) { color: var(--muted); }
.list-item { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: center; }
.list-item:last-child { border-bottom: none; }
.bar-mini { height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar-mini > i { display: block; height: 100%; background: var(--ok); }
.bar-mini.warning > i { background: var(--warn); } .bar-mini.breach > i { background: var(--bad); }
code, pre { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }
pre { background: var(--panel-2); border: 1px solid var(--line); padding: 10px; border-radius: 8px; overflow: auto; white-space: pre-wrap; }

/* ---------- Landing ---------- */
.hero { background: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 60%, var(--accent) 100%); color: #fff; border-radius: 14px; padding: 22px 26px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); }
.hero h1 { font-size: 24px; } .hero p { margin: 4px 0 0; opacity: .9; }
.hero .stats { margin-left: auto; display: flex; gap: 26px; flex-wrap: wrap; }
.hero .stats div b { display: block; font-size: 22px; } .hero .stats div span { font-size: 12px; opacity: .85; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; color: var(--text); position: relative; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-2); text-decoration: none; }
.tile .t-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.tile .t-icon svg { width: 23px; height: 23px; }
.tile .t-name { font-weight: 600; font-size: 14.5px; } .tile .t-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.tile .t-count { position: absolute; top: 14px; right: 14px; }
.flow { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 6px 2px 10px; }
.flow .step { flex: 1; min-width: 132px; display: flex; align-items: center; }
.flow .node { flex: 1; background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 10px 9px; cursor: pointer; text-align: center; transition: .12s; min-height: 104px; display: flex; flex-direction: column; justify-content: center; gap: 3px; color: var(--text); }
.flow .node:hover { border-color: var(--brand-2); text-decoration: none; transform: translateY(-1px); }
.flow .node .n-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 3px; font-weight: 700; font-size: 12px; color: #fff; background: var(--faint); }
.flow .node .n-name { font-weight: 600; font-size: 12.5px; line-height: 1.25; } .flow .node .n-detail { font-size: 11px; color: var(--muted); line-height: 1.3; }
.flow .node.done { border-color: var(--ok); background: var(--ok-soft); } .flow .node.done .n-num { background: var(--ok); }
.flow .node.active { border-color: var(--warn); background: var(--warn-soft); } .flow .node.active .n-num { background: var(--warn); }
.flow .node.alert { border-color: var(--bad); background: var(--bad-soft); } .flow .node.alert .n-num { background: var(--bad); }
.flow .arrow { width: 22px; flex: none; color: var(--faint); display: grid; place-items: center; font-size: 18px; }
.legend-row { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 10.5px; }
.chart .axis line, .chart .gridline { stroke: var(--line); }
.chart .legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--muted); margin-top: 6px; justify-content: center; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-tip { position: fixed; pointer-events: none; background: #1b2433; color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 11.5px; z-index: 200; white-space: nowrap; box-shadow: var(--shadow-lg); }

/* ---------- Builders ---------- */
.builder { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } }
.field-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.field-list label { display: flex; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 12.5px; align-items: center; }
.field-list label:hover { background: var(--panel-2); }
.field-list .ftype { margin-left: auto; font-size: 10px; color: var(--faint); text-transform: uppercase; }
.filter-row { display: grid; grid-template-columns: 1fr 90px 1fr 28px; gap: 6px; margin-top: 6px; }
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.dash-grid .widget { min-height: 120px; }
.dash-grid .widget.w2 { grid-column: span 2; } .dash-grid .widget.w3 { grid-column: span 3; } .dash-grid .widget.w4 { grid-column: 1 / -1; }
.dash-grid.editing .widget { outline: 2px dashed var(--brand-2); cursor: move; }
.dash-grid .widget.drag-over { outline: 2px solid var(--accent); }
.widget-tools { display: none; gap: 4px; } .dash-grid.editing .widget-tools { display: flex; }
.palette { display: flex; gap: 8px; flex-wrap: wrap; }
.wf-steps { display: flex; gap: 0; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.wf-step { border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--panel-2); min-width: 150px; }
.wf-step.cur { border-color: var(--warn); background: var(--warn-soft); } .wf-step.done { border-color: var(--ok); background: var(--ok-soft); }
.wf-step b { display: block; font-size: 12.5px; } .wf-step span { font-size: 11px; color: var(--muted); }
.wf-arrow { padding: 0 8px; color: var(--faint); font-size: 18px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; }
.timeline .ev { position: relative; padding-bottom: 12px; font-size: 12.5px; }
.timeline .ev::before { content: ""; position: absolute; left: -20px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-2); }

/* ---------- Report viewer / print ---------- */
.report-doc .r-head { border-bottom: 2px solid var(--brand); padding-bottom: 10px; margin-bottom: 14px; }
.report-doc .r-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.report-doc .r-kpis .pill { font-size: 12px; padding: 5px 11px; }
.report-doc h4.sec { margin: 18px 0 8px; color: var(--brand); }
[dir="rtl"] .page-head .actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] table.tbl th { text-align: right; } [dir="rtl"] table.tbl td.num { text-align: left; }
[dir="rtl"] nav.side { border-right: none; border-left: 1px solid var(--line); }
@media print {
  header.top, nav.side, .page-head .actions, .tabs, .no-print, .toast-host { display: none !important; }
  .app { display: block; } main { padding: 0; } .card { box-shadow: none; border: none; padding: 0; }
  body { background: #fff; font-size: 11px; } table.tbl th { position: static; }
}

/* =====================================================================
   SAFE ALMetrix brand theme – SAFE Software and Integrated Solutions Pvt. Ltd
   Palette from the corporate logo: SAFE red, SOFTWARE blue, ink black.
   ===================================================================== */
:root {
  --safe-red: #d0101e; --safe-red-soft: #fdeaeb; --safe-blue: #2f6fd6; --ink: #111827;
  --brand: #0f2a5c; --brand-2: #2f6fd6; --brand-soft: #eaf1fd; --accent: #d0101e; --accent-soft: #fdeaeb;
  --bg: #f4f6fa; --line: #e3e8f0; --radius: 12px;
  --c1: #2f6fd6; --c2: #0f9d8a; --c3: #e8890c; --c4: #7c4dff; --c5: #d0101e; --c6: #00a3c4; --c7: #64748b; --c8: #b38f00;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 2px 8px rgba(15,23,42,.05);
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Arabic", Arial, sans-serif;
}
[data-theme="dark"] { --brand: #8fb4f5; --brand-soft: #1a2b4d; --safe-red-soft: #3d1518; }
.safe-mark { color: var(--safe-red) !important; font-weight: 800 !important; letter-spacing: .2px; }

/* header */
header.top { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15,23,42,.03), 0 4px 14px rgba(15,23,42,.05); }
header.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: linear-gradient(90deg, var(--safe-red) 0 18%, var(--safe-blue) 18% 100%); }
[data-theme="dark"] header.top { background: var(--panel); color: var(--text); }
header.top .logo { gap: 12px; }
header.top .logo img.mark-img { height: 36px; width: auto; }
header.top .logo .brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.2px; line-height: 1; }
header.top .logo .brand-name .prod { color: var(--safe-blue); }
header.top .logo .brand-sub { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: .6px; text-transform: uppercase; margin-top: 3px; }
header.top select, header.top .hbtn { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
header.top .hbtn:hover { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-2); }
header.top a.hbtn { color: var(--text) !important; }
header.top .search input { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; }
header.top .search input::placeholder { color: var(--faint); }
header.top .search input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand-2); background: var(--panel); }
.asof-chip { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* sidebar */
nav.side { background: var(--panel); padding-top: 14px; }
nav.side a { border-radius: 10px; color: #334155; font-weight: 500; position: relative; }
[data-theme="dark"] nav.side a { color: var(--text); }
nav.side a svg { color: #64748b; }
nav.side a.active { background: var(--brand-soft); color: var(--brand-2); }
nav.side a.active svg { color: var(--brand-2); }
nav.side a.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--safe-red); }
nav.side .grp { color: #94a3b8; font-weight: 700; }
.side-foot { padding: 18px 12px 6px; border-top: 1px solid var(--line); margin-top: 16px; }
.side-foot img { width: 100%; max-width: 190px; opacity: .95; }
.side-foot div { font-size: 10.5px; color: var(--faint); margin-top: 6px; line-height: 1.4; }
.app.collapsed .side-foot { display: none; }

/* components */
.card, .kpi, .tile { border-radius: var(--radius); }
.btn { border-radius: 9px; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); box-shadow: 0 1px 2px rgba(47,111,214,.25); }
.btn.primary:hover { background: #2358b3; border-color: #2358b3; }
.page-head h1 { font-size: 23px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
[data-theme="dark"] .page-head h1 { color: var(--text); }
.page-head .icon-badge { background: linear-gradient(135deg, var(--brand-soft), #fff); border: 1px solid var(--line); color: var(--brand-2); }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.kpi .k-value { color: var(--ink); } [data-theme="dark"] .kpi .k-value { color: var(--text); }
table.tbl tr.section td { background: #1e3a6e; }
table.tbl tr.total td { background: var(--brand-soft); }

/* landing hero */
.hero { background: radial-gradient(1200px 300px at 100% 0%, rgba(208,16,30,.35), transparent 60%), linear-gradient(120deg, #0b1f45 0%, #16397a 55%, #2f6fd6 100%); border-radius: 16px; padding: 26px 30px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--safe-red); }
.hero .safe-mark { color: #ff5a64 !important; }
.tile { border-top: 3px solid transparent; }
.tile:hover { border-top-color: var(--safe-red); }

/* login */
.login-hero { background: radial-gradient(900px 420px at 110% 110%, rgba(208,16,30,.45), transparent 60%), radial-gradient(700px 400px at -10% -10%, rgba(47,111,214,.55), transparent 60%), linear-gradient(150deg, #071431 0%, #0f2a5c 55%, #163a7a 100%); }
.login-hero .safe-mark { color: #ff4d58 !important; }
.login-logo-card { background: #fff; border-radius: 14px; padding: 14px 18px; display: inline-block; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-logo-card img { height: 54px; display: block; }
.login-hero .prod-title { font-size: 44px; font-weight: 800; letter-spacing: -1px; margin: 30px 0 4px; line-height: 1.05; }
.login-hero .prod-title .prod { color: #8fb8ff; }
.login-hero .prod-tag { font-size: 18px; font-weight: 500; opacity: .92; margin-bottom: 14px; }
.login-hero .feat div::before { color: #ff6b74; }
.login-box { border-radius: 18px; border: 1px solid var(--line); }
.login-box .brand-line { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-box .brand-line img { height: 40px; }
.login-box .brand-line b { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.login-box .brand-line .prod { color: var(--safe-blue); }
.login-foot { font-size: 11.5px; color: var(--faint); text-align: center; margin-top: 16px; }
.powered { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .85; }
.powered img { height: 26px; background: #fff; border-radius: 6px; padding: 3px 6px; }
header.top .hbtn svg { width: 18px; height: 18px; flex: none; }
header.top #h-user { padding: 5px 10px; font-weight: 600; }
header.top #h-user svg { width: 18px; height: 18px; }
header.top #h-user span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow .step { min-width: 104px; }
.flow .arrow { width: 16px; font-size: 14px; }
.flow .node { padding: 9px 6px 8px; min-height: 98px; }
.flow .node .n-name { font-size: 12px; }
