/* Mosha full prototype: layout and components on top of mosha.css tokens. RTL, phone-first below 1024px. */
:root { --side-w: 256px; --top-h: 64px; --nav-h: 64px; }
body { min-height: 100vh; }
a { color: var(--green-700); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Misc (from the mockup kit) */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap, .wrap { flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.between.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.divider { height: 1px; background: var(--border); }
.unit-tag { display: inline-grid; place-items: center; min-width: 44px; height: 26px; padding: 0 6px; border-radius: var(--r-sm);
  background: var(--green-50); color: var(--green-800); font-weight: 800; font-size: 12px; border: 1px solid var(--green-100); text-decoration: none; }
.bar { height: 8px; background: var(--surface-sunken); border-radius: var(--r-pill); overflow: hidden; display: flex; flex: 1; min-width: 60px; margin-top: 6px; }
.row .bar { margin-top: 0; }
.bar > span { display: block; height: 100%; background: var(--st-paid-fg); border-radius: var(--r-pill); }
.bar > span.pend { background: #B8B22A; } .bar > span.info { background: var(--st-info-fg); } .bar > span.exp { background: var(--brand-red); } .bar > span.overdue { background: var(--st-overdue-fg); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.pay { background: var(--brand-yellow); color: var(--brand-black); border-color: #D6D24A; }
.btn.pay:hover { filter: brightness(.97); }
.btn.primary { text-decoration: none; } .btn.secondary, .btn.ghost, .btn.danger { text-decoration: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--green-700); text-decoration: underline; cursor: pointer; font-size: inherit; }
.small { font-size: 12px; } .latin { direction: ltr; unicode-bidi: isolate; }
td.latin, .latin.small { text-align: start; }

/* Boot */
.boot { min-height: 100vh; display: grid; place-items: center; } .boot img { height: 44px; opacity: .6; }

/* Shell */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: var(--green-800); color: var(--text-on-brand); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.side .logo { display: block; padding: 4px 10px 16px; } .side .logo img { height: 32px; filter: invert(1) brightness(1.1); }
.bsw { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 10px; color: inherit; cursor: pointer; }
.bsw span { flex: 1; display: flex; flex-direction: column; } .bsw small { opacity: .7; font-size: 12px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md); color: rgba(249,249,249,.8); text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: var(--brand-yellow); color: var(--brand-black); font-weight: 700; }
.side .grp { font-size: 11px; opacity: .5; padding: 12px 12px 4px; }
.cnt { margin-inline-start: auto; background: rgba(255,255,255,.18); color: #fff; font-size: 11px; font-weight: 700; border-radius: var(--r-pill); padding: 0 7px; line-height: 20px; }
.side nav a.on .cnt { background: var(--green-800); }
.cnt.overdue { background: var(--brand-red); }
.side-foot { margin-top: auto; padding: 16px 12px 4px; font-size: 11px; opacity: .5; }
.side-back { display: none; }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.top { height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--surface-page); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; }
.top-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-title h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sid { font-size: 11px; font-weight: 800; color: var(--green-800); background: var(--green-100); border-radius: var(--r-sm); padding: 2px 6px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-card); color: var(--green-800); cursor: pointer; }
.dotc { position: absolute; top: -5px; inset-inline-start: -5px; background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 800; border-radius: 99px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-blue); color: var(--green-800); display: grid; place-items: center; font-weight: 800; text-decoration: none; }
.menu-btn { display: none; }
.view { padding: 24px 28px 96px; display: flex; flex-direction: column; gap: 18px; width: 100%; min-width: 0; }
.bnav { display: none; }
.fb-fab { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 30; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-pill);
  background: var(--brand-black); color: #fff; border: 0; box-shadow: var(--shadow-2); cursor: pointer; font-size: 13px; font-weight: 700; }
.fb-fab b { background: var(--brand-yellow); color: var(--brand-black); border-radius: 99px; padding: 0 7px; font-size: 11px; }

/* Solo pages (selection, first setup) */
.solo { width: 100%; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px; }
.select-wrap { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.select-logo { height: 40px; align-self: center; margin-bottom: 8px; }
.select-wrap > h1, .select-wrap > p { text-align: center; }
.sel-b { padding: 6px; } .sel-h { display: flex; gap: 12px; align-items: center; padding: 10px 12px; color: var(--green-800); }
.sel-h div { display: flex; flex-direction: column; } .sel-h small { color: var(--text-secondary); }
.pick { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-card); cursor: pointer; text-align: start; margin-top: 6px; }
.pick-row:hover { border-color: var(--green-700); background: var(--green-50); } .pick-row.on { border-color: var(--green-800); }
.pick-row > span:first-of-type, .pick-row span:not(.badge) { flex: 1; display: flex; flex-direction: column; } .pick-row small { color: var(--text-secondary); }

/* Cards, kpis, grids */
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.six { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.grid.two-f { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span2 { grid-column: 1 / -1; }
.kpi .label { color: var(--text-secondary); font-size: 13px; }
.kpi .v { margin-top: 4px; font-size: 22px; font-weight: 800; } .kpi .v .money { font-size: 22px; }
.kpi .sub { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.kpi.tone-overdue .v { color: var(--st-overdue-fg); }
.card-h a { text-decoration: none; }
.card.sunken, .sunken { background: var(--surface-sunken); box-shadow: none; }
a.card { text-decoration: none; color: inherit; display: block; } a.card:hover { border-color: var(--border-strong); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 12px; color: var(--text-muted); text-align: center; }

/* Forms */
.inp { font: inherit; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-card); color: var(--text-primary); min-width: 0; width: 100%; }
select.inp { width: auto; min-width: 140px; padding-inline-end: 28px; }
.lbl select.inp, .stack select.inp, .two-f select.inp { width: 100%; }
textarea.inp { height: auto; padding: 10px 12px; line-height: 1.8; resize: vertical; }
input[type=file].inp { padding: 7px; height: auto; }
.inp:focus { outline: 2px solid var(--green-700); outline-offset: 1px; }
.inp.otp { font-size: 24px; letter-spacing: 12px; text-align: center; }
.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.lbl > .inp, .lbl > select { font-weight: 400; color: var(--text-primary); }
.row-l { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lbl.row-l { flex-direction: row; justify-content: space-between; }
.hint { font-size: 12px; font-weight: 400; color: var(--text-muted); line-height: 1.7; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input, .chip-r input { accent-color: var(--green-800); width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; text-decoration: none; }
.chip-r { display: inline-flex; } .chip-r input { position: absolute; opacity: 0; pointer-events: none; }
.chip-r span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface-card); font-size: 13px; cursor: pointer; }
.chip-r input:checked + span { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.chip-r input:focus-visible + span { outline: 2px solid var(--green-700); }
.unit-picks { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: var(--r-md); }
fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; } legend { font-size: 13px; color: var(--text-secondary); padding: 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .field { min-width: 220px; height: 40px; } .toolbar .field input { border: 0; outline: 0; font: inherit; background: none; flex: 1; min-width: 0; }

/* Tables and lists */
.tbl { overflow: auto; }
table.dt td { white-space: nowrap; }
table.dt td.wrap-cell, .wrap-cell { white-space: normal; min-width: 160px; max-width: 360px; }
table.dt tr.click { cursor: pointer; } table.dt tr.click:hover td { background: var(--green-50); }
table.dt tfoot th { background: var(--surface-sunken); text-align: start; padding: 10px 12px; } table.dt tfoot th.n { text-align: end; }
.tfoot { padding: 10px 14px; border-top: 1px solid var(--border); }
.list { display: flex; flex-direction: column; }
.list .li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit;
  background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; cursor: default; }
.list a.li, .list button.li { cursor: pointer; } .list a.li:hover, .list button.li:hover { background: var(--green-50); }
.list .li:last-child { border-bottom: 0; }
.list .li > div:first-child { display: flex; flex-direction: column; min-width: 0; } .list .li small { color: var(--text-secondary); font-size: 12px; }
.list .li .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li.notif { justify-content: flex-start; } .li.notif .ic { width: 36px; height: 36px; border-radius: 50%; background: var(--green-50); color: var(--green-800); display: grid; place-items: center; flex: none; }
.li.notif.unread { background: #FBFCF4; } .li.notif.unread b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-red); margin-inline-start: 8px; vertical-align: middle; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
dl.facts dt { color: var(--text-secondary); font-size: 13px; } dl.facts dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { padding: 10px 14px; border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.tabs button.on { color: var(--green-800); border-bottom-color: var(--green-800); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--surface-sunken); padding: 4px; border-radius: var(--r-lg); }
.seg button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border: 0; border-radius: var(--r-md); background: none; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--surface-card); box-shadow: var(--shadow-1); color: var(--green-800); }

/* Steppers and flows */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.stepper li { flex: 1; min-width: 110px; }
.stepper button { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-card); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.stepper button:disabled { cursor: default; }
.stepper span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); font-size: 12px; flex: none; }
.stepper li.on button { border-color: var(--green-800); color: var(--green-800); } .stepper li.on span { background: var(--green-800); color: #fff; }
.stepper li.done span { background: var(--st-paid-bg); color: var(--st-paid-fg); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; overflow-x: auto; }
.flow li { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); position: relative; text-align: center; }
.flow li span { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-card); border: 2px solid var(--border-strong); z-index: 1; }
.flow li::before { content: ""; position: absolute; top: 6px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--border); }
.flow li:last-child::before { display: none; }
.flow li.done span { background: var(--st-paid-fg); border-color: var(--st-paid-fg); } .flow li.done::before { background: var(--st-paid-fg); }
.flow li.on span { background: var(--brand-yellow); border-color: var(--green-800); } .flow li.on { color: var(--text-primary); font-weight: 700; }
.flow.mini { margin-top: 10px; } .flow.mini li { min-width: 70px; }
.flow.vert { flex-direction: column; gap: 4px; } .flow.vert li { flex-direction: row; align-items: flex-start; text-align: start; gap: 12px; min-height: 40px; }
.flow.vert li::before { top: 14px; inset-inline-start: 6px; width: 2px; height: 100%; }
.flow.vert li div { display: flex; flex-direction: column; } .flow.vert li small { color: var(--text-secondary); font-weight: 400; }
.pipeline { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.pipeline div { background: var(--surface-card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; text-align: center; display: flex; flex-direction: column; }
.pipeline b { font-size: 18px; color: var(--text-muted); } .pipeline .has b { color: var(--green-800); } .pipeline small { font-size: 11px; color: var(--text-secondary); }

/* Verification queue */
.split { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.queue { max-height: 70vh; overflow: auto; } .queue .li.sel { background: var(--green-50); box-shadow: inset -3px 0 0 var(--green-800); }
.proof-wrap { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 20px; }
.proof { background: var(--surface-sunken); border-radius: var(--r-md); padding: 10px; display: grid; place-items: center; min-height: 200px; }
.proof img { max-height: 460px; border-radius: var(--r-sm); }

/* Accounts, charts */
.acc { text-align: start; cursor: pointer; } .acc.on { border-color: var(--green-800); box-shadow: 0 0 0 2px var(--green-100); }
.acc.add { display: grid; place-items: center; color: var(--green-700); font-weight: 700; border-style: dashed; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 12px 4px 0; border-bottom: 1px solid var(--border); margin: 8px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; gap: 6px; }
.chart .bars { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
.chart .bars span { width: 40%; max-width: 28px; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart small { font-size: 11px; color: var(--text-secondary); }
.inc { background: var(--st-paid-fg); } .exp { background: var(--brand-red); }
.legend { display: flex; gap: 16px; font-size: 12px; margin-bottom: 12px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; }

/* Amenities, calendar, booking */
.amen.off { opacity: .6; }
.amen-tile { display: flex; gap: 12px; align-items: flex-start; } .amen-tile > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; } .amen-tile small { color: var(--text-secondary); }
.amen-tile .ic { width: 48px; height: 48px; border-radius: var(--r-md); background: var(--green-50); color: var(--green-800); display: grid; place-items: center; flex: none; }
.amen-tile .end { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { border-inline-start: 1px solid var(--border); padding: 8px; min-height: 160px; display: flex; flex-direction: column; gap: 6px; }
.day:first-child { border-inline-start: 0; } .day.today { background: #FDFDF3; }
.dh { display: flex; flex-direction: column; padding-bottom: 6px; border-bottom: 1px solid var(--border); } .dh small { color: var(--text-secondary); }
.ev { text-align: start; border: 1px solid var(--st-paid-bd); background: var(--st-paid-bg); border-radius: var(--r-sm); padding: 4px 6px; font-size: 12px; cursor: pointer; display: flex; flex-direction: column; }
.ev.pending_approval, .ev.pending_payment { background: var(--st-pending-bg); border-color: var(--st-pending-bd); }
.ev.blocked { background: var(--surface-sunken); border-color: var(--border); cursor: default; flex-direction: row; gap: 4px; align-items: center; }
.ev small { color: var(--text-secondary); }
.days { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.days button { flex: none; width: 68px; padding: 8px 0; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-card); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.days button small { font-size: 11px; color: var(--text-secondary); } .days button.on { background: var(--green-800); color: #fff; border-color: var(--green-800); } .days button.on small { color: #DCE8E7; }
.days button.blk { border-style: dashed; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.slot { padding: 12px; border-radius: var(--r-md); border: 1px solid var(--st-paid-bd); background: var(--surface-card); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.slot:hover { background: var(--st-paid-bg); } .slot small { color: var(--st-paid-fg); }
.slot.off { border-color: var(--border); background: var(--surface-sunken); color: var(--text-muted); cursor: not-allowed; } .slot.off small { color: var(--text-muted); }

/* Resident */
.hello h2 { font-size: 20px; }
.due { border-top: 4px solid var(--st-info-fg); } .due.od { border-top-color: var(--st-overdue-fg); } .due.ok { border-top-color: var(--st-paid-fg); }
.tile { display: flex; align-items: center; gap: 12px; } .tile > div { flex: 1; display: flex; flex-direction: column; } .tile small { color: var(--text-secondary); }
.tile > svg:first-child { color: var(--green-800); }
.ann.em { border-color: var(--st-overdue-bd); background: var(--st-overdue-bg); }
.ann h3, .ann h2.h3 { display: flex; align-items: center; gap: 8px; }
.pay-wrap { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.bankcard { background: linear-gradient(135deg, var(--green-800), #0B5A5C); color: #fff; border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.bankcard .big { font-size: 22px; font-weight: 800; letter-spacing: 1px; } .bankcard .linkbtn { color: var(--brand-yellow); }
.gateway { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; } .gw-head { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--st-info-fg); }
.receipt { width: 100%; } .ok-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--st-paid-bg); color: var(--st-paid-fg); display: grid; place-items: center; margin: 8px auto; }
.opt-row { margin-bottom: 12px; }
.opt-pick { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.opt-pick:has(input:checked) { border-color: var(--green-800); background: var(--green-50); }
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; } .stars input { display: none; }
.stars span { font-size: 28px; color: var(--border-strong); cursor: pointer; }
.stars label:has(input:checked) span, .stars label:has(input:checked) ~ label span { color: #D4A017; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; } .thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--border); }
.poll h3, .poll h2.h3 { font-size: 15px; }
.tcount { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 10px 12px; } .tcount.on { border-color: var(--green-800); }
.qr-fallback { width: 200px; height: 200px; display: grid; place-items: center; background: var(--surface-sunken); border-radius: var(--r-md); font-size: 12px; color: var(--text-muted); }

/* Notes */
.fb-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; max-height: 40vh; overflow: auto; }
.fb-item { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; } .fb-item p { margin: 4px 0; }
table.inv td { vertical-align: top; }

/* Modal and toast */
.modal-back { position: fixed; inset: 0; background: rgba(27,27,27,.45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { position: relative; background: var(--surface-card); border-radius: var(--r-xl); padding: 24px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-2); }
.modal.wide { width: min(860px, 100%); }
.modal h2 { display: flex; align-items: center; gap: 8px; padding-inline-end: 36px; }
.modal-x { position: absolute; top: 14px; inset-inline-end: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-sunken); cursor: pointer; display: grid; place-items: center; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 200; display: flex; gap: 10px; align-items: center; width: max-content; max-width: min(560px, calc(100vw - 32px));
  background: var(--brand-black); color: #fff; padding: 12px 18px; border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(1,36,38,.28); font-weight: 600; line-height: 1.6; cursor: pointer;
  transform: translateX(-50%); animation: toast-in .26s var(--ease, ease-out) backwards; }
.toast svg.i { flex: none; color: var(--brand-yellow); }
.toast span { min-width: 0; overflow-wrap: anywhere; }
.toast.is-err { background: var(--st-overdue-fg); } .toast.is-err svg.i { color: #fff; }
.toast.out { opacity: 0; transform: translate(-50%, 8px); transition: opacity .18s ease-in, transform .18s ease-in; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* Tablet and phone: drawer menu, bottom tab bar */
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px; max-width: 85vw; z-index: 60; transform: translateX(100%); transition: transform .2s; }
  body.nav-on .side { transform: none; }
  body.nav-on .side-back { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
  .menu-btn { display: inline-grid; }
  .top { padding: 0 16px; }
  .top-title h1 { font-size: 17px; }
  .view { padding: 16px 16px calc(var(--nav-h) + 80px); }
  .toast { bottom: calc(var(--nav-h) + 68px + env(safe-area-inset-bottom)); } /* above the tab bar and the notes button */
  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface-card); border-top: 1px solid var(--border); z-index: 40; }
  .bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--text-muted); text-decoration: none; }
  .bnav a.on { color: var(--green-800); font-weight: 800; }
  .fb-fab { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); padding: 9px 12px; }
  .fb-fab span { display: none; }
  .grid.two { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; } .queue { max-height: 300px; }
  .proof-wrap { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .week { grid-template-columns: 1fr; } .day { border-inline-start: 0; border-top: 1px solid var(--border); min-height: 0; } .day:first-child { border-top: 0; }
  .dh { flex-direction: row; gap: 8px; }
}
@media (max-width: 640px) {
  .grid.two-f { grid-template-columns: 1fr; }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v, .kpi .v .money { font-size: 17px; }
  .card.pad { padding: 14px; }
  .toolbar .field { min-width: 0; flex: 1 1 100%; }
  .toolbar select.inp { flex: 1; }
  .money.xl { font-size: 24px; }
  .modal { padding: 18px; border-radius: var(--r-lg); }
  .modal-back { align-items: end; padding: 0; } .modal { width: 100%; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: 8px; }
  .between.wrap > .row { flex-wrap: wrap; }
  .stepper li { min-width: 0; } .stepper button { font-size: 0; justify-content: center; } .stepper button span { font-size: 12px; }
  .row-l .inp { width: 72px !important; } .lbl .row.wrap { gap: 8px 12px; }
  .stepper li.on { flex: 3; } .stepper li.on button { font-size: 13px; } /* the current step keeps its name on phones */
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---------- Accessibility and touch (UI/UX review, 2026-10-14) ---------- */
/* Keyboard focus is always visible (WCAG 2.4.7); mouse clicks do not draw it. */
:where(a, button, summary, select, textarea, input, [tabindex]):focus-visible { outline: 2px solid var(--green-700); outline-offset: 2px; }
.side :where(a, button):focus-visible, .fb-fab:focus-visible { outline-color: var(--brand-yellow); }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 300; background: var(--brand-yellow); color: var(--brand-black); padding: 10px 16px; border-radius: var(--r-md); font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }
.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; }
.view:focus { outline: none; }
.toolbar .field:focus-within { outline: 2px solid var(--green-700); outline-offset: 1px; }
/* Forms fill the width they are given: in a row of fields, fields without a fixed width share the rest of the line. */
form, .card > form, .modal form { width: 100%; }
.row > .inp:not([style*="width"]), .row > .lbl, .row.wrap > .lbl { flex: 1 1 160px; min-width: 0; }
/* Buttons made from links never look like underlined text. */
a.btn { text-decoration: none; }
/* Taps respond at once; everything clickable shows a pointer. */
a, button, summary, label, select, [data-act] { touch-action: manipulation; }
[data-act], summary { cursor: pointer; }
/* Nothing below 12px (side-menu headings, counters, currency unit, screen ID). */
.side .grp { font-size: 12px; opacity: 1; color: rgba(249,249,249,.72); }
.side-foot { font-size: 12px; opacity: 1; color: rgba(249,249,249,.72); }
.cnt, .fb-fab b, .sid, .pipeline small, .chart small, .days button small { font-size: 12px; }
.dotc { font-size: 12px; min-width: 20px; height: 20px; }
.money .u { font-size: max(.78em, 12px); }
small { font-size: max(.8em, 12px); }
/* Counters on red use the darker status red: white on brand red is 4.3:1, below AA. */
.cnt.overdue, .dotc { background: var(--st-overdue-fg); }
/* Amounts line up in columns. */
.money, td.n, .kpi .v { font-variant-numeric: tabular-nums; }
/* Checkboxes in tables are big enough to hit. */
td input[type=checkbox], th input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green-800); }
/* Small text links in card headers get a real hit area. */
.card-h a.small, .card-h a { display: inline-flex; align-items: center; min-height: 32px; padding-inline: 6px; }
summary { min-height: 44px; display: flex; align-items: center; }
/* Phones: every control at least 44px tall (Apple HIG, Material 48dp). */
@media (max-width: 640px) {
  .btn.sm, .chip, .chip-r span { min-height: 44px; height: auto; }
  .avatar, .iconbtn { width: 44px; height: 44px; }
  .card-h a.small, .card-h a { min-height: 44px; }
  .fb-fab { min-height: 44px; min-width: 44px; justify-content: center; }
  .inp, input.inp, select.inp { min-height: 44px; font-size: 16px; } /* 16px stops iOS zooming into the field */
  .toolbar .field { height: 44px; } .toolbar .field input, .toolbar select { font-size: 16px; } .toolbar select { min-height: 44px; }
  .bnav a, .bnav button { font-size: 12px; }
}
.bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 12px; color: var(--text-muted); background: none; border: 0; cursor: pointer; }
/* ---------- Interaction and finish (taste review, 2026-10-14) ---------- */
/* Every control answers hover and press, with one shared motion timing. */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --t-fast: 160ms; }
.btn, .chip, .chip-r span, .iconbtn, .avatar, .fb-fab, .side nav a, .bsw, .pick-row, .tabs a, .tabs button, .slot, .days button, .list a.li, .list button.li, table.dt tr.click td, .card.tile, a.card {
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn.secondary:hover, .btn.ghost:hover { background: var(--green-50); }
.btn.danger:hover { background: var(--st-overdue-bg); }
.btn:active:not(:disabled), .chip:active, .iconbtn:active, .fb-fab:active, .slot:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.chip:hover:not(.on), .chip-r span:hover { border-color: var(--green-800); }
.iconbtn:hover { border-color: var(--border-strong); background: var(--green-50); }
a.card:hover, .card.tile:hover { box-shadow: var(--shadow-2); }
/* Rounded-square avatar instead of the default circle. */
.avatar { border-radius: var(--r-lg); }
/* The file picker matches the secondary button instead of the browser's grey box. */
input[type=file].inp { height: auto; padding: 6px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; color: var(--green-800); background: var(--surface-card); border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 6px 14px; margin-inline-end: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--green-50); }
/* Headings and short texts wrap evenly instead of leaving one word alone. */
h1, h2, h3, .alert .t { text-wrap: balance; }
p, .hint, .muted { text-wrap: pretty; }
html { scroll-behavior: smooth; }

/* Respect the system "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .side, .top, .bnav, .fb-fab, .no-print, .toolbar, .chips { display: none !important; }
  .app { display: block; } .view { padding: 0; } .card { box-shadow: none; }
}
.report { overflow-x: auto; } .chart { min-width: 0; }
a.card.tile { display: flex; }
.list .li .row > div { display: flex; flex-direction: column; min-width: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; } :is(dd, small, div, td).ltr { text-align: end; } /* a block of LTR digits still lines up with the RTL text around it */
