/* RoommateShield — "Blue & Sunshine" */
:root {
  --bg: #EEF4FF;
  --surface: #FFFFFF;
  --ink: #0F1E3D;
  --muted: #52607A;
  --line: #E3EAF8;
  --field: #C7D2E8;
  --blue: #1D4ED8;
  --blue-dark: #1E3A8A;
  --blue-soft: #DCE6FB;
  --sun: #FFC93C;
  --sun-dark: #E8AE1A;
  --paid-bg: #D7F5E6; --paid-ink: #0B5C3B; --paid-dot: #0E7A4F;
  --wait-bg: #FCE1EE; --wait-ink: #8B1146; --wait-dot: #BE185D;
  --warn-bg: #FFF3D1; --warn-ink: #6B4A00;
  --danger: #B42318;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(29, 78, 216, 0.10);
  --display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--display); font-weight: 600; letter-spacing: -0.4px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 2px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-sun:hover { background: var(--sun-dark); color: var(--ink); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); color: #fff; }
.btn-line { background: var(--surface); border-color: var(--blue); color: var(--blue); }
.btn-line:hover { background: var(--blue-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; }
.field .num { color: var(--muted); font-weight: 500; margin-right: 6px; }
.field .help { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--field); background: #fff; padding: 0 14px; font-size: 16px; width: 100%; }
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 12px; background: #fff; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }
.check:has(input:checked) { border-color: var(--blue); background: #F5F8FF; }
.check.disabled { opacity: .6; cursor: not-allowed; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice-card { text-align: left; padding: 18px; border-radius: 16px; border: 2px solid var(--field); background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.choice-card strong { font-size: 16px; }
.choice-card span { font-size: 14px; color: var(--muted); }
.choice-card[aria-pressed="true"] { border-color: var(--blue); background: #F5F8FF; }
.error { background: #FDECEA; color: var(--danger); border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 500; }
.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- auth / intake screens ---------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-side { flex: 1 1 420px; background: var(--blue); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-side h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.1; max-width: 520px; }
.auth-side p { color: #DCE6FB; font-size: 17px; max-width: 460px; margin: 16px 0 0; }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: #DCE6FB; font-size: 14px; }
.auth-side li::before { content: '✓'; color: var(--sun); font-weight: 700; margin-right: 8px; }
.auth-main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
.auth-card h2 { font-family: var(--display); font-size: 28px; font-weight: 600; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: inherit; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand:hover, .brand:focus { color: inherit; opacity: 1; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* profile menu */
.menu-wrap { position: relative; }
.avatar-btn { border: 0; cursor: pointer; padding: 0; }
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.menu { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); overflow-y: auto; background: #fff; color: var(--ink); border-radius: 18px; box-shadow: 0 18px 48px rgba(15,30,61,.22); z-index: 30; display: flex; flex-direction: column; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; }
.menu-facts { padding: 0 18px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.menu-facts > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.menu-facts > div > span:first-child { flex: none; }
.menu-facts > div > span:last-child { display: flex; gap: 6px; align-items: center; min-width: 0; flex: 1; justify-content: flex-end; }
.menu-facts .ellipsis { min-width: 0; }
.menu-facts .pill { flex: none; }
.menu-lease { margin: 0 12px 8px; padding: 12px; border-radius: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.menu-list { display: flex; flex-direction: column; padding: 4px 8px; border-top: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: var(--ink); text-decoration: none; font-size: 14px; min-height: 44px; }
.menu-item svg { color: var(--blue); flex: none; }
.menu-item span { display: flex; flex-direction: column; }
.menu-item span span { font-size: 12px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); color: var(--ink); }
.menu-foot { padding: 10px 16px 16px; border-top: 1px solid var(--line); }

/* account sub-menu */
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.subnav a { padding: 10px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.subnav a:hover { background: #fff; color: var(--ink); }
.subnav a[aria-current] { background: #fff; color: var(--ink); font-weight: 700; }
.card[id], form[id] { scroll-margin-top: 16px; }
.due-card.late { border: 2px solid var(--wait-dot); }
@media print { .topbar, .bottomnav, .page, #toast { display: none !important; } .drawer-bg { position: static; background: none; } .drawer { width: 100%; } .drawer [data-close], .drawer button { display: none; } }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--field); }

.wizard { max-width: 720px; margin: 0 auto; padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 22px; }
.wizard-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress { display: flex; gap: 6px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--blue-soft); }
.progress span.on { background: var(--blue); }
.wizard h1 { font-size: 30px; }
.wizard .intro { color: var(--muted); font-size: 16px; margin: 6px 0 0; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.wizard-nav { display: flex; gap: 12px; justify-content: space-between; }
.wizard-nav .btn { min-width: 140px; }
.summary-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; font-weight: 500; }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--blue); color: #fff; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; min-height: 68px; display: flex; align-items: center; gap: 24px; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { padding: 10px 14px; border-radius: 10px; color: #DCE6FB; text-decoration: none; font-weight: 500; font-size: 14px; }
.topnav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.topnav a[aria-current="page"] { background: var(--sun); color: var(--ink); font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.topbar .avatar { background: var(--sun); color: var(--ink); text-decoration: none; }
.page { max-width: 1120px; width: 100%; margin: 0 auto; padding: 28px 20px 110px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.page-head h1 { font-size: 32px; }
.bottomnav { display: none; }

.hero { background: var(--blue); color: #fff; border-radius: 0 0 32px 32px; padding: 24px 20px 92px; }
.hero-in { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.hero .sub { color: #DCE6FB; font-size: 14px; }
.hero h1 { font-size: 30px; }
.overlap { margin-top: -70px; }

.cols { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.col-main { flex: 999 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.card h2 { font-size: 16px; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.big { font-family: var(--display); font-size: 44px; font-weight: 600; letter-spacing: -1px; line-height: 1.1; }
.big small { font-family: var(--body); font-size: 17px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.bar { height: 12px; border-radius: 6px; background: var(--blue-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 6px; transition: width .4s; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.person { border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.person.paid { background: var(--paid-bg); }
.person.paid .avatar { background: var(--paid-dot); color: #fff; }
.person.paid .status { color: var(--paid-ink); }
.person.waiting { background: var(--wait-bg); }
.person.waiting .avatar { background: var(--wait-dot); color: #fff; }
.person.waiting .status { color: var(--wait-ink); }
.person.open { background: #fff; border: 2px dashed var(--field); }
.person.open .avatar { background: var(--blue-soft); color: var(--blue); }
.person .amount { font-weight: 700; font-size: 16px; }
.person .status { font-size: 13px; font-weight: 600; }
.person .btn { margin-top: 4px; }

.list { display: flex; flex-direction: column; }
.list > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list > div:last-child { border-bottom: 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-paid { background: var(--paid-bg); color: var(--paid-ink); }
.pill-wait { background: var(--wait-bg); color: var(--wait-ink); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-blue { background: var(--blue-soft); color: var(--blue-dark); }
.code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: 3px; background: var(--blue-soft); color: var(--blue-dark); padding: 8px 14px; border-radius: 10px; }

.method { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 2px solid var(--field); background: #fff; cursor: pointer; }
.method input { width: 20px; height: 20px; accent-color: var(--blue); margin: 0; }
.method:has(input:checked) { border-color: var(--blue); background: #F5F8FF; }
.method strong { display: block; }
.method span { font-size: 13px; color: var(--muted); }
.sum-row { display: flex; justify-content: space-between; font-size: 14px; }
.sum-row.total { font-size: 17px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 12px; }
.success { text-align: center; align-items: center; padding: 36px 24px; }
.success .tick { width: 72px; height: 72px; border-radius: 36px; background: var(--paid-bg); color: var(--paid-dot); display: flex; align-items: center; justify-content: center; }

.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-row p { margin: 0; font-size: 14px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--field); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .6; }
.switch input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- admin ---------- */
.admin .topbar { background: var(--ink); }
#corp-tab { display: flex; flex-direction: column; gap: 28px; }
.corp .overview-grid, .corp .tiles { gap: 20px; }
.corp .page, .corp .topbar-in { max-width: none; padding-left: clamp(16px, 3vw, 40px); padding-right: clamp(16px, 3vw, 40px); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .v { font-family: var(--display); font-size: 30px; font-weight: 600; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile.hl { background: var(--blue); color: #fff; }
.tile.hl .k, .tile.hl .s { color: #DCE6FB; }
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F5F8FF; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bars .b { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 32px; gap: 10px; align-items: center; font-size: 13px; }
.bars .t { height: 10px; border-radius: 5px; background: var(--blue-soft); overflow: hidden; }
.bars .t span { display: block; height: 100%; background: var(--blue); }
.bars .n { text-align: right; font-weight: 600; }
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 30, 61, .4); display: flex; justify-content: flex-end; z-index: 20; }
.drawer { width: min(560px, 100%); height: 100%; background: var(--bg); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.qa { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.qa .n { color: var(--muted); font-weight: 600; }
.qa .q { color: var(--muted); }
.qa .a { grid-column: 2; font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 50; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* Corporate dashboard tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); }
.tab { font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 16px; min-height: 44px; cursor: pointer; margin-bottom: -1.5px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab .count { font-size: 12px; background: var(--blue-soft); color: var(--blue-dark); padding: 2px 8px; border-radius: 999px; }
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filter .input { min-height: 40px; font-size: 14px; width: auto; }
.grow { flex: 1 1 220px; }
.filter.grow .input { width: 100%; }
.chip { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; min-height: 34px; border-radius: 999px; border: 1.5px solid var(--field); background: #fff; color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--blue-soft); border-color: var(--blue-soft); color: var(--blue-dark); }
.callout { margin: 12px 0 0; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; }
.fold summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: '▸'; color: var(--blue); }
.fold[open] summary::before { content: '▾'; }
.fold summary h2 { margin: 0; font-size: 18px; flex: 1 1 auto; }
.fold-h { margin: 18px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-decoration: underline; }
table.grouped .gstart { border-left: 2px solid var(--line); }
table.grouped .group-row th { background: #F6F9FF; color: var(--ink); font-weight: 700; border-bottom: 0; }
table.grouped td, table.grouped th { padding-left: 8px; padding-right: 8px; }
.pager { padding-top: 12px; }
.hh { display: flex; flex-direction: column; gap: 14px; }
.hh-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hh-stats { display: flex; flex-wrap: wrap; gap: 20px; }
.hh-stats .k, .hh-box .k { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.hh-stats strong { font-size: 16px; }
.hh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.hh-box { background: #F6F9FF; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.hh-box .k { text-transform: uppercase; letter-spacing: .4px; font-size: 11px; }
.hh-box.warn { background: var(--warn-bg); }

@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar-in { min-height: 60px; }
  .bottomnav { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 68px; background: #fff; border-top: 1px solid var(--line); z-index: 10; }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; }
  .bottomnav a[aria-current="page"] { color: var(--blue); font-weight: 700; }
  .subnav { position: static; flex-direction: row; overflow-x: auto; max-width: none !important; flex: 1 1 100% !important; }
  .subnav a { white-space: nowrap; }
  .auth-side { padding: 32px 20px; }
  .auth-side ul, .auth-side p { display: none; }
  .page { padding-top: 20px; }
  .big { font-size: 38px; }
  .admin .page { padding-bottom: 40px; }
  .corp-company { display: none; }
  .admin .topbar .btn-sm { padding: 0 8px; }
}
