:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --text: #111827;
  --text-2: #374151;
  --muted: #6B7280;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --accent: #1F4E79;
  --accent-hover: #173B5C;
  --accent-soft: #E8F0F8;
  --accent-text: #1F4E79;
  --side-bg: #0F2338;
  --side-text: #C7D2DE;
  --side-active: #1F4E79;
  --ok: #047857; --ok-soft: #D1FAE5;
  --warn: #B45309; --warn-soft: #FEF3C7;
  --danger: #B91C1C; --danger-soft: #FEE2E2;
  --info: #1D4ED8; --info-soft: #DBEAFE;
  --violet: #6D28D9; --violet-soft: #EDE9FE;
  --grey-soft: #F3F4F6;
  --internal: #FFFBEB; --internal-border: #FCD34D;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.18);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220; --surface: #111A2B; --surface-2: #0F1726;
    --text: #E5E7EB; --text-2: #CBD5E1; --muted: #94A3B8;
    --border: #1F2A3D; --border-strong: #2B3A52;
    --accent: #3B82C4; --accent-hover: #4C93D4; --accent-soft: #15263D; --accent-text: #8EC1EE;
    --side-bg: #070D18; --side-text: #A9B6C6; --side-active: #1C3550;
    --ok: #34D399; --ok-soft: #0B2E24; --warn: #FBBF24; --warn-soft: #34260A;
    --danger: #F87171; --danger-soft: #3A1414; --info: #93C5FD; --info-soft: #132643;
    --violet: #C4B5FD; --violet-soft: #241B42; --grey-soft: #1A2436;
    --internal: #2A2410; --internal-border: #7C6512;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
svg { flex: none; vertical-align: -3px; }
.chip svg, .check svg, .crumbs svg, .dropzone svg { width: 14px; height: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; }
.pre { white-space: pre-wrap; word-wrap: break-word; }

/* ---------- Boot ---------- */
.boot-loader { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-loader::after, .spinner { content: ''; width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner { display: inline-block; width: 18px; height: 18px; border-width: 2px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px; display: grid; place-items: center; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 650; font-size: 15px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #2E6DA4; display: grid; place-items: center; }
.brand small { display: block; font-weight: 400; color: var(--side-text); font-size: 11.5px; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6B7F95; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-text); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; font-size: 11px; padding: 0 7px; border-radius: 10px; }
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 11.5px; }
.side-foot button { background: none; border: 0; color: var(--side-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.side-foot button:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .menu-btn { display: none; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.topbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 60px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.2; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--grey-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.icon { padding: 7px; }
.icon-btn { position: relative; background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--grey-soft); }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.badge-dot { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: block; color: inherit; }
a.kpi:hover { border-color: var(--accent); text-decoration: none; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.alert .value { color: var(--danger); }
.kpi.warn .value { color: var(--warn); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .t-title { font-weight: 550; color: var(--text); }
.table .t-sub { font-size: 12.5px; color: var(--muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty svg { width: 32px; height: 32px; opacity: .5; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.st-new { background: var(--info-soft); color: var(--info); }
.st-qualified { background: var(--violet-soft); color: var(--violet); }
.st-quote_sent { background: var(--warn-soft); color: var(--warn); }
.st-approved { background: var(--accent-soft); color: var(--accent-text); }
.st-in_progress { background: var(--accent-soft); color: var(--accent-text); }
.st-waiting_client { background: var(--warn-soft); color: var(--warn); }
.st-in_review { background: var(--violet-soft); color: var(--violet); }
.st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-closed { background: var(--grey-soft); color: var(--muted); }
.st-refused, .st-cancelled { background: var(--danger-soft); color: var(--danger); }
.pr { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.pr i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pr-critical i { background: var(--danger); } .pr-critical { color: var(--danger); }
.pr-high i { background: #EA580C; }
.pr-normal i { background: #3B82F6; }
.pr-low i { background: #9CA3AF; }
.sla { font-size: 12px; font-weight: 600; white-space: nowrap; }
.sla-breached, .sla-late { color: var(--danger); }
.sla-at_risk { color: var(--warn); }
.sla-ok { color: var(--ok); }
.sla-pending { color: var(--muted); font-weight: 500; }
.inv-draft { background: var(--grey-soft); color: var(--muted); }
.inv-issued { background: var(--info-soft); color: var(--info); }
.inv-paid { background: var(--ok-soft); color: var(--ok); }
.inv-overdue { background: var(--danger-soft); color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 12px; background: var(--grey-soft); color: var(--text-2); font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; background: #64748B; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.provider { background: var(--accent); }
.avatar.client { background: #0E7490; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.input.sm { padding: 5px 8px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filters .input { width: auto; min-width: 140px; }
.filters .grow { flex: 1; min-width: 200px; }
.type-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.type-card { position: relative; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); }
.type-card input { position: absolute; opacity: 0; }
.type-card svg { width: 20px; height: 20px; color: var(--accent-text); flex: none; margin-top: 1px; }
.type-card b { display: block; font-weight: 600; }
.type-card span { font-size: 12.5px; color: var(--muted); }
.type-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; background: var(--surface-2); color: var(--text-2); }
.file-chip svg { width: 14px; height: 14px; }
.file-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 0 0 2px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg label { padding: 7px 14px; cursor: pointer; font-weight: 550; font-size: 13px; border-right: 1px solid var(--border-strong); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }

/* ---------- Ticket detail ---------- */
.ticket-head { margin-bottom: 18px; }
.ticket-head .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ticket-head h1 { margin-bottom: 8px; }
.ticket-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); align-items: center; }
.action-bar .hint { color: var(--muted); font-size: 13px; margin-right: auto; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.props { display: grid; gap: 0; }
.prop { display: grid; grid-template-columns: 112px 1fr; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.prop:last-child { border-bottom: 0; }
.prop > span:first-child { color: var(--muted); font-size: 12.5px; }
.prop .input { padding: 5px 8px; font-size: 13px; }
.desc { white-space: pre-wrap; word-wrap: break-word; color: var(--text-2); }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.msg.mine .msg-body { background: var(--accent-soft); border-color: transparent; }
.msg.internal .msg-body { background: var(--internal); border: 1px dashed var(--internal-border); }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 3px; }
.msg-head b { font-size: 13px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; }
.event { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); padding-left: 6px; }
.event .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--grey-soft); display: grid; place-items: center; flex: none; }
.event .dot svg { width: 11px; height: 11px; }
.event.internal { color: #A16207; }
.composer { border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.composer textarea { border: 0; width: 100%; min-height: 84px; padding: 12px 14px; resize: vertical; background: transparent; outline: none; border-radius: 10px 10px 0 0; }
.composer.internal { background: var(--internal); border-color: var(--internal-border); }
.composer-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.composer-foot .spacer { flex: 1; }
.quote-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface-2); }
.quote-box.pending { border-color: var(--warn); background: var(--warn-soft); }
.quote-box .amount { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.quote-box .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.time-list { display: flex; flex-direction: column; }
.time-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: flex-start; }
.time-item:last-child { border-bottom: 0; }
.time-item .h { font-weight: 650; min-width: 48px; font-variant-numeric: tabular-nums; }
.time-item .d { flex: 1; min-width: 0; }
.time-item button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.gauge { height: 8px; border-radius: 6px; background: var(--grey-soft); overflow: hidden; margin: 8px 0 6px; }
.gauge > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.gauge.warn > i { background: #D97706; }
.gauge.danger > i { background: var(--danger); }
.contract-card .big { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.k-col { background: var(--grey-soft); border-radius: 10px; padding: 8px; min-height: 120px; }
.k-col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.k-col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 600; font-size: 13px; }
.k-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.k-card:hover { border-color: var(--accent); }
.k-card.dragging { opacity: .5; }
.k-card .num { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.k-card .title { font-weight: 550; margin: 3px 0 8px; font-size: 13.5px; line-height: 1.35; }
.k-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* ---------- Lists in dashboard ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 12.5px; color: var(--muted); }

/* ---------- Invoices ---------- */
.inv-lines .input { min-width: 60px; }
.inv-lines td { padding: 8px 8px; vertical-align: top; }
.totals { margin-left: auto; width: 300px; max-width: 100%; display: grid; gap: 6px; padding: 14px 18px; }
.totals div { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 17px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s ease; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 560px; max-width: 100%; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
.callout { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--text-2); font-size: 13px; }
.callout.warn { background: var(--warn-soft); }
.callout.ok { background: var(--ok-soft); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; padding: 10px 12px; background: var(--grey-soft); border-radius: 8px; user-select: all; word-break: break-all; }

/* ---------- Notifications ---------- */
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 50; overflow: hidden; }
.notif-panel .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif.unread { background: var(--accent-soft); }
.notif .when { font-size: 11.5px; color: var(--muted); }
.rel { position: relative; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 380px; animation: fade .15s ease; }
.toast.error { background: #991B1B; }
.toast.ok { background: #065F46; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 10% -10%, #1F4E7933, transparent), var(--bg); }
.login-card { width: 380px; max-width: 100%; padding: 32px 28px; }
.login-card .brand { color: var(--text); padding: 0 0 20px; font-size: 17px; }
.login-card .brand small { color: var(--muted); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
  .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 90; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; }
  .topbar { padding: 10px 16px; }
  .topbar .menu-btn { display: block; }
  .content { padding: 18px 16px 60px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .type-cards { grid-template-columns: 1fr 1fr; }
  .hide-sm { display: none !important; }
  .prop { grid-template-columns: 100px 1fr; }
}
@media (max-width: 520px) {
  .type-cards { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
}
@media print {
  .sidebar, .topbar, .action-bar, .composer { display: none !important; }
  .shell { display: block; }
}
