/* Metro Town RWA — brand: brown #8A4E3E, orange #F4922A, dark #2A1E1A */
:root {
  --ink: #2A1E1A;
  --ink-2: #3F302A;
  --muted: #6E5F58;
  --bg: #FBF8F5;
  --surface: #FFFFFF;
  --soft: #FDFAF7;
  --line: #EADFD7;
  --line-2: #F1E8E1;
  --field: #DCCFC5;
  --brown: #8A4E3E;
  --brown-dark: #6B3A2E;
  --orange: #F4922A;
  --orange-text: #B45E0C;
  --chart-in: #D9730D;
  --chart-out: #8F3F22;
  --dark: #2A1E1A;
  --on-dark: #E9DCD3;
  --on-dark-muted: #CDBDB2;
  --accent-on-dark: #FFB061;
  --green: #17633D; --green-bg: #E3F3EA;
  --red: #9B2118; --red-bg: #FBE7E5;
  --amber: #8A4A0A; --amber-bg: #FDEBD8;
  --blue: #1F4C91; --blue-bg: #E6EEF9;
  --radius: 14px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--brown); }
a:hover { color: var(--brown-dark); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
h2 { font-size: 17px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 800; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.prewrap { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.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: 44px; padding: 0 18px;
  border-radius: 10px; font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; border: 1px solid #E3D6CC;
  background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #F6EFE9; color: var(--ink); }
.btn-primary { background: var(--brown); border-color: var(--brown); color: #fff; }
.btn-primary:hover { background: var(--brown-dark); color: #fff; }
.btn-accent { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.btn-accent:hover { background: #FFA647; color: var(--ink); }
.btn-ghost-dark { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-ghost-dark:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
button.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brown); cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.muted { color: var(--muted); }
button.link.danger { color: var(--red); }
form.inline { display: inline; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700;
  white-space: nowrap; background: #F3ECE6; color: #5E4E47; }
.b-green, .badge-paid, .badge-resolved, .badge-completed, .badge-active, .badge-approved-claim { background: var(--green-bg); color: var(--green); }
.b-red, .badge-overdue, .badge-high, .badge-rejected { background: var(--red-bg); color: var(--red); }
.b-amber, .badge-unpaid, .badge-open, .badge-approved, .badge-pending, .badge-tenant { background: var(--amber-bg); color: var(--amber); }
.b-blue, .badge-in_progress, .badge-review, .badge-residents { background: var(--blue-bg); color: var(--blue); }
.badge-public { background: var(--green-bg); color: var(--green); }
.badge-committee { background: var(--amber-bg); color: var(--amber); }

/* ---------- cards, stats, grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head a { font-size: 14px; font-weight: 700; }
.card.highlight { border-color: var(--brown); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stats.sm .stat .v { font-size: 22px; }
.stat .s { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 22px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--chart-in); border-radius: 99px; }

/* ---------- lists & key-value ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list .meta { font-size: 13px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.stacked { grid-template-columns: 1fr; gap: 2px; }
.kv.stacked dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }

/* ---------- tables ---------- */
.table-card { padding: 0; overflow-x: auto; }
.table-card .card-head { padding: 18px 20px 4px; }
table { width: 100%; border-collapse: collapse; }
.table-card table { min-width: 680px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; text-align: left;
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: 0; }
.card:not(.table-card) th:first-child, .card:not(.table-card) td:first-child { padding-left: 0; }
.card:not(.table-card) th:last-child, .card:not(.table-card) td:last-child { padding-right: 0; }

/* ---------- forms ---------- */
form { margin: 0; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; flex: 1 1 200px; min-width: 0; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid var(--field);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
input[type=checkbox], input[type=radio] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--brown); flex: none; }
input[type=file] { padding: 8px; background: var(--soft); }
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brown); outline-offset: -1px; border-color: var(--brown); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; }
.check input { margin-top: 2px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border: 1px solid var(--field);
  border-radius: 10px; font-weight: 600; font-size: 14px; flex: 1 1 150px; cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--brown); box-shadow: 0 0 0 1px var(--brown); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 700; padding: 0 0 8px; }
.drop { border: 1.5px dashed #D4C2B5; border-radius: 12px; padding: 16px; background: var(--soft); display: flex; flex-direction: column; gap: 8px; }
.drop .hint { font-size: 13px; color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 220px; }
.narrow { max-width: 720px; }
.w-sm { width: 120px !important; flex: none; }

/* ---------- flash, tabs, pills ---------- */
.flash { padding: 13px 16px; border-radius: 12px; font-weight: 600; }
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }
.alert { padding: 14px 18px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.alert-red { background: var(--red-bg); color: #7A1B14; }
.alert-red a { color: #7A1B14; font-weight: 800; }
.alert-amber { background: var(--amber-bg); color: var(--amber); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { min-height: 44px; display: flex; align-items: center; padding: 0 14px; color: var(--muted); font-weight: 700; text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--brown); border-color: var(--brown); }
.tabs a:hover { color: var(--ink); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid #E3D6CC; background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--ink-2); text-decoration: none; }
.pill:hover { color: var(--ink); border-color: #C9A898; }
.pill.on { background: var(--dark); border-color: var(--dark); color: #fff; }

/* ---------- files ---------- */
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; text-decoration: none; color: var(--ink); max-width: 100%; }
.file:hover { border-color: var(--brown); color: var(--ink); }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file svg { flex: none; color: var(--brown); }

/* ---------- portal shell ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 250px; max-width: 100%; background: var(--dark); color: #F3E9E2; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 8px; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-weight: 800; letter-spacing: .06em; color: var(--accent-on-dark); }
.brand-text span { font-size: 12px; color: var(--on-dark-muted); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--on-dark);
  text-decoration: none; font-weight: 600; font-size: 14px; }
.nav svg { flex: none; }
.nav:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav.on { background: rgba(244,146,42,.18); color: var(--accent-on-dark); }
.count { margin-left: auto; background: var(--orange); color: var(--ink); border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 8px; }
.who { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 14px 8px 0; font-size: 13px; color: var(--on-dark-muted);
  display: flex; flex-direction: column; gap: 2px; }
.who strong { color: #fff; }
.who a, .who button.link { color: var(--accent-on-dark); font-weight: 700; font-size: 13px; }
.who .links { display: flex; gap: 14px; padding-top: 6px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.menu-toggle { display: none; }

/* ---------- charts ---------- */
.chart { display: flex; flex-direction: column; gap: 8px; }
.chart-plot { display: flex; gap: 10px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--muted); text-align: right; min-width: 52px; }
.chart-bars { flex: 1; display: flex; gap: 6px; border-bottom: 1px solid var(--field); position: relative;
  background: linear-gradient(var(--line-2), var(--line-2)) 0 0 / 100% 1px no-repeat,
              linear-gradient(var(--line-2), var(--line-2)) 0 50% / 100% 1px no-repeat; }
.chart-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-width: 30px; }
.chart-col .b { width: min(22px, 40%); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-col .b.in { background: var(--chart-in); }
.chart-col .b.out { background: var(--chart-out); }
.chart-labels { display: flex; gap: 6px; padding-left: 62px; font-size: 12px; color: var(--muted); }
.chart-labels span { flex: 1; text-align: center; min-width: 30px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.key { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; gap: 10px 14px; align-items: center; font-size: 14px; }
.hbars .track { height: 14px; }
.hbars .fill { height: 14px; border-radius: 0 4px 4px 0; background: var(--chart-out); min-width: 2px; }
.hbars .fill.alt { background: var(--chart-in); }

/* ---------- complaint thread, timeline ---------- */
.msg { padding: 14px 16px; border-radius: 12px; background: var(--soft); border: 1px solid var(--line-2); }
.msg.staff { background: #F4F7FD; border-color: #DDE6F6; }
.msg header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg p { margin-top: 4px; }
.timeline { display: flex; flex-direction: column; gap: 16px; }
.tl { display: flex; gap: 14px; }
.tl i { flex: none; width: 12px; height: 12px; border-radius: 99px; background: var(--chart-in); margin-top: 6px; box-shadow: 0 0 0 4px var(--amber-bg); }

/* ---------- requests queue ---------- */
.req { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.avatar { width: 44px; height: 44px; border-radius: 99px; background: var(--amber-bg); color: var(--amber); display: grid; place-items: center; font-weight: 800; flex: none; }
.queue { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); }
.queue:hover { border-color: var(--brown); color: var(--ink); }
.queue b { font-size: 26px; font-weight: 800; min-width: 34px; }
details.disclose summary { cursor: pointer; font-weight: 700; color: var(--brown); list-style: none; }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose[open] summary { margin-bottom: 14px; }

/* ---------- public site ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; width: 100%; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.site-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.site-brand img { width: 48px; height: 48px; }
.site-brand strong { font-weight: 800; font-size: 20px; letter-spacing: .06em; color: var(--brown); display: block; line-height: 1.1; }
.site-brand span { font-size: 12px; color: var(--muted); font-weight: 600; }
.site-nav { display: flex; gap: 22px; align-items: center; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; padding: 10px 2px; }
.site-nav a:hover { color: var(--brown); }
.hero { background: var(--dark); color: #fff; }
.hero .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 72px; padding-bottom: 80px; }
.hero h1 { font-size: clamp(36px, 6vw, 54px); line-height: 1.05; letter-spacing: -.02em; }
.hero p { font-size: 19px; color: var(--on-dark); max-width: 560px; }
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--orange-text); }
.hero .eyebrow { color: var(--accent-on-dark); }
.section { padding-top: 80px; }
.sec-title { font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.015em; line-height: 1.15; }
.amen { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; }
.amen svg { color: var(--orange-text); flex: none; }
.doc-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { color: var(--brown); }
.map-box { min-height: 320px; border-radius: 18px; background: #F1E4D9; border: 1px solid #E3D2C4; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 32px; text-align: center; }
.site-footer { background: var(--dark); color: var(--on-dark-muted); margin-top: 80px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-top: 32px; padding-bottom: 32px; align-items: center; }
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; background: var(--dark); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 18px; padding: 30px; display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step b { flex: none; width: 32px; height: 32px; border-radius: 99px; background: var(--orange); color: var(--ink); display: grid; place-items: center; font-weight: 800; }

/* ---------- receipt / print ---------- */
.receipt { max-width: 680px; }
.receipt-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.receipt-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 14px 0; margin: 16px 0; font-size: 17px; }
.receipt-total strong { font-size: 26px; }
.empty { text-align: center; padding: 48px 16px; }
.error-code { font-size: 48px; font-weight: 800; color: var(--muted); }

@media print {
  .side, .no-print, .flash, .site-header, .site-footer { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { border: 0; }
}

@media (max-width: 860px) {
  .grid-main { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}

@media (max-width: 760px) {
  .side { padding: 12px 16px; gap: 12px; }
  .side-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .menu-toggle { display: inline-flex; background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
  .menu-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
  .side:not(.open) nav, .side:not(.open) .who { display: none; }
  .main { padding: 20px 16px 40px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 10px; font-size: 13px; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; flex: 1 1 140px; }
  .hero .wrap { padding-top: 48px; padding-bottom: 56px; gap: 28px; }
  .section { padding-top: 56px; }
  .hbars { grid-template-columns: 1fr auto; }
  .hbars .track { grid-column: 1 / -1; order: 3; margin-top: -6px; }
}
