/* FinChat Hub provider dashboard. Mobile first; sidebar becomes a menu under 900px. */
:root {
  --ink: #111315; --muted: #5d6267; --line: #e4e6e8; --bg: #f6f7f8; --card: #fff;
  --red: #d90000; --red-hover: #b80000; --red-tint: #fdecec;
  --ok: #17663f; --ok-tint: #e6f4ec; --warn: #8a5a00; --warn-tint: #fbf1dc; --info: #1f4f8a; --info-tint: #e8f0fa;
  --radius: 10px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--red); }
a:hover { color: var(--red-hover); }
h1, h2 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
h2 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; max-width: 75ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover { background: var(--red-hover); border-color: var(--red-hover); color: #fff; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--red); font: inherit; cursor: pointer; text-decoration: underline; }
.form { display: grid; gap: 6px; }
.form label, .filters label { font-weight: 600; font-size: 13px; margin-top: 6px; }
.form .btn { margin-top: 10px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #c9cdd1; border-radius: 8px; font: 15px var(--font); color: var(--ink); background: #fff; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); outline: 2px solid var(--red-tint); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 14px; }
.check input { width: auto; min-height: 0; }
details summary { cursor: pointer; font-weight: 600; margin-top: 12px; color: var(--muted); }
details[open] summary { color: var(--ink); }

/* Messages */
.flash, .banner { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 16px; font-weight: 500; }
.flash--ok { background: var(--ok-tint); color: var(--ok); }
.flash--err { background: var(--red-tint); color: #8f0000; }
.banner--warn { background: var(--warn-tint); color: var(--warn); }
.banner--info { background: var(--info-tint); color: var(--info); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.banner select { width: auto; min-height: 34px; }
.note, .consent { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 13px; }

/* Sign-in pages */
.is-bare { background: #fff; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); }
.auth__box { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.auth__box h1 { font-size: 22px; }
.auth__alt { font-size: 14px; }
.auth__fine { font-size: 13px; color: var(--muted); margin-top: 18px; }

/* App shell */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.brand img { border-radius: 8px; }
.brand small { font-weight: 600; color: var(--muted); letter-spacing: 0; }
.app { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: 250px; background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; transform: translateX(-100%); transition: transform .2s; z-index: 30; overflow-y: auto; }
.side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(17, 19, 21, .35); }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side nav a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--bg); }
.side nav a[aria-current="page"] { background: var(--red-tint); color: #8f0000; font-weight: 700; }
.count { background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; }
.side__who { margin-top: auto; display: grid; gap: 4px; font-size: 13px; padding: 12px; background: var(--bg); border-radius: 8px; }
.side__who span { color: var(--muted); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line); }
.menu { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font: 600 14px var(--font); }
.top__org { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 20px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); max-width: 1180px; display: grid; gap: 18px; align-content: start; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.head > p { flex-basis: 100%; }
.crumbs { font-size: 13px; color: var(--muted); }
.period { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.period select { width: auto; }
@media (min-width: 900px) {
  .side { transform: none; }
  .main { margin-left: 250px; }
  .top { display: none; }
  .content { padding-top: 28px; }
}

/* Cards, KPIs, grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.card--act { background: #fff; }
.narrow { max-width: 520px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.kpis .sh { grid-column: 1 / -1; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi { display: grid; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); }
a.kpi:hover { border-color: var(--red); color: var(--ink); }
.kpi span { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { color: var(--ink); text-decoration: none; }
.list a:hover b { color: var(--red); }
.late { color: #8f0000; font-weight: 600; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.empty { background: #fff; border: 1px dashed #c9cdd1; border-radius: var(--radius); padding: 28px; text-align: center; display: grid; gap: 6px; }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f2; color: var(--ink); white-space: nowrap; vertical-align: middle; }
.pill--new { background: var(--red-tint); color: #8f0000; }
.pill--accepted, .pill--contacted, .pill--qualified, .pill--application_started, .pill--active, .pill--paid { background: var(--ok-tint); color: var(--ok); }
.pill--contact_attempted, .pill--pending, .pill--partial, .pill--sent { background: var(--warn-tint); color: var(--warn); }
.pill--completed { background: #dff3e7; color: #0e4a2c; }
.pill--rejected, .pill--overdue, .pill--past_due, .pill--suspended { background: var(--red-tint); color: #8f0000; }
.pill--closed, .pill--cancelled, .pill--void { background: #eef0f2; color: var(--muted); }

/* Tables */
.tablewrap { overflow-x: auto; min-width: 0; }
.table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td small { display: block; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ref { font-weight: 700; color: var(--ink); white-space: nowrap; }
.count-line { font-size: 13px; }
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); align-items: end; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.filters > div { display: grid; gap: 4px; }
.filters__act { display: flex; gap: 8px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; }
.pager a, .pager span { min-width: 38px; min-height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; color: var(--ink); }
.pager span { background: var(--ink); color: #fff; }

/* Lead detail */
.lead { display: grid; gap: 16px; }
.lead__main, .lead__side { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1000px) { .lead { grid-template-columns: minmax(0, 1fr) 340px; } .lead__side { position: sticky; top: 20px; } }
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.timeline time { font-size: 12px; color: var(--muted); }
.timeline small { color: var(--muted); }

/* Pipeline */
.board { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); overflow-x: auto; padding-bottom: 8px; }
.col { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; align-content: start; }
.col h2 { font-size: 14px; display: flex; justify-content: space-between; }
.col h2 span { color: var(--muted); }
.tile { display: grid; gap: 2px; padding: 10px; border-radius: 8px; background: var(--bg); text-decoration: none; color: var(--ink); font-size: 13px; }
.tile:hover { background: var(--red-tint); color: var(--ink); }
.tile small { color: var(--muted); }
.more { font-size: 13px; }

/* Bars */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 4px 10px; font-size: 14px; }
.bars span { grid-column: 1 / -1; }
.bars i { display: block; height: 8px; border-radius: 4px; background: var(--red-tint); position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--red); border-radius: 4px; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; margin-top: -6px; }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
.crit { white-space: pre-line; background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.sh3 { font-size: 14px; font-weight: 700; margin: 6px 0 0; }
