:root {
  --navy: #16223f;
  --navy-2: #1b2440;
  --ink: #1e2a4a;
  --accent: #2f4b86;
  --link: #1d4ed8;
  --gold: #d9a441;
  --green: #2e7d32;
  --green-bg: #e6f4ea;
  --red: #c62828;
  --red-bg: #fdecec;
  --amber-bg: #fff5e0;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --line: #e6e8ee;
  --line-2: #eef0f5;
  --muted: #6b7280;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.05);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink);
  background: var(--bg); font-size: 14px; line-height: 1.5; }
h1, h2, h3 { color: var(--navy); }
a { color: var(--link); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden { display: none !important; }
.num { text-align: right; }
.inline { display: inline; }

/* ---- App bar ---- */
.appbar { display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line); padding: .7rem 1.6rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none;
  color: var(--navy); font-weight: 800; font-size: 1.15rem; letter-spacing: -.2px; }
.brand .cloud { flex: none; }
.appbar-right { display: flex; align-items: center; gap: 1.4rem; }
.org { color: var(--navy); font-weight: 700; letter-spacing: .3px; font-size: .9rem; }
.org .caret { color: var(--muted); font-size: .7rem; }
.userbox { text-align: right; line-height: 1.15; }
.userbox .uname { font-weight: 600; color: var(--navy); font-size: .85rem; }
.userbox .urole { color: var(--muted); font-size: .72rem; }
.linklike { background: none; border: none; color: var(--ink); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { color: var(--link); text-decoration: underline; }

/* ---- Sub nav ---- */
.subnav { display: flex; gap: .3rem; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 1.6rem; }
.subnav a { padding: .7rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600;
  font-size: .86rem; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--navy); }
.subnav a.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---- Layout ---- */
.page { max-width: 1180px; margin: 0 auto; padding: 2rem 1.6rem 4rem; }
.workspace { max-width: 1560px; }

/* ---- Buttons ---- */
.btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .55rem .9rem; border-radius: 10px; font-weight: 600; transition: background .12s, box-shadow .12s; }
.btn:hover { background: #f4f6fb; }
.btn.primary { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.primary:hover { background: #232f52; }
.btn.ghost { background: transparent; }
.btn.small { padding: .34rem .6rem; font-size: .82rem; border-radius: 8px; }
.btn.tiny { padding: .2rem .45rem; font-size: .74rem; border-radius: 7px; }
.btn.wide { width: 100%; padding: .7rem; margin-top: .4rem; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---- Login ---- */
.login-bg { background: linear-gradient(160deg, #eef1f8, #f7f8fb 60%); }
.login-main { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 2.2rem;
  width: min(410px, 94vw); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; color: var(--navy);
  font-size: 1.1rem; margin-bottom: 1.2rem; }
.login-card h1 { margin: 0; font-size: 1.5rem; }
.login-card .hint { margin-top: 1rem; }

/* ---- Start page ---- */
.start-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: start; }
.start-hero h1 { font-size: 2.6rem; margin: 0 0 1rem; letter-spacing: -1px; }
.start-hero .lead { color: #46506a; font-size: 1.02rem; max-width: 40ch; }
.start-hero hr { border: none; border-top: 1px solid var(--line); margin: 1.6rem 0; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.feature-list li { display: flex; align-items: center; gap: .7rem; color: var(--ink); }
.fi { width: 22px; text-align: center; color: var(--gold); }
.quicklinks { display: flex; gap: 1.6rem; margin-top: 1.8rem; }
.quicklinks a { font-weight: 700; text-decoration: none; color: var(--navy); border-bottom: 2px solid var(--navy); padding-bottom: 1px; }

.open-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow); }
.open-card h2 { margin: 0 0 .2rem; font-size: 1.25rem; }

.recent { margin-top: 2.6rem; }
.eng-list { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .7rem; }
.eng-chip { display: flex; flex-direction: column; gap: .1rem; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; background: #fff; min-width: 150px; }
.eng-chip:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.eng-chip b { color: var(--navy); }
.eng-chip span { color: var(--muted); font-size: .82rem; }
.eng-chip em { color: var(--gold); font-style: normal; font-size: .74rem; font-weight: 600; }

/* ---- Fields ---- */
.field { display: block; margin: .8rem 0; font-size: .82rem; color: var(--muted); font-weight: 600; }
.field input, .field select { display: block; width: 100%; margin-top: .35rem; font: inherit; color: var(--ink);
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; }
.field.big input, .field.big select { padding: .7rem .8rem; }
input:focus, select:focus, .field input:focus { outline: 2px solid #c7d6f5; border-color: var(--accent); }
.err { color: var(--red); margin-top: .7rem; font-size: .85rem; }
.ok { color: var(--green); margin-top: .7rem; font-size: .85rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

/* ---- Panels / management ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1.2rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; font-size: 1.7rem; }
.addrow { display: flex; gap: .5rem; }
.addrow input { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; min-width: 240px; }
.section-h { margin: 1.4rem 0 .6rem; }
.mtable { width: 100%; border-collapse: collapse; }
.mtable th { text-align: left; color: var(--muted); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .4px; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.mtable td { padding: .6rem .6rem; border-bottom: 1px solid var(--line-2); }
.mtable .rowactions { text-align: right; white-space: nowrap; }
.mtable .empty { text-align: center; padding: 1.4rem; }
.pill { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.pill.role-admin { background: #e0e7ff; color: #3730a3; }
.pill.role-user { background: #e5e7eb; color: #374151; }

/* ---- Rules ---- */
.rules-table { margin-top: 1rem; }
.rules-table th.ctr, .rules-table td.ctr { text-align: center; }
.rules-table input[type=text], .rules-table td input:not([type=checkbox]) {
  width: 100%; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: .84rem; }
.rules-table td { vertical-align: middle; }
.page-head + .panel .chk { margin-right: 1.2rem; }

/* ---- Integrations ---- */
.intg { max-width: 640px; }
.intg h2 { margin-top: 0; }
.notice { background: var(--amber-bg); border: 1px solid #f0d9a8; color: #8a6d1f; border-radius: 10px;
  padding: .7rem .9rem; font-size: .84rem; margin: .8rem 0; }

/* ---- Workspace head ---- */
.ws-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.2rem; }
.ws-head h1 { margin: .2rem 0 .1rem; font-size: 1.7rem; }
.ws-head .period { color: var(--muted); font-weight: 500; }
.ws-head .back { text-decoration: none; color: var(--muted); font-size: .84rem; font-weight: 600; }
.ws-actions { display: flex; gap: .5rem; align-items: center; }

/* ---- Cards ---- */
.cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; box-shadow: var(--shadow); }
.card .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.card .v { font-size: 1.5rem; font-weight: 700; margin-top: .1rem; color: var(--navy); }
.card .sub { font-size: .7rem; color: var(--muted); }
.card.exc .v { color: var(--red); }
.card.progress .bar { height: 7px; background: var(--line); border-radius: 5px; margin-top: .5rem; overflow: hidden; }
.card.progress .bar > span { display: block; height: 100%; background: var(--green); }

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.tool-group { display: flex; gap: .5rem; align-items: center; }
.filters { flex: 1; flex-wrap: wrap; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.filters input, .filters select { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.chk { display: flex; align-items: center; gap: .35rem; white-space: nowrap; color: var(--muted); font-weight: 600; font-size: .84rem; }
.bulkbar { display: flex; gap: .5rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.bulkbar #selCount { font-weight: 700; color: var(--navy); }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: 112%; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 280px; padding: .35rem; z-index: 30; }
.menu a { display: block; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; color: var(--ink); text-decoration: none; }
.menu a:hover { background: #f4f6fb; }
.menu-head { font-size: .68rem; text-transform: uppercase; color: var(--muted); padding: .5rem .6rem .2rem; letter-spacing: .5px; }

/* ---- Table ---- */
.tablewrap { padding: 0; overflow-x: auto; }
table#txTable { border-collapse: collapse; width: 100%; font-size: .82rem; }
#txTable thead th { position: sticky; top: 0; background: var(--navy); color: #fff; text-align: left;
  padding: .55rem .5rem; font-weight: 600; white-space: nowrap; z-index: 5; }
#txTable thead th.num { text-align: right; }
#txTable tbody td { padding: .35rem .5rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
#txTable tbody tr:hover { background: #f8faff; }
#txTable tbody tr.in-sample { box-shadow: inset 3px 0 0 var(--accent); }
#txTable tbody tr.exc { background: var(--red-bg); }
#txTable tbody tr.vouched { background: var(--green-bg); }
.cbcol { width: 30px; text-align: center; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.desc { max-width: 260px; }
.supplier { max-width: 170px; }
.doccell { white-space: nowrap; }
td select, td input { width: 100%; padding: .3rem .4rem; font-size: .8rem; border: 1px solid var(--line); border-radius: 7px; }
.pill.key { background: #e0e7ff; color: #3730a3; }
.pill.rand { background: #d1fae5; color: #065f46; }
.pill.full { background: #e5e7eb; color: #374151; }
.vbadge { display: inline-block; padding: .1rem .4rem; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.vbadge.ok { background: var(--green-bg); color: var(--green); }
.vbadge.warn { background: var(--red-bg); color: var(--red); }
.empty { padding: 2rem; text-align: center; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-box { background: #fff; border-radius: 16px; padding: 1.5rem; width: min(520px, 94vw); box-shadow: 0 20px 45px rgba(16,24,40,.28); max-height: 92vh; overflow: auto; }
.modal-box.wide { width: min(760px, 96vw); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.modal-actions.left { justify-content: flex-start; align-items: center; }

/* ---- OCR result ---- */
.ocr-fields { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 .8rem; }
.chip { background: #f1f4fb; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; font-size: .82rem; }
.ocr-flags { display: grid; gap: .4rem; margin-bottom: .8rem; }
.flag { padding: .4rem .6rem; border-radius: 8px; font-size: .84rem; }
.flag.ok { background: var(--green-bg); color: var(--green); }
.flag.warn, .flag.error { background: var(--red-bg); color: var(--red); }
.ocr-text { background: #0f172a; color: #cbd5e1; padding: .8rem; border-radius: 10px; max-height: 240px;
  overflow: auto; font-size: .76rem; white-space: pre-wrap; word-break: break-word; }

/* ---- Workspace title block ---- */
.ws-title h1 { margin: 0; font-size: 2rem; border-left: 5px solid var(--navy); padding-left: .7rem; letter-spacing: -.5px; }
.ws-sub { margin: .35rem 0 0 .95rem; color: var(--muted); }
.ws-sub b { color: var(--green); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.dark:hover { background: #22304f; }
.btn.green { background: #1f7a4d; border-color: #1f7a4d; color: #fff; }
.btn.green:hover { background: #226f49; }
.btn.purple { background: #6b3fa0; border-color: #6b3fa0; color: #fff; }
.btn.purple:hover { background: #5d3790; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a2c07; }
.btn.gold:hover { background: #cf9a37; }
.btn.danger { background: #fff; border-color: #f0c4c4; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }

/* ---- Big export panel ---- */
.bigpanel { padding: 0; }
.sect { padding: 1rem 1.2rem; }
.bigpanel hr { border: none; border-top: 1px solid var(--line); margin: 0; }
.sect-label { font-size: .74rem; font-weight: 800; letter-spacing: .6px; color: var(--navy); }
.sect-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.badge { background: #eef2f9; color: #46506a; border: 1px solid var(--line); border-radius: 999px; padding: .18rem .6rem; font-size: .74rem; font-weight: 600; }
.badge.ok { background: var(--green-bg); color: var(--green); border-color: #bfe3c9; }
.inline-field { color: var(--muted); font-weight: 600; font-size: .82rem; display: flex; align-items: center; gap: .4rem; }
.inline-field select { padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.btnrow { display: flex; gap: .7rem; flex-wrap: wrap; margin: .3rem 0 .5rem; }
.acct-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.acct-row select { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }

/* ---- Dropzone ---- */
.dropzone { border: 2px dashed #c7cede; border-radius: 12px; background: #fafbfe; padding: 1.6rem; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #f0f5ff; }
.dz-title { font-weight: 700; color: var(--navy); }
.dz-sub { color: var(--muted); font-size: .84rem; margin-top: .3rem; }
.staged { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.staged-chip { background: #eef2f9; border: 1px solid var(--line); border-radius: 8px; padding: .3rem .6rem; font-size: .82rem; }
.scan-results { margin-top: .9rem; display: grid; gap: .3rem; }
.scan-summary { font-weight: 700; color: var(--navy); margin-bottom: .3rem; }
.scan-line { padding: .35rem .6rem; border-radius: 8px; font-size: .82rem; display: flex; justify-content: space-between; gap: 1rem; }
.scan-line.ok { background: var(--green-bg); }
.scan-line.warn { background: var(--amber-bg); }
.scan-line.bad { background: var(--red-bg); }

/* ---- Workspace toolbar ---- */
.ws-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.ws-toolbar input[type=search] { min-width: 260px; flex: 0 1 320px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.ws-toolbar select { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }
.ws-toolbar .count { color: var(--muted); font-size: .86rem; }
.ws-toolbar .count b { color: var(--navy); font-size: 1rem; }
.ws-toolbar .spacer { flex: 1; }
.twa { color: var(--green); font-weight: 700; font-size: .84rem; }
.mini-pills { display: flex; gap: .35rem; }
.mp { background: #eef2f9; color: #46506a; border-radius: 999px; padding: .1rem .5rem; font-size: .72rem; font-weight: 600; }
.mp.ok { background: var(--green-bg); color: var(--green); }
.mp.bad { background: var(--red-bg); color: var(--red); }

/* ---- Pager ---- */
.pager { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; color: var(--muted); font-size: .84rem; }
.pager .pinfo { margin-right: .4rem; }
.pbtn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .25rem .55rem; cursor: pointer; font: inherit; font-size: .82rem; }
.pbtn:hover:not(:disabled) { background: #f2f5fc; }
.pbtn:disabled { opacity: .45; cursor: default; }
.ppage { font-weight: 600; color: var(--navy); }

/* ---- Table extras ---- */
.docdot { color: var(--muted); }
.actcell { white-space: nowrap; }
.rowacts { display: flex; gap: .25rem; }
.rowacts .btn { padding: .18rem .45rem; font-size: .73rem; }
.rowacts .btn:disabled { opacity: .45; cursor: default; }
.type-pill { font-weight: 700; color: var(--navy); font-size: .78rem; }
.payee { max-width: 200px; }
.wht { font-size: .72rem; font-weight: 600; border-radius: 6px; padding: .05rem .35rem; }
.wht.ok { background: var(--green-bg); color: var(--green); }
.wht.warn { background: var(--amber-bg); color: #8a6d1f; }

/* ---- Bank rec ---- */
.recon-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; }
@media (max-width: 1000px) { .recon-grid { grid-template-columns: 1fr; } }

/* ---- Workspace split: table + side-by-side review ---- */
.ws-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.ws-body.split { grid-template-columns: minmax(0, 1fr) 460px; }
.ws-main { min-width: 0; }
@media (max-width: 1200px) { .ws-body.split { grid-template-columns: minmax(0, 1fr); } }

/* Large 2-pane overlay: document on the left, extracted fields on the right. */
.review-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 55; }
.review-aside { position: fixed; inset: 3vh 3vw; z-index: 56; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(16,24,40,.3);
  display: flex; flex-direction: column; overflow: hidden; }
.aside-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fff; }
.aside-head b { color: var(--navy); margin-right: .4rem; }
.aside-body { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; min-height: 0; }
.aside-body.no-doc { grid-template-columns: 1fr; }
.aside-doc { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.aside-doc .doc-toolbar { flex: none; }
.aside-view { flex: 1; height: auto; min-height: 0; background: #f1f3f8; }
.aside-form { overflow: auto; padding: 1rem 1.2rem; }
.aside-form .field { margin: .55rem 0; }
.aside-form .row2 { gap: .8rem; }
.acct-hint { display: block; margin-top: .3rem; }
.acct-hint .hint-ok { color: var(--green); }
.acct-hint .btn.tiny { margin-left: .2rem; }
@media (max-width: 900px) {
  .review-aside { inset: 0; border-radius: 0; }
  .aside-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .aside-doc { border-right: none; border-bottom: 1px solid var(--line); }
  .aside-view { min-height: 240px; }
}
#txTable tbody tr.reviewing { background: #eef3ff; box-shadow: inset 3px 0 0 var(--navy); }

/* ---- Document review ---- */
.review-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 1000px) { .review-split { grid-template-columns: 1fr; } }
.doc-pane { padding: 0; overflow: hidden; }
.doc-toolbar { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.doc-tools { display: flex; align-items: center; gap: .4rem; }
.doc-tools #zoomLevel { font-size: .8rem; color: var(--muted); min-width: 42px; text-align: center; }
.doc-view { height: 640px; overflow: auto; background: #f1f3f8; display: flex; align-items: flex-start; justify-content: center; padding: 1rem; }
.doc-view img { max-width: 100%; transform-origin: top center; transition: transform .12s; box-shadow: var(--shadow); background: #fff; }
.doc-pagenav { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .5rem; border-top: 1px solid var(--line); }

.form-pane { display: flex; flex-direction: column; }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.form-head .form-nav { display: flex; align-items: center; gap: .5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1rem; }
.form-grid .field { margin: .3rem 0; }
.form-grid .field.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { margin-top: .25rem; }
.form-grid .field .small { display: block; margin-top: .25rem; color: #a06a1f; }
.form-actions { display: flex; align-items: center; gap: .8rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---- Ask AI ---- */
.askai-fab { position: fixed; bottom: 1.4rem; right: 1.4rem; background: var(--navy); color: #fff; border: none;
  border-radius: 999px; padding: .7rem 1.1rem; font-weight: 700; cursor: pointer; box-shadow: 0 8px 24px rgba(16,24,40,.25); z-index: 40; }
.askai-fab:hover { background: #22304f; }
.askai-panel { position: fixed; bottom: 1.4rem; right: 1.4rem; width: min(380px, 92vw); height: 460px; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px rgba(16,24,40,.28); z-index: 41; display: flex; flex-direction: column; }
.askai-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); font-weight: 800; color: var(--navy); }
.askai-log { flex: 1; overflow: auto; padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }
.ai-msg { padding: .5rem .7rem; border-radius: 12px; font-size: .86rem; max-width: 90%; }
.ai-msg.bot { background: #f1f4fb; align-self: flex-start; }
.ai-msg.user { background: var(--navy); color: #fff; align-self: flex-end; }
.ai-note { font-size: .72rem; color: var(--muted); margin-top: .3rem; }
.askai-input { display: flex; gap: .4rem; padding: .7rem; border-top: 1px solid var(--line); }
.askai-input input { flex: 1; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--navy);
  color: #fff; padding: .7rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 60; font-weight: 500; max-width: 90vw; }
.toast.err { background: var(--red); }

@media (max-width: 1300px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .start-grid { grid-template-columns: 1fr; gap: 1.6rem; } .cards { grid-template-columns: repeat(2, 1fr); } }
