/* StrataFlow Portal (self-managed OCs) — matches the strataflow.work palette (light, Inter, blue accent). */
:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --surface-2: #FAFBFC; --ink: #111418; --ink-2: #2A2E35; --muted: #565B63;
  --hair: rgba(0,0,0,.09); --hair-2: rgba(0,0,0,.055);
  --primary: #2563EB; --primary-d: #1D4ED8; --primary-soft: #EEF3FE;
  --green: #047857; --green-soft: #E7F7F0; --amber: #92400E; --amber-soft: #FEF5E6; --red: #B42318; --red-soft: #FDEEEC; --grey-soft: #F0F1F3;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; } .strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; } .neg { color: var(--red); } .red { color: var(--red); } .ok { color: var(--green); }
.pre { white-space: pre-wrap; } .grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; } .row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; margin-top: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; align-items: start; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--hair); display: flex; flex-direction: column; padding: 16px 12px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 700; font-size: 16px; padding: 4px 8px; }
.brand.big { font-size: 20px; padding: 0; margin-bottom: 20px; }
.brand-tag { white-space: nowrap; font-weight: 500; font-size: 11px; color: var(--muted); border: 1px solid var(--hair); border-radius: 99px; padding: 1px 8px; }
.logo { display: block; width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand-accent { color: var(--primary); }
.oc-switch { text-align: left; border: 1px solid var(--hair); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; font: inherit; color: inherit; }
.oc-switch span { font-size: 12px; color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav:hover { background: var(--grey-soft); text-decoration: none; }
.nav.on { background: var(--primary-soft); color: var(--primary-d); }
.nav .dot { margin-left: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side-f { margin-top: auto; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 8px; border-top: 1px solid var(--hair-2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 40px; max-width: 1180px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.foot { padding: 0 32px 28px; max-width: 1180px; }
.demo-banner { background: var(--amber-soft); color: #7A3F06; padding: 8px 32px; font-size: 13px; border-bottom: 1px solid #F6E0BC; }

/* ---------- page parts */
.ph { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.ph h1 { font-size: 26px; font-weight: 700; }
.ph-sub { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.ph-a { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card .card { box-shadow: none; margin-top: 12px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair-2); }
.card-h h2 { font-size: 15px; font-weight: 600; }
.card-b { padding: 16px 18px; }
.card-b > p:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-l { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-v { font-size: 24px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-s { color: var(--muted); font-size: 12px; }
.stat-green .stat-v { color: var(--green); } .stat-amber .stat-v { color: var(--amber); } .stat-red .stat-v { color: var(--red); }
.callout { background: var(--primary-soft); border: 1px solid #D5E2FC; border-radius: 10px; padding: 10px 14px; color: #1E3A8A; }
.empty { text-align: center; padding: 32px 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty strong { color: var(--ink); font-size: 15px; } .empty p { margin: 0; max-width: 520px; }
.ref { display: inline-block; font-size: 11px; font-weight: 600; color: #4B5563; background: var(--grey-soft); border-radius: 6px; padding: 0 6px; margin: 0 2px; white-space: nowrap; }

/* ---------- controls */
.btn { font: inherit; font-weight: 600; font-size: 13px; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--hair); cursor: pointer; background: var(--surface); color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--grey-soft); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-d); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; } .btn-danger:hover { background: #A52C23; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.inp { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #8A9099; border-radius: 8px; background: #fff; color: var(--ink); }
.inp:focus { outline: 3px solid rgba(37,99,235,.35); outline-offset: 1px; border-color: var(--primary); }
:focus-visible { outline: 3px solid #1D4ED8; outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: #111418; color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 10px; }
.scrim { display: none; }
.setup { list-style: none; margin: 0; padding: 0; }
.setup li { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--hair-2); }
.setup li:last-child { border-bottom: 0; }
.setup li.done strong { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.setup li.next { background: var(--primary-soft); }
.setup-mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #8A9099; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700; }
.setup li.done .setup-mark { background: var(--green); border-color: var(--green); }
.toast { display: flex; gap: 10px; align-items: flex-start; }
.toast span { flex: 1; }
.toast-x { border: 0; background: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .8; padding: 0 2px; }
.toast-warn { background: #92400E; }
.inp-sm { padding: 5px 8px; font-size: 13px; width: auto; } td .inp-sm { width: 100%; } .inp.n { text-align: right; }
textarea.inp { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-l { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field-h { font-size: 11px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; cursor: pointer; } .check input { margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-err { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 6px 10px; margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--grey-soft); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; border: 0; background: transparent; border-radius: 7px; padding: 6px 12px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: #fff; box-shadow: var(--shadow); color: var(--ink); }
.seg-sm button { padding: 3px 10px; font-size: 12px; text-transform: capitalize; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hair); overflow-x: auto; }
.tab { font: inherit; border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--primary-d); border-bottom-color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: 13px; border: 1px solid var(--hair); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--primary); color: var(--primary-d); }

/* ---------- badges & tables */
.badge { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.badge-red { background: var(--red-soft); color: var(--red); } .badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-green { background: var(--green-soft); color: var(--green); } .badge-blue { background: var(--primary-soft); color: var(--primary-d); }
.badge-grey { background: var(--grey-soft); color: #4B5563; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--hair); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--hair-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.total td { font-weight: 700; border-top: 1px solid var(--hair); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- dashboard & lists */
.todo, .activity, .facts { list-style: none; margin: 0; padding: 0; }
.todo li { border-bottom: 1px solid var(--hair-2); } .todo li:last-child { border-bottom: 0; }
.todo a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; color: inherit; }
.todo a:hover { background: var(--surface-2); text-decoration: none; }
.facts li { padding: 6px 0; border-bottom: 1px dashed var(--hair-2); } .facts li:last-child { border-bottom: 0; }
.activity li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--hair-2); }
.activity li:last-child { border-bottom: 0; }
.lotcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.lotcard { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.lotcard-n { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

/* ---------- compliance */
.tierbox .tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.req { text-transform: capitalize; } .req.required, .req.required_if_fees, .req.audit, .req.review { color: var(--red); } .req.optional { color: var(--primary-d); } .req.exempt { color: var(--green); }
.oblist { display: flex; flex-direction: column; gap: 10px; }
.ob { background: var(--surface); border: 1px solid var(--hair); border-left: 4px solid var(--hair); border-radius: 10px; padding: 12px 16px; }
.ob-overdue { border-left-color: var(--red); } .ob-due_soon { border-left-color: #E0A040; } .ob-upcoming { border-left-color: var(--primary); } .ob-done { border-left-color: var(--green); opacity: .8; }
.ob-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .ob-h h3 { font-size: 15px; font-weight: 600; }
.ob p { margin: 6px 0; } .ob-f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- meetings */
.votes { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.vote { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--hair-2); }
.agenda { margin: 8px 0 12px; padding-left: 22px; } .agenda li { margin: 3px 0; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 500; margin: 6px 0; }
.timeline { margin: 8px 0; padding-left: 20px; }

/* ---------- assistant */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 320px; }
.msg { max-width: 760px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--hair); }
.msg-user { align-self: flex-end; background: var(--primary); color: #fff; border-color: var(--primary); }
.msg-err { border-color: var(--red); }
.cites ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.chat-in { position: sticky; bottom: 0; display: flex; gap: 8px; background: var(--bg); padding: 12px 0; }

/* ---------- modal & toasts */
.modal-bg { position: fixed; inset: 0; background: rgba(17,20,24,.38); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-wide { width: min(860px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--hair-2); }
.modal-h h3 { font-size: 16px; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-b { padding: 16px 20px; overflow-y: auto; }
.modal-b p { margin: 0; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 20px; border-top: 1px solid var(--hair-2); flex-wrap: wrap; }
.modal-f .form-err { margin-right: auto; flex: 1 1 100%; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #111418; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13px; }
.toast-err { background: var(--red); }

/* ---------- landing / wizard */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.landing-card { background: #fff; border: 1px solid var(--hair); border-radius: 18px; padding: 36px; width: min(640px, 100%); box-shadow: var(--shadow); }
.landing-card.wizard { width: min(860px, 100%); }
.landing-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.lead { font-size: 16px; color: var(--ink-2); }
.ticks { padding-left: 0; list-style: none; margin: 18px 0 24px; } .ticks li { padding: 4px 0 4px 26px; position: relative; }
.ticks li::before { content: '✓'; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.picker { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 20px; }
.pick { text-align: left; font: inherit; border: 1px solid var(--hair); background: var(--surface-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; }
.pick:hover { border-color: var(--primary); }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; counter-reset: s; flex-wrap: wrap; }
.steps li { counter-increment: s; color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 99px; background: var(--grey-soft); }
.steps li::before { content: counter(s) '. '; }
.steps li.on { background: var(--primary); color: #fff; } .steps li.done { background: var(--green-soft); color: var(--green); }
.lots-edit { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.lot-row { border: 1px solid var(--hair); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 80px 1fr 110px 110px; gap: 10px; margin: 0; }
.lot-row legend { font-weight: 600; padding: 0 6px; }
.lot-row .field-wide { grid-column: 1 / -1; }
.lot-row > .field:nth-of-type(5), .lot-row > .field:nth-of-type(6) { grid-column: span 2; }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted); gap: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--hair); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive */
@media (max-width: 960px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .nav-open .side { transform: none; }
  .side { visibility: hidden; } .nav-open .side { visibility: visible; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(17,20,24,.35); z-index: 35; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--hair); padding: 10px 16px; }
  .burger { font-size: 20px; border: 0; background: none; cursor: pointer; padding: 2px 6px; }
  .topbar-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 18px 16px 32px; } .foot { padding: 0 16px 24px; } .demo-banner { padding: 8px 16px; }
  .ph h1 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .lot-row { grid-template-columns: 1fr 1fr; } .lot-row > .field:nth-of-type(5), .lot-row > .field:nth-of-type(6) { grid-column: 1 / -1; }
  .landing-card { padding: 24px 18px; }
  .activity li { grid-template-columns: 1fr; gap: 2px; }
  .tbl thead { display: none; }
  .tbl tr { display: block; border-bottom: 1px solid var(--hair); padding: 8px 0; }
  .tbl td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; text-align: right; }
  .tbl td::before { content: attr(data-h); color: var(--muted); font-size: 12px; text-align: left; }
  .tbl td.n { text-align: right; }
  .tbl td[data-h=""]::before { content: none; }
  .row-actions { justify-content: flex-end; }
}
@media print { .side, .topbar, .demo-banner, .chat-in, .ph-a { display: none !important; } .shell { display: block; } }
.box-soft { background: var(--surface-2); border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; } .box-soft p { margin: 0; }

/* repair photos */
.photos { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.photos img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, #E5E7EB); display: block; }
.pre-wrap { white-space: pre-wrap; font: inherit; margin: 8px 0; }
.red { color: var(--red); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* insurance health check */
.health { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.health li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #F7F8FA); }
.health li > span:first-child { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.health li.ok > span:first-child { background: #DCFCE7; color: #047857; }
.health li.bad > span:first-child { background: #FEE4E2; color: #B42318; }
.health li.unk > span:first-child { background: #EEF2F6; color: #565B63; }
.assignee { font-size: 12px; font-weight: 600; color: var(--primary, #2563EB); background: rgba(37,99,235,0.08); border-radius: 99px; padding: 2px 10px; }
.health li strong { color: var(--ink, #111418); }
/* Owner "Pay now" panel */
.paynow { border: 1px solid var(--hair-2); background: var(--green-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.paynow-late { background: var(--red-soft); border-color: #F5C2BC; }
.paynow-amt { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.paynow .facts { margin-top: 10px; }
.linkbtn { background: none; border: 0; padding: 0 2px; color: #1D4ED8; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
