/* RIBPL Portal – one stylesheet, no external assets */
:root {
  /* Brand: RIBPL red is the logo colour and is kept for accents and warnings only.
     The working colours are navy (primary), blue (links), teal (RFQ), violet (leads) and gold (premium). */
  --red: #CC2733; --red-deep: #A3222D; --red-tint: #FBEEEF;
  --navy: #0F2D52; --navy-deep: #0A1F3A; --navy-tint: #E8EEF7; --blue: #1F5FA8; --teal: #0E7C86; --teal-tint: #E2F3F4;
  --violet: #5B4B9E; --violet-tint: #EEEBF8; --gold: #B07D1F; --gold-tint: #FBF3E2;
  --ink: #1C2533; --grey: #5D6573; --muted: #8A919C; --line: #D9DEE6; --line-soft: #EBEEF3;
  --paper: #FFFFFF; --bg: #F3F5F9;
  --amber: #A86B12; --amber-bg: #FDF5E6; --green: #2F7A4D; --green-bg: #EAF5EE; --slate: #5B6475; --slate-bg: #EEF0F4;
  --focus: #1D5FD6;
  --r: 6px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--grey); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── Top bar ─────────────────────────────────────────── */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--red) 0 14%, var(--navy) 14% 72%, var(--teal) 72% 86%, var(--gold) 86%); }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 28px; }
.brand img { height: 34px; display: block; }
.nav { display: flex; gap: 4px; height: 100%; }
.nav a { display: flex; align-items: center; padding: 0 14px; color: var(--grey); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -3px; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--navy); border-bottom-color: var(--navy); }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who .name { text-align: right; line-height: 1.2; }
.who .name b { display: block; font-weight: 600; }
.who .name span { font-size: 12px; color: var(--grey); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid;
  place-items: center; font-weight: 700; font-size: 13px; }
.subnav { background: var(--paper); border-bottom: 1px solid var(--line); }
.subnav-in { max-width: 1320px; margin: 0 auto; padding: 0 20px; display: flex; gap: 2px; overflow-x: auto; }
.subnav a { padding: 10px 12px; color: var(--grey); text-decoration: none; white-space: nowrap; font-size: 13.5px; }
.subnav a.on { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.subnav .grow { flex: 1; }
.menu-btn { display: none; }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--grey); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons & forms ─────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 600 13.5px var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #BFC1C7; color: var(--ink); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }
.btn.danger { color: var(--red-deep); border-color: #E7B8BC; }
.btn.danger:hover { background: var(--red-tint); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input:not([type]), input[type=text], input[type=tel], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: #fff;
  font: 14px var(--font); color: var(--ink); font-variant-numeric: tabular-nums; }
textarea { height: auto; min-height: 70px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid rgba(29,95,214,.15); outline-offset: 0; }
input[readonly] { background: var(--bg); color: var(--grey); }
.field { margin-bottom: 14px; min-width: 0; }
.field.err input, .field.err select, .field.err textarea { border-color: var(--red); background: #FFF8F8; }
.field .msg { color: var(--red-deep); font-size: 12px; margin-top: 3px; }
.grid { display: grid; gap: 0 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg label { margin: 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 14px; cursor: pointer; background: #fff; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ── Panels ─────────────────────────────────────────── */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; }
.panel > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.panel > header h2 { margin: 0; font-size: 15px; }
.panel > header .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel > .body { padding: 16px; }
.panel.flush > .body { padding: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.section-title { font-size: 15px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-title .n { color: var(--teal); font-weight: 700; }

/* ── Flash ─────────────────────────────────────────── */
.flashes { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--r); border: 1px solid; background: #fff; }
.flash.ok { border-color: #B9DCC6; background: var(--green-bg); color: #1F5535; }
.flash.error { border-color: #EBC0C3; background: #FDF1F2; color: var(--red-deep); }
.flash.warn { border-color: #F0D9AE; background: var(--amber-bg); color: #7A4E0E; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
.t th, .t td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.t thead th { font-size: 12.5px; color: var(--grey); font-weight: 600; background: #FAFAFB; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; }
.t th a { color: inherit; text-decoration: none; }
.t th a.sorted { color: var(--ink); }
.t tbody tr:hover { background: #FAFAFB; }
.t td.num, .t th.num { text-align: right; white-space: nowrap; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: #FAFAFB; }
.t .code { font-weight: 600; white-space: nowrap; }
.t.compact td, .t.compact th { padding: 6px 8px; }
.empty { padding: 40px 16px; text-align: center; color: var(--grey); }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.Outstanding, .tag.Scheduled { background: var(--amber-bg); color: var(--amber); }
.tag.Paid, .tag.Won { background: var(--green-bg); color: var(--green); }
.tag.Closed, .tag.Lost, .tag.Draft { background: var(--slate-bg); color: var(--slate); }
.tag.Overdue { background: #FBE7E9; color: var(--red-deep); }
.tag.Due-in-3-days { background: var(--amber-bg); color: var(--amber); }
.tag.No-follow-up-set { background: #fff; color: var(--grey); border: 1px dashed #C6C7CC; }
.tag.Sent { background: #E8EFFB; color: #1E4FA8; }
.tag.role-admin { background: var(--navy-tint); color: var(--navy); }
.tag.role-officer { background: #E8EFFB; color: #1E4FA8; }
.tag.role-viewer { background: var(--slate-bg); color: var(--slate); }

/* ── Ledger strip (key figures) ─────────────────────── */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 18px; }
.ledger a, .ledger div.cell { display: block; padding: 14px 16px; border-right: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.ledger a:hover { background: #FAFAFB; }
.ledger .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.ledger .l { font-size: 12.5px; color: var(--grey); }
.ledger .v.red { color: var(--red-deep); }
.ledger .v.amber { color: var(--amber); }
.ledger .v.green { color: var(--green); }

.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; display: flex; }
.bar .fill { height: 100%; background: var(--grey); }
.bar .fill.Outstanding { background: #D59A3A; } .bar .fill.Paid { background: #4E9A6B; } .bar .fill.Closed { background: #8B93A3; }
.bar .fill.Overdue { background: var(--red); } .bar .fill.Due { background: #D59A3A; } .bar .fill.None { background: #B9BBC1; }
.bar .fill.Scheduled { background: #4E9A6B; }
.bar .n { text-align: right; font-weight: 600; }
.bar a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar a:hover { color: var(--navy); text-decoration: underline; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--grey); margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.cols3 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.cols > *, .cols3 > *, .rfq-layout > * { min-width: 0; }

/* ── Filters ─────────────────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.filters .f { min-width: 140px; flex: 1; max-width: 220px; }
.filters .f.wide { max-width: 320px; flex: 2; }
.filters label { font-size: 12px; color: var(--grey); font-weight: 600; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 16px; color: var(--grey); }

/* ── Home ─────────────────────────────────────────── */
.choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 8px; }
.choice { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 26px 26px 22px; text-decoration: none; color: var(--ink); position: relative; overflow: hidden; min-height: 230px; }
.choice::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--mod, var(--navy)); }
.choice:hover { border-color: #C9CACF; box-shadow: 0 6px 24px -14px rgba(37,38,42,.35); color: var(--ink); }
.choice h2 { font-size: 22px; margin-bottom: 6px; }
.choice p { color: var(--grey); max-width: 46ch; }
.choice .facts { margin-top: auto; display: flex; gap: 26px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.choice .facts b { display: block; font-size: 20px; }
.choice .facts span { font-size: 12.5px; color: var(--grey); }
.choice .go { position: absolute; top: 24px; right: 24px; }
.greet { margin: 6px 0 18px; }
.greet h1 { font-size: 24px; }

/* ── Login ─────────────────────────────────────────── */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: #fff; }
.login-side { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 70%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end;
  position: relative; overflow: hidden; }
.login-side::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%;
  border: 60px solid rgba(255,255,255,.06); }
.login-side h2 { font-size: 30px; font-weight: 600; max-width: 18ch; line-height: 1.2; letter-spacing: -.02em; }
.login-side p { opacity: .85; max-width: 44ch; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .logo { height: 46px; margin-bottom: 36px; }
.login-box h1 { font-size: 22px; }
.login-box .lead { color: var(--grey); margin-bottom: 22px; }
.phone-in { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.phone-in span { padding: 0 12px; display: grid; place-items: center; background: var(--bg); color: var(--grey); border-right: 1px solid var(--line); }
.phone-in input { border: 0; height: 44px; font-size: 17px; letter-spacing: .04em; }
.otp-in { height: 52px !important; font-size: 26px !important; letter-spacing: .5em; text-align: center; }
.login-box .btn { width: 100%; justify-content: center; height: 44px; font-size: 15px; margin-top: 6px; }
.login-foot { margin-top: 26px; font-size: 12.5px; color: var(--muted); }

/* ── Claim detail ───────────────────────────────────── */
.kv { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px 18px; }
.kv div span { display: block; font-size: 12px; color: var(--grey); }
.kv div b { font-weight: 600; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.timeline li:last-child { border-bottom: 0; }
.timeline .date { font-weight: 600; }
.timeline .date small { display: block; font-weight: 400; }
.timeline .what b { font-weight: 600; }
.timeline .status-change { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; font-size: 13px; }
.timeline .rem { margin-top: 3px; white-space: pre-wrap; }
.timeline .meta { color: var(--grey); font-size: 12.5px; margin-top: 3px; }
.timeline details summary { cursor: pointer; color: var(--blue); font-size: 12.5px; }
.timeline details form { margin-top: 10px; }
.danger-zone { border-color: #EBC0C3; }
.danger-zone > header { background: #FDF6F6; }
details.edit > summary { list-style: none; cursor: pointer; }
details.edit > summary::-webkit-details-marker { display: none; }

/* ── RFQ form ─────────────────────────────────────── */
.rfq-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.rfq-aside { position: sticky; top: 80px; }
.auto { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--r); padding: 7px 10px; min-height: 36px; color: var(--ink); }
.auto.none { color: var(--muted); }
.ac { position: relative; }
.ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); max-height: 300px; overflow: auto; box-shadow: 0 10px 30px -12px rgba(37,38,42,.35); }
.ac-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; font: 13px var(--font); cursor: pointer; }
.ac-list button small { display: block; color: var(--grey); }
.ac-list button:hover, .ac-list button.on { background: var(--navy-tint); }
.loc-row { border: 1px solid var(--line-soft); border-radius: var(--r); padding: 12px 12px 0; margin-bottom: 12px; background: #FCFCFD; }
.loc-row h4 { margin: 0 0 10px; font-size: 13.5px; }

/* The policy schedule – premium table used on screen (RFQ) */
.schedule { width: 100%; border-collapse: collapse; font-size: 13px; }
.schedule td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.schedule td.num { text-align: right; white-space: nowrap; }
.schedule td.sec { color: var(--teal); font-weight: 600; white-space: nowrap; width: 1%; }
.schedule tr.sub td { background: #FAFAFB; font-weight: 600; }
.schedule tr.net td { background: var(--navy-tint); font-weight: 700; color: var(--navy); }
.schedule tr.grand td { background: var(--navy); color: #fff; font-weight: 700; font-size: 15px; padding: 10px; border: 0; }
.schedule tr.zero td { color: var(--muted); }
.premium-card .total { padding: 16px; background: linear-gradient(135deg, var(--navy) 0%, #1B4C80 100%); color: #fff; border-radius: var(--r) var(--r) 0 0; }
.premium-card .total span { font-size: 12.5px; opacity: .85; display: block; }
.premium-card .total b { font-size: 28px; letter-spacing: -.02em; }
.premium-card .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.premium-card .facts span { color: var(--grey); display: block; font-size: 12px; }
.warnings { padding: 10px 16px; background: var(--amber-bg); color: #7A4E0E; font-size: 12.5px; }
.warnings p { margin: 0; }

/* RFQ document view */
.doc { background: #fff; border: 1px solid var(--line); max-width: 900px; margin: 0 auto; padding: 36px 44px; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; min-height: 60px; }
.doc-head img.ins { max-height: 64px; max-width: 220px; }
.doc-head img.rib { height: 44px; }
.doc h1 { text-align: center; color: var(--navy); font-size: 24px; margin: 6px 0 2px; letter-spacing: .02em; }
.doc .ptype { text-align: center; color: var(--grey); font-weight: 600; margin-bottom: 16px; }
.doc .refline { display: flex; justify-content: space-between; background: var(--bg); border: 1px solid var(--line); padding: 8px 12px; margin-bottom: 18px; }
.doc h2 { background: var(--navy); color: #fff; border-left: 4px solid var(--red); font-size: 13.5px; padding: 6px 10px; margin: 18px 0 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc td, .doc th { border: 1px solid #DADBDF; padding: 6px 9px; vertical-align: top; text-align: left; }
.doc th { background: #FAF6F6; font-weight: 600; }
.doc td.k { width: 32%; background: #FAF6F6; font-weight: 600; }
.doc td.num, .doc th.num { text-align: right; white-space: nowrap; }
.doc .pre { white-space: pre-line; }
.doc .small { font-size: 12px; }
.doc tr.sub td { background: #FAF6F6; font-weight: 600; }
.doc tr.grand td { background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; }
.doc table.prep { margin: -8px 0 6px; }
.doc .foot { margin-top: 24px; padding-top: 10px; border-top: 2px solid var(--red); display: flex; justify-content: space-between; gap: 16px; color: var(--grey); font-size: 12px; line-height: 1.5; }
.doc-bar { max-width: 900px; margin: 0 auto 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-bar .grow { flex: 1; }
.revs { max-width: 900px; margin: 14px auto 0; }

/* Admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.admin-grid a { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; color: var(--ink); }
.admin-grid a:hover { border-color: #C9CACF; }
.admin-grid a b { display: block; margin-bottom: 3px; }
.admin-grid a span { color: var(--grey); font-size: 13px; }
.logo-cell { width: 120px; height: 46px; display: flex; align-items: center; }
.logo-cell img { max-width: 110px; max-height: 42px; }
code.f { font: 13px Consolas, "Courier New", monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
input.f { font: 13px Consolas, "Courier New", monospace; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 90px; }

/* Responsive */
@media (max-width: 1100px) {
  .rfq-layout { grid-template-columns: 1fr; }
  .rfq-aside { position: static; }
  .kv { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cols3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cols, .choose { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .topbar-in { gap: 14px; padding: 0 16px; }
  .nav a { padding: 0 8px; }
  .who .name { display: none; }
  .doc { padding: 20px 16px; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  main { padding: 16px 16px 40px; }
  .brand img { height: 26px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; height: 52px; background: #fff; border-top: 1px solid var(--line); justify-content: space-around; z-index: 30; }
  .nav a { border-bottom: 0; border-top: 3px solid transparent; margin: 0; }
  .nav a.on { border-top-color: var(--navy); }
  body { padding-bottom: 52px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .kv { grid-template-columns: 1fr 1fr; }
  .filters .f { max-width: none; min-width: 45%; }
  .subnav form[role=search] { display: none !important; }
  .doc { overflow-x: auto; }
  .doc table { min-width: 520px; }
  .doc-head img.ins { max-width: 120px; } .doc-head img.rib { height: 30px; }
  .doc .refline { flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Print (RFQ document) */
@media print {
  body { background: #fff; }
  .topbar, .subnav, .doc-bar, .revs, .flashes, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; max-width: none; }
  .doc h2 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc tr.grand td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.si-table input, .si-table select { height: 32px; }
.si-table tr.err input { border-color: var(--red); }

/* multi-product RFQ */
.prod-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 18px; }
.prod-list { display: grid; gap: 10px; }
.prod { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.prod:last-child { border-bottom: 0; padding-bottom: 0; }
.prod-name { font-weight: 600; text-decoration: none; color: var(--ink); }
.prod-name:hover { color: var(--navy); text-decoration: underline; }
.prod-fmt { font-size: 12.5px; color: var(--grey); white-space: nowrap; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks .check { margin: 0; font-weight: 400; }
.gtable input { height: 32px; min-width: 90px; }
.gtable td { padding: 4px; }
.ai-filled input, .ai-filled select, .ai-filled textarea, .ai-filled .seg { background: #F2F7FF; border-color: #8FB3EE; }
.ai-tag { display: inline-block; font-size: 10.5px; font-weight: 700; color: #1E4FA8; background: #E8EFFB; border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.ai-box { background: #F7F9FD; border: 1px dashed #B8CBEA; border-radius: var(--r); padding: 10px 12px; margin: -4px 0 14px; }
.ai-panel header h2::before { content: "✦ "; color: #1E4FA8; }

/* Send to insurers / follow-ups */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ins-block { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--paper); min-width: 0; }
.ins-block[hidden] { display: none; }
.ins-name { font-weight: 700; margin-bottom: 4px; }
.ins-block .check { align-items: flex-start; font-weight: 400; margin: 4px 0; }
.ins-block .check input { margin-top: 3px; flex: none; }
.send-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 24px; }
.send-bar .muted { flex: 1 1 260px; }
.btn.wa { background: #1F8F4E; border-color: #1F8F4E; color: #fff; }
.btn.wa:hover { background: #18773F; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.nowrap { white-space: nowrap; }
details.act { display: inline-block; position: relative; }
details.act > summary { list-style: none; display: inline-flex; }
details.act > summary::-webkit-details-marker { display: none; }
details.act[open] > form, details.act[open] > form + form { white-space: normal; }
details.act[open] { display: block; margin-top: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); min-width: 260px; }
.stack { display: grid; gap: 6px; margin: 6px 0; }
.stack label { display: grid; gap: 2px; font-size: 12.5px; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
tr.sublog td { padding-top: 0; border-top: 0; font-size: 12.5px; }
tr.sublog ul { margin: 4px 0; padding-left: 18px; }
.fu-quick { display: inline-flex; gap: 4px; margin-left: 4px; }
.tag.Awaiting-quote { background: var(--amber-bg); color: var(--amber); }
.tag.Quote-received { background: var(--green-bg); color: var(--green); }
.tag.Declined { background: var(--slate-bg); color: var(--slate); }
.contact-row { display: grid; grid-template-columns: 1.4fr 1.2fr 1.6fr 1fr 1fr 1.2fr auto auto; gap: 6px; align-items: center; }
.contact-row > * { min-width: 0; }
@media (max-width: 900px) { .contact-row { grid-template-columns: 1fr 1fr; } }
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hub a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--ink); text-decoration: none; }
.hub a:hover { border-color: var(--navy); box-shadow: 0 2px 8px rgba(15,45,82,.08); }
.hub a b { display: block; font-size: 15px; margin-bottom: 4px; }
.hub a span { color: var(--grey); font-size: 13px; }
.sec-h { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--grey); margin: 22px 0 8px; }
.field .lbl { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }

/* Leads */
.pre { white-space: pre-wrap; }
.timeline.lt li { display: block; padding: 10px 16px; }
.timeline.lt .when { font-size: 12px; color: var(--grey); }
.pipe { display: flex; gap: 6px; margin: 0 0 16px; flex-wrap: wrap; }
.pipe-step { flex: 1 1 120px; display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper);
  color: var(--ink); text-decoration: none; min-width: 0; }
.pipe-step b { display: block; font-size: 22px; line-height: 1.1; }
.pipe-step span { font-size: 12.5px; color: var(--grey); }
a.pipe-step:hover { border-color: var(--navy); }
.pipe-step.on { border-color: var(--navy); box-shadow: inset 0 -3px 0 var(--teal); }
.pipe.small .pipe-step { padding: 6px 10px; text-align: center; }
.pipe.small .pipe-step.done { background: var(--green-bg); }
.pipe.small .pipe-step.done span { color: var(--green); }
.pipe.small .pipe-step.on span { color: var(--ink); font-weight: 700; }
.pipe-step.Lost.on { background: var(--slate-bg); }
.tag.New { background: #E8EFFB; color: #1E4FA8; }
.tag.Quote-sent { background: var(--amber-bg); color: var(--amber); }
.tag.Changes-needed { background: #FBE7E9; color: var(--red-deep); }
.tag.Converted { background: #E6F4F1; color: #136B5B; }
.tag.Policy-issued { background: var(--green-bg); color: var(--green); }
.tag.Lost { background: var(--slate-bg); color: var(--slate); }
@media (max-width: 700px) { .kv { grid-template-columns: repeat(2, minmax(0,1fr)); } .pipe-step { flex-basis: 30%; } }
.rfq-aside { max-height: calc(100vh - 96px); overflow-y: auto; }
.gprem details { border-bottom: 1px solid var(--line-soft); padding: 4px 0; }
.gprem summary { display: flex; justify-content: space-between; cursor: pointer; font-size: 13px; }
.gprem .t td { font-size: 12.5px; }
.gprem tr.sub td { border-top: 1px solid var(--line); }
.gprem .premium-card .total { border-radius: var(--r); margin-top: 8px; }
.gprem .premium-card .total b { font-size: 22px; }
@media (max-width: 900px) { .rfq-aside { position: static; max-height: none; } }
.period-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-form label { font-size: 13px; font-weight: 600; margin: 0; }
.period-form input { width: auto; }
.period-form { margin-left: auto; }
.row input:not([type=checkbox]):not([type=radio]), .row select { width: auto; max-width: 100%; }
.row label { margin: 0; }

/* Ask AI – on every page */
.ai-fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 22px; border: 0; background: var(--navy); color: #fff; font: 600 14px var(--font);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
.ai-fab:hover, .ai-fab:focus-visible { background: var(--navy-deep); outline: none; }
.ai-dot { width: 10px; height: 10px; border-radius: 50%; background: #3DD6C6; box-shadow: 0 0 0 3px rgba(61,214,198,.3); }
.ai-drawer { position: fixed; right: 18px; bottom: 74px; z-index: 61; width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 160px);
  display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.2); }
.ai-drawer[hidden] { display: none; }
.ai-drawer header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.ai-drawer header .hint { flex: 1; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 10px; font: 500 12.5px var(--font); color: var(--ink); cursor: pointer; text-align: left; }
.chip:hover, .chip:focus-visible { border-color: var(--navy); background: var(--navy-tint); outline: none; }
.ai-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: grid; gap: 10px; align-content: start; min-height: 60px; }
.ai-msg { padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; }
.ai-msg.q { background: var(--bg); justify-self: end; max-width: 90%; }
.ai-msg.a { background: #fff; border: 1px solid var(--line-soft); }
.ai-msg.err { background: #FDF1F2; color: var(--red-deep); }
.ai-msg .copy { display: block; margin-top: 6px; }
.ai-form { padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
.ai-form textarea { width: 100%; resize: vertical; }
@media print { .ai-fab, .ai-drawer { display: none !important; } }


/* ── Colour system: navy subnav, module colours, calmer panels ── */
.subnav { background: var(--navy); border-bottom: 0; }
.subnav a { color: #C9D5E6; }
.subnav a:hover { color: #fff; }
.subnav a.on { color: #fff; font-weight: 600; box-shadow: inset 0 -3px 0 var(--gold); }
.panel > header h2 { color: var(--navy); }
.page-head h1 { color: var(--navy); }
.choice.m-claims { --mod: var(--blue); } .choice.m-rfq { --mod: var(--teal); } .choice.m-leads { --mod: var(--violet); }
.choice.m-claims .btn.primary { background: var(--blue); border-color: var(--blue); }
.choice.m-rfq .btn.primary { background: var(--teal); border-color: var(--teal); }
.choice.m-leads .btn.primary { background: var(--violet); border-color: var(--violet); }
.ledger a, .ledger div.cell { border-top: 3px solid transparent; }
.ledger > :nth-child(5n+1) { border-top-color: var(--navy); } .ledger > :nth-child(5n+2) { border-top-color: var(--blue); }
.ledger > :nth-child(5n+3) { border-top-color: var(--teal); } .ledger > :nth-child(5n+4) { border-top-color: var(--violet); }
.ledger > :nth-child(5n+5) { border-top-color: var(--gold); }
.pipe-step.New b { color: var(--blue); } .pipe-step.Quote-sent b { color: var(--gold); } .pipe-step.Changes-needed b { color: var(--red-deep); }
.pipe-step.Converted b { color: var(--teal); } .pipe-step.Policy-issued b { color: #2F7A4D; } .pipe-step.Lost b { color: var(--slate); }
.premium-card .total b { color: #fff; } .premium-card .total span { color: #CFE0F5; }
.gprem .premium-card .total { background: linear-gradient(135deg, var(--teal) 0%, var(--navy) 100%); }
.sec-h { color: var(--teal); }
.tag.Sent { background: var(--navy-tint); color: var(--navy); }
.ai-panel { border-top: 3px solid var(--teal); }
.num-badge { color: var(--teal); }
.demo-ribbon { background: var(--gold-tint); color: #6B4B10; border-bottom: 1px solid #EAD8AE; text-align: center; font-size: 12.5px; font-weight: 600; padding: 5px 12px; }

.rights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }

.auto-in { background: var(--bg-soft, #F3F6FA) !important; color: var(--ink-2, #33415C); font-weight: 600; cursor: default; }
td.ac { position: relative; }
