:root {
  --primary: #6d28d9; --primary-ink: #fff; --primary-soft: color-mix(in srgb, var(--primary) 10%, transparent);
  --sidebar: #141226; --sidebar-ink: #c9c5e0; --sidebar-active: color-mix(in srgb, var(--primary) 70%, #fff 0%);
  --bg: #f5f4f9; --panel: #ffffff; --panel-2: #faf9fd; --ink: #1b1830; --ink-2: #5b5772; --ink-3: #8e8aa6;
  --line: #e6e3ef; --line-2: #f0eef6; --ok: #0f9d6b; --warn: #d97706; --bad: #dc2626; --info: #2563eb;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 18, 38, .05), 0 4px 16px rgba(20, 18, 38, .05);
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --row: 42px;
}
:root[data-theme="dark"] {
  --bg: #0f0e18; --panel: #18162a; --panel-2: #1d1b31; --ink: #ecebf5; --ink-2: #b2aec9; --ink-3: #807c99;
  --line: #2b2843; --line-2: #232038; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
:root[data-density="compact"] { --row: 34px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 14px; }
.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)); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; }
#sidebar { background: var(--sidebar); color: var(--sidebar-ink); overflow-y: auto; display: flex; flex-direction: column; }
#sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: #fff; font-weight: 700; font-size: 15px; }
#sidebar .brand img { height: 30px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
#sidebar .brand .logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; font-weight: 800; }
#sidebar .brand small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-ink); opacity: .7; }
.nav-group { padding: 6px 8px; }
.nav-group > .ng-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px 4px; color: var(--sidebar-ink); opacity: .55; cursor: pointer; user-select: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--sidebar-ink); border-radius: 7px; font-size: 13.5px; text-decoration: none; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: color-mix(in srgb, var(--primary) 85%, #000 0%); color: #fff; }
.nav a svg { width: 16px; height: 16px; opacity: .85; flex: none; }
.nav .badge { margin-left: auto; font-size: 11px; background: rgba(255, 255, 255, .12); padding: 0 6px; border-radius: 9px; }
#main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
#topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
#topbar .search { flex: 1; max-width: 520px; position: relative; }
#topbar .search input { width: 100%; padding-left: 34px; background: var(--panel-2); }
#topbar .search svg { position: absolute; left: 10px; top: 9px; width: 16px; color: var(--ink-3); }
#view { flex: 1; overflow: auto; padding: 22px 26px 60px; }
#menuBtn { display: none; }
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open #sidebar { transform: none; }
  #menuBtn { display: inline-flex; }
  #view { padding: 16px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; display: flex; align-items: center; gap: 10px; }
.crumb { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 36px; width: 100%; outline: none; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { width: 16px; min-height: 16px; height: 16px; accent-color: var(--primary); }
input[type=color] { padding: 2px; width: 46px; height: 34px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
label.f.req > span::after { content: ' *'; color: var(--bad); }
label.cb { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.help { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dropdown { position: relative; display: inline-block; }
.dropdown .menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); padding: 6px; z-index: 40; display: none; max-height: 60vh; overflow: auto; }
.dropdown.open .menu { display: block; }
.dropdown .menu button, .dropdown .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; color: var(--ink); cursor: pointer; }
.dropdown .menu button:hover, .dropdown .menu a:hover { background: var(--primary-soft); text-decoration: none; }
.dropdown .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- cards / tables ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.card > .card-h h3 { margin-right: auto; }
.card > .card-b { padding: 16px; }
.card.pad { padding: 16px; }
.kpi { padding: 16px; }
.kpi .k-label { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.kpi .k-val { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .k-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
table.t th.sortable { cursor: pointer; }
table.t td { padding: 0 12px; height: var(--row); border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--primary-soft); }
table.t tfoot td { font-weight: 650; border-top: 1px solid var(--line); height: 40px; }
table.t .num { text-align: right; }
table.t td.wrap { white-space: normal; padding-top: 8px; padding-bottom: 8px; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; opacity: .5; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; background: #eef0f4; color: #4b5563; white-space: nowrap; }
.pill.draft { background: #eef0f4; color: #4b5563; } .pill.sent, .pill.issued, .pill.open, .pill.enquiry { background: #e0ecff; color: #1d4ed8; }
.pill.accepted, .pill.paid, .pill.confirmed, .pill.closed, .pill.delivered, .pill.returned, .pill.completed, .pill.received, .pill.billed, .pill.invoiced { background: #dcf5ea; color: #047857; }
.pill.partially_paid, .pill.in_progress, .pill.dispatched, .pill.reserved { background: #fef3c7; color: #92400e; }
.pill.overdue, .pill.declined, .pill.void, .pill.cancelled, .pill.expired, .pill.conflict { background: #fde2e2; color: #b91c1c; }
:root[data-theme="dark"] .pill { filter: saturate(.9) brightness(.9); }
.list-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.list-toolbar input[type=search] { max-width: 280px; }
.list-summary { display: flex; gap: 22px; padding: 10px 14px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line-2); }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 12, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow: auto; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 24px 70px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 860px; } .modal.xwide { max-width: 1150px; }
.modal .m-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .m-h h2 { margin-right: auto; }
.modal .m-b { padding: 20px; max-height: 70vh; overflow: auto; }
.modal .m-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1b1830; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 420px; font-size: 13.5px; animation: tin .2s ease; }
.toast.err { background: #b91c1c; } .toast.ok { background: #047857; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > * { grid-column: span 6; }
.form-grid > .s12 { grid-column: span 12; } .form-grid > .s4 { grid-column: span 4; } .form-grid > .s3 { grid-column: span 3; } .form-grid > .s8 { grid-column: span 8; } .form-grid > .s2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid > * { grid-column: span 12 !important; } }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; padding: 6px 0 2px; grid-column: span 12; border-bottom: 1px solid var(--line-2); }
.sticky-actions { position: sticky; bottom: -60px; background: var(--panel); border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; justify-content: flex-end; margin: 16px -16px -16px; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- document editor ---------- */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
table.lines td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.lines input, table.lines select, table.lines textarea { min-height: 32px; padding: 5px 7px; font-size: 13px; }
table.lines textarea { min-height: 32px; height: 32px; margin-top: 4px; }
table.lines tr.section-row td { background: var(--primary-soft); }
table.lines tr.section-row input { font-weight: 650; background: transparent; border-style: dashed; }
table.lines .amt { text-align: right; font-weight: 600; padding-top: 12px; font-variant-numeric: tabular-nums; }
.avail { font-size: 11px; margin-top: 3px; }
.avail.ok { color: var(--ok); } .avail.bad { color: var(--bad); font-weight: 600; }
.totals { margin-left: auto; width: 360px; max-width: 100%; }
.totals .tr { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.totals .tr.grand { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.line-actions { display: flex; gap: 2px; }
.line-actions button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; border-radius: 5px; }
.line-actions button:hover { background: var(--line-2); color: var(--ink); }

/* ---------- document view ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .doc-layout { grid-template-columns: 1fr; } }
.paper-frame { width: 100%; border: 0; background: #fff; border-radius: 6px; box-shadow: 0 2px 20px rgba(0, 0, 0, .08); min-height: 1000px; }
.paper-wrap { background: color-mix(in srgb, var(--bg) 70%, #d8d5e4); padding: 18px; border-radius: var(--radius); }
.side-box { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.side-box:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; }
.kv > :nth-child(odd) { color: var(--ink-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; font-size: 12.5px; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* ---------- planner / calendar ---------- */
.planner { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: 72vh; }
.planner table { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.planner th, .planner td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 0; height: 34px; min-width: 38px; text-align: center; }
.planner th { position: sticky; top: 0; background: var(--panel-2); z-index: 2; font-weight: 600; color: var(--ink-2); padding: 4px 2px; }
.planner th.we, .planner td.we { background: color-mix(in srgb, var(--panel-2) 60%, var(--line-2)); }
.planner .rowhead { position: sticky; left: 0; background: var(--panel); z-index: 1; text-align: left; padding: 0 10px; min-width: 240px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.planner th.rowhead { z-index: 3; }
.planner .cell { display: grid; place-items: center; height: 100%; font-weight: 600; font-size: 11px; cursor: default; }
.planner .today { box-shadow: inset 2px 0 0 var(--primary); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.cal .dow { padding: 8px; font-size: 11px; text-transform: uppercase; color: var(--ink-3); background: var(--panel-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 600; }
.cal .day { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; font-size: 12px; }
.cal .day.out { background: var(--panel-2); color: var(--ink-3); }
.cal .day.today .dn { background: var(--primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.cal .ev { display: block; padding: 2px 6px; border-radius: 4px; color: #fff; margin-top: 3px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* ---------- charts ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { stroke: var(--line); } .chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; padding: 4px 0; }
.bar-row .bar { height: 10px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.bar-row .bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

/* ---------- reports ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.report-grid .card { padding: 14px 16px; }
.report-grid h3 { margin-bottom: 8px; }
.report-grid a { display: block; padding: 4px 0; font-size: 13.5px; }
.rep { max-width: 1100px; margin: 0 auto; }
.rep-head { text-align: center; padding: 18px 0 10px; }
.rep-head .org { font-size: 13px; color: var(--ink-2); }
.rep-head h2 { font-size: 20px; margin: 4px 0; }
table.rt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.rt td, table.rt th { padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
table.rt th { text-align: left; font-size: 11.5px; text-transform: uppercase; color: var(--ink-3); letter-spacing: .04em; background: var(--panel-2); }
table.rt tr.sec td { font-weight: 650; background: var(--panel-2); }
table.rt tr.tot td { font-weight: 700; border-top: 1px solid var(--line); }
table.rt tr.grand td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--ink); }
table.rt td.ind { padding-left: 28px; }

/* ---------- template editor ---------- */
.tpl-editor { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.tpl-editor .ctrl { max-height: calc(100vh - 170px); overflow: auto; }
.tpl-editor details { border-bottom: 1px solid var(--line-2); }
.tpl-editor summary { padding: 12px 16px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.tpl-editor summary::after { content: '+'; color: var(--ink-3); }
.tpl-editor details[open] summary::after { content: '−'; }
.tpl-editor .dbody { padding: 4px 16px 16px; display: grid; gap: 10px; }
.tpl-editor .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
@media (max-width: 1000px) { .tpl-editor { grid-template-columns: 1fr; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--primary) 35%, transparent), transparent), var(--sidebar); padding: 20px; }
.login .box { background: var(--panel); border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login h1 { margin-bottom: 4px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.notif-list .n { padding: 10px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.notif-list .n.unread { background: var(--primary-soft); }
.drag { cursor: grab; color: var(--ink-3); }
.kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: var(--panel-2); }
@media print { #sidebar, #topbar, .no-print { display: none !important; } #app { display: block; } #view { overflow: visible; padding: 0; } }

/* ---------- AV equipment ---------- */
.pill.eq-available, .pill.eq-done, .pill.eq-good, .pill.eq-new { background: #dcf5ea; color: #047857; }
.pill.eq-out, .pill.eq-in_progress, .pill.eq-fair { background: #fef3c7; color: #92400e; }
.pill.eq-maintenance, .pill.eq-waiting_parts, .pill.eq-open { background: #e0ecff; color: #1d4ed8; }
.pill.eq-damaged, .pill.eq-lost, .pill.eq-missing, .pill.eq-poor, .pill.eq-written_off { background: #fde2e2; color: #b91c1c; }
.pill.eq-retired, .pill.eq-disposed, .pill.eq-sold { background: #eceaf2; color: #6b6785; }
.prio { font-size: 11.5px; font-weight: 600; text-transform: capitalize; } .prio.urgent, .prio.high { color: var(--bad); } .prio.low { color: var(--ink-3); }
.mv-kind { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.mv-kind.check_out { background: #fff1e6; color: #c2410c; } .mv-kind.check_in { background: #e6f6ef; color: #047857; } .mv-kind.transfer { background: #eef2ff; color: #4338ca; }
.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }

.cat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.cat-tree { padding: 8px; position: sticky; top: 0; max-height: calc(100vh - 140px); overflow: auto; }
.cat-tree a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; color: var(--ink); font-size: 13px; cursor: pointer; text-decoration: none; }
.cat-tree a span { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cat-tree a:hover { background: var(--line-2); }
.cat-tree a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.cat-tree .cat-sub { display: none; margin: 0 0 4px 16px; border-left: 1px solid var(--line); padding-left: 4px; }
.cat-tree .cat-sub.open { display: block; }
.cat-tree .cat-sub a { font-size: 12.5px; padding: 4px 8px; }
@media (max-width: 900px) { .cat-layout { grid-template-columns: 1fr; } .cat-tree { position: static; max-height: 260px; } }

.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.model-card { position: relative; display: flex; flex-direction: column; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px 16px; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s, transform .15s; }
.model-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--dc); }
.model-card:hover { border-color: color-mix(in srgb, var(--dc) 55%, var(--line)); transform: translateY(-1px); }
.mc-top { display: flex; align-items: center; gap: 8px; min-height: 20px; }
.mc-brand { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-own { font-size: 11px; font-weight: 650; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.mc-sub { font-size: 11px; color: var(--ink-3); border: 1px dashed var(--line); padding: 0 7px; border-radius: 10px; }
.mc-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.mc-cat { font-size: 12px; color: var(--ink-2); }
.mc-specs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; min-height: 20px; }
.mc-specs span { font-size: 11px; background: var(--line-2); color: var(--ink-2); padding: 1px 7px; border-radius: 5px; }
.mc-specs span.warn { color: var(--warn); }
.mc-rate { margin-top: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-rate span { font-weight: 400; color: var(--ink-3); font-size: 12px; }

.scan-box input[data-scan], .scan-box input[data-code] { font: 600 17px ui-monospace, Menlo, monospace; height: 48px; letter-spacing: .02em; }
.scan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; margin-top: 14px; }
@media (max-width: 1100px) { .scan-grid { grid-template-columns: 1fr; } }
.scan-hit { margin-bottom: 10px; animation: tin .2s ease; }
[data-exp] { max-height: 62vh; overflow: auto; }
.exp-sum { padding: 10px 16px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.exp-row { padding: 8px 16px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.exp-row .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-row .bar { height: 6px; border-radius: 4px; background: var(--line-2); margin-top: 5px; overflow: hidden; }
.exp-row .bar i { display: block; height: 100%; background: var(--warn); }
.exp-row.ok .bar i { background: var(--ok); } .exp-row.ok b { color: var(--ok); }
.exp-row.over b { color: var(--bad); }
.cat-row { padding: 6px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; flex-wrap: nowrap; }
.tech-summary { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; margin-top: 10px; }
.tech-summary b { color: var(--ink); }

/* ---- v3: approvals, email, bank feed, talent, integrations ---- */
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius, 10px); margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--panel)); }
.banner.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 7%, var(--panel)); }
.banner.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.banner .grow { flex: 1; }
.pill.pending, .pill.unmatched, .pill.submitted, .pill.processing, .pill.active { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.pill.approved, .pill.matched, .pill.categorized, .pill.accepted_asp, .pill.sent_ok, .pill.delivered_asp { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.rejected, .pill.failed, .pill.error { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.pill.excluded, .pill.not_submitted { background: var(--line-2); color: var(--ink-3); }
.amt-in { color: var(--ok); font-weight: 600; } .amt-out { color: var(--bad); font-weight: 600; }
.feed-line { display: grid; grid-template-columns: 92px minmax(0, 1fr) 130px 120px 150px; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.feed-line:hover { background: var(--primary-soft); }
@media (max-width: 760px) { .feed-line { grid-template-columns: 1fr 1fr; } }
.sugg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.sugg.best { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.talent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.talent-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.talent-card .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary); flex: none; }
.talent-card:hover { border-color: var(--primary); text-decoration: none; }
.secret-hint { font-size: 12px; color: var(--ok); }
.code-url { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--line-2); padding: 6px 8px; border-radius: 6px; word-break: break-all; }
.check-list li { margin: 3px 0; } .check-list .e { color: var(--bad); } .check-list .w { color: var(--warn); }
/* v4: plan-locked menu items */
.nav a.locked { opacity: .5; }
.nav a.locked:hover { opacity: .85; }
.nav a .lock { margin-left: auto; font-size: 11px; filter: grayscale(1); }
.plan-chip:hover { opacity: 1 !important; text-decoration: underline; }
/* SaaS billing bar */
.billing-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 9px 22px; font-size: 13.5px; background: var(--primary-soft); color: var(--text); border-bottom: 1px solid var(--line); }
.billing-bar.bad { background: color-mix(in srgb, var(--bad) 14%, var(--panel)); }
/* helpdesk inbox */
.hd-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; height: calc(100vh - 170px); min-height: 480px; }
.hd-list, .hd-conv { margin: 0; display: flex; flex-direction: column; overflow: hidden; }
.hd-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.hd-tabs a { padding: 6px 9px; font-size: 13px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.hd-tabs a.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.hd-tabs a span { font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 0 5px; }
.hd-tabs a span:empty { display: none; }
.hd-rows { overflow: auto; flex: 1; }
.hd-row { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.hd-row:hover { background: var(--bg-soft, rgba(0,0,0,.02)); } .hd-row.sel { background: var(--primary-soft); }
.hd-head { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.hd-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-soft, #f7f6fb); }
.hd-m { max-width: 78%; padding: 8px 11px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); align-self: flex-start; unicode-bidi: plaintext; word-wrap: break-word; }
.hd-m.agent { align-self: flex-end; background: var(--primary); color: #fff; border-color: transparent; } .hd-m.agent .who, .hd-m.agent a { color: rgba(255,255,255,.85); }
.hd-m.n { align-self: flex-end; background: #fff7e0; border-color: #f5d27a; color: #4a3500; }
.hd-m.bot { background: color-mix(in srgb, var(--primary) 6%, var(--panel)); }
.hd-m .who { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.hd-sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: 9px; padding: 4px 10px; text-align: center; }
.hd-reply { border-top: 1px solid var(--line); padding: 10px 12px; }
.hd-reply textarea { width: 100%; resize: vertical; }
@media (max-width: 900px) { .hd-grid { grid-template-columns: 1fr; height: auto; } .hd-list { max-height: 320px; } .hd-conv { min-height: 520px; } }
/* proposals editor */
.pp-head { gap: 8px; flex-wrap: wrap; }
.pp-title { font-size: 20px; font-weight: 700; border: 1px solid transparent; background: transparent; padding: 4px 6px; width: 100%; border-radius: 8px; }
.pp-title:hover, .pp-title:focus { border-color: var(--line); background: var(--panel); }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pp-ed { margin: 0; } .pp-body { padding: 14px; }
.pp-tabs { padding: 0 12px; overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; }
.pp-pv { margin: 0; position: sticky; top: 12px; overflow: hidden; }
.pp-frame { height: calc(100vh - 150px); overflow: hidden; position: relative; background: #e9e7f0; }
.pp-frame iframe { border: 0; width: 820px; height: 200%; transform: scale(.62); transform-origin: 0 0; position: absolute; left: 0; top: 0; }
@media (min-width: 1500px) { .pp-frame iframe { transform: scale(.75); height: 175%; } }
.pp-mobile-only { display: none; }
@media (max-width: 1100px) { .pp-grid { grid-template-columns: minmax(0, 1fr); } .pp-pv { display: none; } .pp-mobile-only { display: inline-block; } }
.pp-g { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: var(--panel); }
.pp-g.dragging, .pp-it.dragging { opacity: .45; } .drop-before { box-shadow: 0 -3px 0 0 var(--primary) inset, 0 -3px 0 var(--primary); }
.pp-gh { display: flex; gap: 6px; align-items: center; padding: 8px 10px; background: var(--primary-soft); border-radius: 12px 12px 0 0; flex-wrap: wrap; }
.pp-gname { flex: 1; min-width: 140px; font-weight: 700; font-size: 15px; background: transparent; border: 1px solid transparent; }
.pp-gname:focus { background: var(--panel); border-color: var(--line); }
.pp-gd { display: flex; align-items: center; gap: 4px; white-space: nowrap; } .pp-gd input { width: 64px; }
.pp-gdesc { margin: 8px 10px 0; width: calc(100% - 20px); font-size: 13px; }
.pp-h { cursor: grab; color: var(--muted); user-select: none; font-size: 16px; padding: 0 2px; }
.pp-items { padding: 6px 10px; min-height: 30px; }
.pp-empty { border: 1.5px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.pp-it { display: grid; grid-template-columns: 16px 64px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pp-it:last-child { border-bottom: 0; }
.pp-img { width: 64px; height: 52px; border-radius: 8px; border: 1px dashed var(--line); background: var(--bg-soft, #f6f5fa) center/cover no-repeat; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pp-img[style*="background-image"] { border-style: solid; }
.pp-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pp-f > input { font-weight: 600; } .pp-f textarea { font-size: 13px; resize: vertical; min-height: 32px; }
.pp-n { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.pp-n label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 2px; }
.pp-n input { width: 72px; } .pp-n select { width: 110px; }
.pp-amt { margin-left: auto; font-weight: 700; padding-bottom: 7px; white-space: nowrap; }
.pp-ia { display: flex; flex-direction: column; gap: 2px; }
.pp-gf { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pp-job { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); }
.pp-tot { margin-top: 10px; } .pp-tot div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; } .pp-tot .g { color: #067647; }
.pp-tot .t { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 18px; }
.pp-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pp-style { border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 8px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; color: inherit; }
.pp-style.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); } .pp-style small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.pp-sw { height: 64px; border-radius: 8px; display: block; margin-bottom: 4px; background: #f3f2f8; position: relative; overflow: hidden; }
.pp-sw.modern { background: linear-gradient(150deg, var(--c), #120c25); } .pp-sw.classic { background: #fff; box-shadow: inset 0 0 0 4px var(--c); }
.pp-sw.bold { background: linear-gradient(90deg, var(--c) 0 36%, #d9d6e6 36%); } .pp-sw.photo { background: linear-gradient(#0003, #0006), repeating-linear-gradient(45deg, #b9b3cc 0 8px, #a69fbd 8px 16px); }
.pp-sw.photo::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: 8px; height: 22px; background: #fff; border-radius: 4px; }
.pp-sw.minimal { background: #fff; border: 1px solid var(--line); } .pp-sw.minimal::after { content: ''; position: absolute; left: 10px; top: 24px; width: 50%; height: 7px; background: var(--c); border-radius: 3px; }
.pp-cov { width: 120px; height: 68px; border-radius: 8px; background: center/cover; border: 1px solid var(--line); }
.pp-vars { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; } .pp-vars .btn { height: 26px; font-size: 11.5px; font-family: monospace; }
.pp-cat { max-height: 60vh; overflow: auto; } .pp-ci { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pp-ct { width: 44px; height: 36px; border-radius: 6px; background: var(--bg-soft, #f3f2f8) center/cover; flex: none; border: 1px solid var(--line); }
@media (max-width: 640px) { .pp-it { grid-template-columns: 52px minmax(0, 1fr); } .pp-it .pp-h { display: none; } .pp-img { width: 52px; height: 44px; } .pp-ia { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; } .pp-n input { width: 64px; } }

.pp-head { flex-wrap: wrap; } .pp-head > div:not(.dropdown) { min-width: 0 !important; } @media (max-width: 640px) { .pp-head > div:not(.dropdown) { flex: 1 1 calc(100% - 50px) !important; } .pp-head .pp-title { font-size: 17px; } .pp-body { padding: 10px; } .pp-gd input { width: 52px; } }
/* plot import */
.pi-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 20px; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; text-align: center; background: var(--bg-soft, #f8f7fc); }
.pi-drop svg { width: 34px; height: 34px; color: var(--primary); } .pi-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.pi-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; font-size: 13px; }
.pi-help ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); } .pi-help li { margin: 3px 0; }
.pi-table { max-height: 52vh; overflow: auto; } .pi-table tr.off td { opacity: .45; } .pi-table tr.off td:first-child { opacity: 1; }
