/* App do cliente: coluna única de celular, barra de seções fixa embaixo */
html, body { height: 100%; }
body { background: var(--bg); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--brand); }

.shell { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.app-top { background: var(--brand); color: var(--brand-ink); padding: calc(env(safe-area-inset-top, 0px) + 14px) max(18px, env(safe-area-inset-right, 0px)) 16px max(18px, env(safe-area-inset-left, 0px)); }
.app-brand { display: flex; align-items: center; gap: 10px; }
.app-brand .mark { width: 34px; height: 34px; font-size: 18px; border-radius: 9px; background: var(--brand-ink); color: var(--brand); }
.app-brand b { font-family: var(--f-display); font-size: 16px; display: block; line-height: 1.15; }
.app-brand small { font-size: 12.5px; opacity: .85; display: block; }
.logout { margin-left: auto; border: 1px solid currentColor; background: none; color: inherit; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 700; opacity: .9; flex: none; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 0 12px; }
.hero .mark { width: 62px; height: 62px; font-size: 32px; border-radius: 17px; background: var(--brand-ink); color: var(--brand); margin-bottom: 4px; }
.hero b { font-family: var(--f-display); font-size: 21px; line-height: 1.1; }
.hero small { font-size: 13px; opacity: .85; }

.app-body { flex: 1; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.app-body.plain { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.app-h { font-family: var(--f-display); font-size: 21px; font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); }
.tabbar nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; position: relative; }
.tabbar button[aria-current="page"] { color: var(--brand); }
.tabbar svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: var(--surface); font-size: 10.5px; line-height: 17px; font-weight: 800; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; flex: none; }
.chipbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.chipbtn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.group-h { font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 2px 2px -6px; }
.sec-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; margin: 4px 2px -6px; }

.due-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.due-card .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.due-card .v { font-family: var(--f-display); font-size: 31px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.due-card .s { font-size: 13px; color: var(--muted); }

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; position: relative; }
button.doc-row:hover { border-color: var(--muted); }
.doc-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-family: var(--f-mono); font-size: 11px; font-weight: 500; }
.doc-row .t { font-weight: 700; font-size: 14px; line-height: 1.25; display: block; }
.doc-row .m { font-size: 12.5px; color: var(--muted); display: block; overflow-wrap: anywhere; }
.doc-row .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.doc-row .amt { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.chip { font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--muted); }
.chip.soon { color: var(--warn); } .chip.late { color: var(--bad); } .chip.paid { color: var(--ok); }
.dot { position: absolute; top: 9px; left: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--info); border: 2px solid var(--surface); }
.app-empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-head b { font-family: var(--f-display); font-size: 17px; }
.cal-head button { border: 1px solid var(--line); background: var(--sunken); border-radius: 8px; width: 34px; height: 34px; font-weight: 800; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal-grid .wd { font-size: 11px; color: var(--muted); font-weight: 800; padding: 2px 0; }
.cal-day { border: 0; background: none; border-radius: 9px; padding: 6px 0 4px; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 42px; font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--sunken); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.cal-day.sel { background: var(--brand); color: var(--brand-ink); }
.cal-day.sun { color: var(--muted); font-weight: 500; }
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.cal-day.sel .cal-dots i { box-shadow: 0 0 0 1px var(--brand-ink); }
.cal-dots i.late, .legend i.late { background: var(--bad); }
.cal-dots i.pend, .legend i.pend { background: var(--accent); }
.cal-dots i.paid, .legend i.paid { background: var(--ok); }
.cal-dots i.wait, .legend i.wait { background: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--brand); }
.ob-date { width: 42px; text-align: center; line-height: 1; }
.ob-date b { font-family: var(--f-display); font-size: 20px; display: block; font-variant-numeric: tabular-nums; }
.ob-date small { font-size: 10.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; }

.detail { display: flex; flex-direction: column; gap: 14px; }
.back { align-self: flex-start; border: 0; background: none; color: var(--brand); font-weight: 800; padding: 2px 0; font-size: 14px; }
.detail h3 { font-family: var(--f-display); font-size: 22px; line-height: 1.2; margin: 0; text-wrap: balance; }
.kv { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv div.total { font-size: 15px; }
.codebox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.codebox .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.codebox code { font-family: var(--f-mono); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; user-select: all; }
.recalc { background: var(--warn-soft); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.recalc .k { font-size: 12px; font-weight: 800; color: var(--warn); text-transform: uppercase; letter-spacing: .05em; }
.app-btn { width: 100%; border-radius: 12px; padding: 13px; font-weight: 800; border: 1px solid var(--line); background: var(--surface); }
.app-btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.app-btn:disabled { opacity: .5; }
.app-note { font-size: 12.5px; color: var(--muted); text-align: center; margin: 0; }
.notice { background: var(--ok-soft); color: var(--ok); font-weight: 700; border-radius: 12px; padding: 11px 12px; font-size: 13.5px; text-align: center; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.info { background: var(--info-soft); color: var(--info); }
.app-form { display: flex; flex-direction: column; gap: 12px; }
.app-form .field input, .app-form .field select, .app-form .field textarea { background: var(--surface); border-radius: 10px; padding: 11px 12px; font-size: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px !important; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font-weight: 800; font-size: 12.5px; padding: 6px; }
.center-link { align-self: center; border: 0; background: none; color: var(--brand); font-weight: 800; font-size: 13.5px; padding: 2px 0; }
.req-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.req-card p { margin: 0; white-space: pre-wrap; }
.req-card .rh { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.files { display: flex; flex-wrap: wrap; gap: 5px; }
.file { font-family: var(--f-mono); font-size: 11.5px; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; overflow-wrap: anywhere; }
.reply { background: var(--brand-soft); border-radius: 10px; padding: 9px 11px; font-size: 13.5px; }
.reply small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.install { background: var(--surface); border: 1px solid var(--brand); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.install p { margin: 0; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
