/* DATAX CRM */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --text: #1e1b4b;
  --text-2: #4b5168;
  --muted: #7a7f96;
  --border: #e3e5ef;
  --primary: #4338ca;
  --primary-dark: #3730a3;
  --primary-soft: #eef0ff;
  --accent: #22b8cf;
  --sidebar: #1e1b4b;
  --sidebar-2: #2b2770;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff6e5;
  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --info-soft: #e8f4fd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 27, 75, .06), 0 2px 8px rgba(30, 27, 75, .04);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .2rem; font-weight: 650; }
h2 { font-size: 1.08rem; margin: 0 0 .8rem; font-weight: 620; }
h3 { font-size: .95rem; margin: 1.2rem 0 .6rem; font-weight: 620; color: var(--text-2); }
h4 { margin: 0 0 .5rem; }
code { background: var(--primary-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
pre { white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.danger { color: var(--danger) !important; }
.ok { color: var(--ok); }
.mb { margin-bottom: 1rem; }
.mt { margin-top: 1rem; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2)); color: #c7c9ea; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 30; padding-bottom: 2rem; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1.3rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand strong { display: block; letter-spacing: .08em; }
.brand small { color: #9ea2d6; font-size: .75rem; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff; font-weight: 700; font-size: .85rem; }
.brand-mark.lg { width: 54px; height: 54px; font-size: 1.2rem; border-radius: 14px; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .52rem 1.1rem; color: #c7c9ea; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(255, 255, 255, .1); color: #fff; border-left-color: var(--accent); }
.nav-label { text-transform: uppercase; font-size: .68rem; letter-spacing: .12em; color: #8a8ec6; padding: 1.2rem 1.1rem .4rem; }
.ico { width: 8px; height: 8px; border-radius: 2px; background: currentColor; opacity: .55; flex: none; }
.main { flex: 1; margin-left: 232px; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); padding: .6rem 1.5rem; }
.topbar .search { flex: 1; max-width: 560px; }
.topbar .search input { width: 100%; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.1rem; color: var(--text-2); padding: .3rem .4rem; border-radius: 6px; position: relative; line-height: 1; }
.icon-btn:hover { background: var(--primary-soft); text-decoration: none; }
.bell .count { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; border-radius: 10px; font-size: .68rem; padding: 1px 5px; font-weight: 700; }
.menu-toggle { display: none; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: .55rem; background: none; border: 0; cursor: pointer; padding: .25rem .4rem; border-radius: 8px; text-align: left; color: var(--text); }
.user-btn:hover { background: var(--primary-soft); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .78rem; font-weight: 700; }
.user-meta strong { display: block; font-size: .85rem; }
.user-meta small { color: var(--muted); font-size: .74rem; }
.dropdown { display: none; position: absolute; right: 0; top: 110%; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); min-width: 200px; overflow: hidden; }
.dropdown a { display: block; padding: .6rem .9rem; color: var(--text); }
.dropdown a:hover { background: var(--primary-soft); text-decoration: none; }
.user-menu.open .dropdown { display: block; }
.content { padding: 1.4rem 1.6rem 3rem; max-width: 1500px; }

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.page-head p { margin: 0; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.actions.wrap { margin-bottom: .7rem; }
form.inline { display: inline; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .48rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 550; white-space: nowrap; }
.btn:hover { border-color: #c9cce0; background: #fafbff; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f2c4c4; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-sm { padding: .32rem .65rem; font-size: .85rem; }
.btn-xs { padding: .15rem .45rem; font-size: .76rem; border-radius: 6px; }
.btn-block { width: 100%; }

/* ---------- alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; transition: opacity .6s; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-success { background: var(--ok-soft); border-color: #bfe5cd; color: #14532d; }
.alert-error { background: var(--danger-soft); border-color: #f5c2c2; color: #7f1d1d; }
.alert-info { background: var(--info-soft); border-color: #c4e0f6; color: #0c4a6e; }
.alert-warn { background: var(--warn-soft); border-color: #f5d9a8; color: #78350f; }
.alert.fade { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }
.alert[data-dismiss] { cursor: pointer; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.card.inner { box-shadow: none; background: #fafbff; margin: 0; }
.muted-card { background: #fafbff; }
.muted-card ul { padding-left: 1.2rem; color: var(--text-2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .7rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.grid-2.wide-left { grid-template-columns: 1.7fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); color: var(--text); display: block; }
a.stat:hover { border-color: #c9cce0; text-decoration: none; }
.stat span { display: block; color: var(--muted); font-size: .8rem; }
.stat strong { display: block; font-size: 1.45rem; font-weight: 680; margin-top: .15rem; }
.stat em { font-style: normal; font-size: .78rem; font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: .55rem .6rem; border-bottom: 1px solid var(--border); background: #fafbff; white-space: nowrap; }
.table td { padding: .6rem .6rem; border-bottom: 1px solid #eef0f6; vertical-align: top; }
.table.compact td { padding: .45rem .5rem; }
.table tbody tr:hover { background: #fafbff; }
.table tfoot td { border-bottom: 0; }
.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-danger { background: #fff7f7; }
.row-warn { background: #fffbef; }
.row-muted td { opacity: .6; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: .14rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 650; background: #eef0f6; color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge-documents_requested, .badge-new, .badge-pending, .badge-unpaid, .badge-open { background: #fff1e0; color: #9a4b00; }
.badge-documents_received, .badge-contacted, .badge-sent { background: #e6f4ff; color: #075985; }
.badge-preparing, .badge-running { background: #ede9fe; color: #5b21b6; }
.badge-review, .badge-quoted, .badge-partial, .badge-pending_review, .badge-checked { background: #fef3c7; color: #854d0e; }
.badge-approval, .badge-draft { background: #fde7f3; color: #9d174d; }
.badge-filed, .badge-accepted, .badge-paid, .badge-approved, .badge-received, .badge-converted, .badge-done, .badge-recorded, .badge-active, .badge-atl-active { background: var(--ok-soft); color: var(--ok); }
.badge-closed, .badge-cancelled, .badge-expired, .badge-not_applicable, .badge-inactive, .badge-atl-unknown, .badge-routed { background: #eef0f6; color: #5b6075; }
.badge-lost, .badge-rejected, .badge-failed, .badge-overdue, .badge-urgent, .badge-atl-inactive { background: var(--danger-soft); color: var(--danger); }
.badge-high, .badge-warn { background: var(--warn-soft); color: var(--warn); }
.chip { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); border-radius: 6px; padding: .05rem .42rem; font-size: .74rem; margin: 0 .2rem .2rem 0; }

/* ---------- forms ---------- */
input, select, textarea { font: inherit; color: var(--text); border: 1px solid #d5d8e6; border-radius: 8px; padding: .48rem .65rem; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(67, 56, 202, .25); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: auto; }
input:disabled { background: #f3f4f8; color: var(--muted); }
textarea { resize: vertical; }
label { font-weight: 560; font-size: .85rem; color: var(--text-2); }
.form-card { max-width: 1100px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem 1.1rem; margin-bottom: .8rem; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-full { grid-column: 1 / -1; }
.field small { color: var(--muted); font-size: .76rem; }
.req { color: var(--danger); }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-bottom: 1rem; }
.checks.cols-2 { display: grid; grid-template-columns: 1fr 1fr; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--text); cursor: pointer; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.row-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.row-form > input, .row-form > select { width: auto; flex: 1 1 160px; }
.row-form label { display: flex; align-items: center; gap: .4rem; }
.row-form label input { width: auto; }
.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .8rem 1rem; }
.filters > input[type=search] { flex: 1 1 260px; }
.filters > select, .filters > input { width: auto; }
.filters label { display: flex; align-items: center; gap: .35rem; }
.filters label input[type=date] { width: auto; }
.note-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-bottom: 1rem; }

/* ---------- misc components ---------- */
.empty { text-align: center; padding: 1.4rem .5rem; color: var(--muted); }
.empty p { margin: 0 0 .7rem; }
.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; padding-top: .9rem; font-size: .85rem; color: var(--muted); }
.export-links { display: inline-flex; gap: .55rem; align-items: center; font-size: .85rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .38rem .7rem; }
.progress { height: 7px; background: #eceef6; border-radius: 9px; overflow: hidden; margin-top: .35rem; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 9px; transition: width .3s; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: .45rem .8rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; }
.dl dd { margin: 0; }
.dl.tight { grid-template-columns: 1fr auto; }
.dl.tight dd { text-align: right; font-variant-numeric: tabular-nums; }
.note-box { background: #fafbff; border: 1px solid var(--border); border-radius: 8px; padding: .7rem .85rem; white-space: pre-wrap; margin-top: .8rem; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: .45rem 0; border-bottom: 1px solid #f0f1f7; font-size: .88rem; }
.activity li span { margin-right: .5rem; font-size: .8rem; }
.seg-links { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; flex-wrap: wrap; }
.seg-links a { padding: .4rem .8rem; color: var(--text-2); border-right: 1px solid var(--border); }
.seg-links a:last-child { border-right: 0; }
.seg-links a.on { background: var(--primary); color: #fff; }
.seg-links a:hover { text-decoration: none; }

/* tabs */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: .6rem .95rem; font: inherit; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 620; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* dashboard pipeline */
.pipeline-bars { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 40px; align-items: center; gap: .7rem; color: var(--text); }
.bar-row:hover { text-decoration: none; }
.bar-label { font-size: .85rem; color: var(--text-2); }
.bar { background: #eef0f6; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 6px; min-width: 2px; }
.bar-documents_requested { background: #f59e0b; } .bar-documents_received { background: #0ea5e9; } .bar-preparing { background: #8b5cf6; }
.bar-review { background: #eab308; } .bar-approval { background: #ec4899; } .bar-filed { background: #16a34a; } .bar-closed { background: #94a3b8; }
.bar-count { text-align: right; font-weight: 650; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: 1rem; }
.board-col { background: #eceef7; border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.board-head { font-weight: 650; font-size: .85rem; padding: .2rem .3rem .6rem; display: flex; align-items: center; gap: .4rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); display: inline-block; }
.dot-documents_requested { background: #f59e0b; } .dot-documents_received { background: #0ea5e9; } .dot-preparing { background: #8b5cf6; }
.dot-review { background: #eab308; } .dot-approval { background: #ec4899; } .dot-filed { background: #16a34a; } .dot-closed { background: #94a3b8; }
.board-card { display: flex; flex-direction: column; gap: .2rem; background: #fff; border-radius: 8px; padding: .6rem .7rem; margin-bottom: .5rem; color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--primary); }
.board-card:hover { text-decoration: none; box-shadow: var(--shadow); }
.board-card.overdue { border-left-color: var(--danger); }
.board-card span { font-size: .85rem; color: var(--text-2); }

/* stepper */
.stepper { display: flex; gap: 0; margin-bottom: 1.1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; overflow-x: auto; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; position: relative; min-width: 95px; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 13px; left: calc(50% + 16px); right: calc(-50% + 16px); height: 2px; background: #e3e5ef; }
.step.done:not(:last-child)::after { background: var(--ok); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef0f6; color: var(--muted); font-size: .78rem; font-weight: 700; z-index: 1; }
.step.done .step-dot { background: var(--ok); color: #fff; }
.step.current .step-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(67, 56, 202, .18); }
.step-label { font-size: .76rem; color: var(--text-2); text-align: center; }
.step.current .step-label { font-weight: 650; color: var(--primary); }
.approval-box { border-color: #c7c2f7; background: #fbfaff; }
.approval-box textarea { margin-bottom: .2rem; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--border); padding: .1rem 0 .8rem .9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: #c7c9e0; }
.timeline li.tl-status::before { background: var(--primary); }
.timeline li.tl-approval::before { background: var(--ok); }
.tl-meta { font-size: .78rem; color: var(--muted); }
.tl-body { white-space: pre-wrap; }

/* checklist */
.checklist .ck-label { width: 55%; }
.checklist tr.ck-received .ck-label { color: var(--ok); }
.checklist tr.ck-not_applicable .ck-label { color: var(--muted); text-decoration: line-through; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: .3rem .65rem; font: inherit; font-size: .8rem; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[data-status=pending].on { background: #fff1e0; color: #9a4b00; font-weight: 650; }
.seg button[data-status=received].on { background: var(--ok); color: #fff; font-weight: 650; }
.seg button[data-status=not_applicable].on { background: #94a3b8; color: #fff; }
.seg.busy { opacity: .5; pointer-events: none; }
details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; z-index: 10; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(30, 27, 75, .14); padding: .8rem; width: 300px; display: flex; flex-direction: column; gap: .35rem; }
.pop-body form { display: flex; flex-direction: column; gap: .35rem; }
details.pop-inline > summary { list-style: none; margin-bottom: .6rem; display: inline-flex; }
details.pop-inline[open] { background: #fafbff; border: 1px solid var(--border); border-radius: 8px; padding: .7rem; margin-bottom: .8rem; }

/* documents */
.doc-preview { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.doc-frame { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: 8px; }
pre.extract { max-height: 420px; overflow: auto; background: #fafbff; border: 1px solid var(--border); border-radius: 8px; padding: .8rem; font-size: .8rem; }
.upload-form { margin-top: .4rem; }

/* line items & workings */
.items-table input { padding: .38rem .5rem; }
.items-table td { padding: .3rem .3rem; border-bottom: 0; }
.items-table tfoot td { padding-top: .5rem; }
.items-editor { margin-bottom: 1rem; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; align-items: start; }
.slab-result { font-size: .85rem; margin: .5rem 0; color: var(--text-2); }
.draft-banner { background: repeating-linear-gradient(-45deg, #fff6e5, #fff6e5 12px, #ffefd2 12px, #ffefd2 24px); border: 1px solid #f5d9a8; color: #9a3412; font-weight: 750; letter-spacing: .08em; padding: .65rem 1rem; border-radius: 8px; margin-bottom: 1rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.draft-banner span { font-weight: 500; letter-spacing: 0; color: #7c2d12; }

/* AI */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.agent-card { display: flex; flex-direction: column; gap: .35rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; color: var(--text); box-shadow: var(--shadow); transition: transform .1s, border-color .1s; }
.agent-card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.agent-card span { color: var(--text-2); font-size: .86rem; }
.agent-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--primary)); color: #fff !important; font-weight: 700; font-size: .8rem !important; }
.agent-num.inline { width: 30px; height: 30px; }
.running { padding: 2.5rem 1rem; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 1rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.md { line-height: 1.6; }
.md h2, .md h3, .md h4 { color: var(--text); margin: 1.3rem 0 .5rem; }
.md h2:first-child, .md h3:first-child { margin-top: 0; }
.md p { margin: .5rem 0; }
.md ul, .md ol { padding-left: 1.3rem; }
.md .table { margin: .6rem 0 1rem; font-size: .88rem; }
.md pre { background: #fafbff; border: 1px solid var(--border); padding: .7rem; border-radius: 8px; }
.workflow { padding-left: 1.2rem; margin: 0 0 1rem; }
.workflow li { margin-bottom: .3rem; color: var(--muted); }
.workflow li.done { color: var(--ok); }
.workflow li.current { color: var(--primary); font-weight: 650; }
.doc-picker { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; background: #fafbff; max-height: 320px; overflow: auto; }
.doc-tools { margin-bottom: .5rem; }
.doc-list { display: flex; flex-direction: column; gap: .3rem; }

/* reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.report-card { display: flex; flex-direction: column; margin: 0; }
.report-card p { flex: 1; }

/* notifications */
.alerts-list, .notif-list { list-style: none; padding: 0; margin: 0; }
.alerts-list li { padding: .55rem .7rem; border-radius: 8px; margin-bottom: .4rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.alerts-list li.danger { background: var(--danger-soft); color: #7f1d1d !important; }
.alerts-list li.warn { background: var(--warn-soft); }
.alerts-list li.info { background: var(--info-soft); }
.alerts-list form { margin-left: auto; }
.notif-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid #f0f1f7; }
.notif-list li.unread a { font-weight: 650; }
.notif-list li.unread::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: .45rem; flex: none; }
.notif-list li a { flex: 1; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at 20% 10%, #3b33a8, var(--sidebar) 60%); padding: 1rem; }
.login-card { background: #fff; width: 100%; max-width: 400px; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-card .field { margin-bottom: 1rem; }
.login-brand { text-align: center; margin-bottom: 1.4rem; }
.login-brand h1 { margin: .7rem 0 .1rem; }
.login-brand p { margin: 0; color: var(--muted); }
.error-card { max-width: 560px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-2.wide-left, .calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-block; }
  .user-meta { display: none; }
  .content { padding: 1rem; }
  .checks.cols-2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr 30px; }
  .dl { grid-template-columns: 120px 1fr; }
}

@media print {
  .sidebar, .topbar, .actions, .filters, .btn { display: none !important; }
  .main { margin-left: 0; }
  .card { box-shadow: none; }
}
