/*
 * PowerBridge PWA styles. Values (colours, sizes, radii, spacing) are taken
 * from the design mockups' inline styles: navy #1F3A5F app bar, teal #0F6E6E
 * actions, Lora headings, Public Sans body. The mockups are fixed 390x844
 * artboards; here the same design is fluid up to 480px wide.
 */
:root {
  --bg: #F6F7F5; --surface: #FFFFFF; --text: #1D2530; --muted: #5B6670; --faint: #6F7882;
  --navy: #1F3A5F; --teal: #0F6E6E; --teal-dark: #0B5252; --teal-wash: #EAF5F5;
  --border: #E1E5E7; --border-soft: #EEF0F1;
  --green-bg: #E6F2EA; --green-fg: #1F6B44;
  --amber-bg: #FBF0DC; --amber-fg: #8A6314; --amber-border: #EBD8AE; --amber-btn: #C9922B;
  --teal-bg: #E4F1F1; --teal-fg: #0B4F4F; --teal-border: #BFDCDC;
  --blue-bg: #E8EEF5; --blue-fg: #1F3A5F; --blue-border: #C9D6E6;
  --grey-bg: #ECEDEE; --grey-fg: #4B5560; --grey-border: #D9DCDE;
  --error: #B42318; --error-bg: #FDECEA;
  --font-body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Lora', Georgia, 'Times New Roman', serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.sr-only, .offscreen { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.noscript { padding: 18px; }

/* ---- shell ------------------------------------------------------------ */
.shell { max-width: 480px; min-height: 100vh; min-height: 100dvh; height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); position: relative; }
@media (min-width: 481px) { .shell { border-left: 1px solid var(--border); border-right: 1px solid var(--border); } }
.appbar { flex: 0 0 auto; background: var(--navy); padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: #fff; }
.brand-tag { font-size: 11px; color: #CFE0E8; letter-spacing: .04em; }
.menu-btn { background: none; border: 0; padding: 8px; margin: -8px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.menu { position: absolute; top: 52px; right: 8px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(31,58,95,.18); padding: 6px; display: flex; flex-direction: column; min-width: 240px; }
.menu[hidden] { display: none; }
.menu a, .menu button { text-align: left; background: none; border: 0; padding: 12px 14px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 13.5px; cursor: pointer; min-height: 44px; }
.menu a:hover, .menu button:hover { background: var(--bg); }
.offline-bar { flex: 0 0 auto; background: var(--grey-bg); color: var(--grey-fg); padding: 8px 18px; font-size: 12px; }
.install { flex: 0 0 auto; background: var(--amber-bg); border-bottom: 1px solid var(--amber-border); padding: 10px 18px; display: flex; align-items: center; gap: 8px; }
.install[hidden], .offline-bar[hidden], .install-btn[hidden] { display: none; }
.install-text { flex: 1 1 auto; font-size: 12px; color: #6B5010; }
.install-btn { background: var(--amber-btn); color: #fff; border: 0; border-radius: 6px; padding: 8px 12px; font-size: 12px; font-weight: 600; cursor: pointer; min-height: 36px; }
.install-close { background: none; border: 0; font-size: 20px; line-height: 1; color: #6B5010; padding: 6px 8px; cursor: pointer; min-width: 36px; min-height: 36px; }
.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; outline: none; }

/* ---- sub header + scroll ---------------------------------------------- */
.subhead { flex: 0 0 auto; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 18px; display: flex; align-items: center; gap: 10px; }
.back { display: flex; align-items: center; justify-content: center; color: var(--text); min-width: 32px; min-height: 32px; margin-left: -6px; }
.subhead-title { font-family: var(--font-head); font-weight: 700; font-size: 17px; color: var(--navy); outline: none; }
.scroll { flex: 1 1 auto; overflow-y: auto; padding: 18px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; }
.scroll > * { flex: 0 0 auto; }
.section-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; color: var(--navy); }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; align-self: center; }
.mt { margin-top: 8px; }
.why { font-size: 13.5px; line-height: 1.55; color: #3A4450; }
.subtitle { font-size: 13px; color: var(--muted); }
.program-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--text); }

/* ---- cards, pills, tags ------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-size: 12px; }
.tag { align-self: flex-start; border-radius: 6px; padding: 4px 9px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.tag-green { background: var(--green-bg); color: var(--green-fg); }
.tag-amber { background: var(--amber-bg); color: var(--amber-fg); }
.tag-teal  { background: var(--teal-bg);  color: var(--teal-fg); }
.tag-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.tag-grey  { background: var(--grey-bg);  color: var(--grey-fg); }
.util { display: inline-block; margin-left: 8px; background: var(--blue-bg); color: var(--blue-fg); border-radius: 999px; padding: 2px 8px; font-size: 10.5px; font-weight: 700; vertical-align: middle; }

/* ---- program rows (accordion) ----------------------------------------- */
.prog { background: var(--bg); border-radius: 8px; }
.prog-head { width: 100%; background: none; border: 0; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; font-size: 13.5px; font-weight: 500; cursor: pointer; border-radius: 8px; min-height: 44px; }
.prog-name { flex: 1 1 auto; }
.chev { flex: 0 0 auto; color: var(--muted); transition: transform .15s; }
.prog-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.prog-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.prog-body[hidden] { display: none; }
.nextstep { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.nextstep p { margin-top: 2px; font-size: 13px; overflow-wrap: anywhere; }
.prog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.source { display: flex; align-items: flex-start; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border-soft); font-size: 10.5px; color: var(--faint); }
.source svg { flex: 0 0 auto; margin-top: 1px; }

/* ---- notices ----------------------------------------------------------- */
.notice { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--blue-border); background: var(--blue-bg); font-size: 13px; line-height: 1.5; }
.notice-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; color: var(--navy); }
.notice p { color: #2F3A46; }
.notice-amber { background: var(--amber-bg); border-color: var(--amber-border); }
.notice-amber .notice-title { color: var(--amber-fg); }
.notice-teal { background: var(--teal-bg); border-color: var(--teal-border); }
.notice-teal .notice-title { color: var(--teal-fg); }
.notice-grey { background: var(--grey-bg); border-color: var(--grey-border); }
.utilityform .notice-title { font-size: 14px; }

/* ---- buttons, chips, forms -------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; padding: 14px; font-size: 14.5px; font-weight: 700; border: 1px solid transparent; cursor: pointer; text-decoration: none; text-align: center; min-height: 48px; width: 100%; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--teal); border-color: var(--teal); }
.btn-small { width: auto; padding: 10px 14px; font-size: 13px; min-height: 44px; }
.btn[disabled] { opacity: .55; cursor: default; }
.textlink { background: none; border: 0; padding: 8px 4px; color: var(--muted); font-size: 12.5px; text-decoration: underline; cursor: pointer; min-height: 36px; }
a.textlink.center { text-decoration: none; padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 10px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.chip-primary { border-color: var(--teal); color: var(--teal); }
.chip-on { background: var(--teal); border-color: var(--teal); color: #fff; }
.row { display: flex; flex-direction: column; gap: 6px; }
.row label, .form-label { font-size: 13px; font-weight: 600; color: var(--text); }
input[type=text], input[type=number], select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); font-size: 16px; min-height: 44px; } /* 16px stops iOS zooming on focus */
textarea { resize: vertical; line-height: 1.5; font-size: 14px; }
.money { display: flex; align-items: center; gap: 8px; }
.money input { flex: 1 1 auto; }
.field-error { color: var(--error); font-size: 12.5px; }
.field-error:empty { display: none; }
.errorbox { background: var(--error-bg); border: 1px solid #F3C4BF; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.errorbox p { color: var(--error); font-size: 13.5px; }
.group { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.group legend { padding: 0; margin-bottom: 8px; }
.infobox { background: var(--blue-bg); border: 1px solid var(--blue-border); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; }
.infobox strong { color: var(--navy); }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 12px; cursor: pointer; font-size: 13px; line-height: 1.5; }
.radio.selected { border: 2px solid var(--teal); background: var(--teal-wash); padding: 11px; }
.radio input { margin-top: 4px; accent-color: var(--teal); }
.radio strong { display: block; margin-bottom: 2px; }
.friction { background: var(--surface); border-left: 4px solid var(--teal); border-radius: 8px; padding: 14px; }
.thanks { align-items: stretch; }
.refine { display: flex; flex-direction: column; gap: 6px; }
.refine-row { display: flex; gap: 8px; align-items: stretch; }
.refine-row input { flex: 1 1 auto; }

/* ---- landlord draft ---------------------------------------------------- */
.draft { background: var(--surface); border: 1px dashed #C9D2D6; border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.6; color: #3A4450; white-space: pre-wrap; overflow-wrap: anywhere; }
.draft-edit { width: 100%; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.split { display: flex; gap: 10px; }
.split .btn { flex: 1 1 0; }

/* ---- chat (screen 1) --------------------------------------------------- */
.chat { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.chat > * { flex: 0 0 auto; }
.bubble { max-width: 82%; padding: 12px 14px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; }
.bubble-user { align-self: flex-end; background: var(--teal); color: #fff; border-radius: 14px 14px 4px 14px; }
.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.progress { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 18px; }
.progress .muted { font-size: 12.5px; }
.progress-cta { background: none; border: 0; font-size: 12.5px; font-weight: 700; color: var(--teal); cursor: pointer; padding: 8px 0 8px 12px; min-height: 36px; }
.inputbar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); background: var(--surface); padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.inputbar input { flex: 1 1 auto; border-radius: 999px; padding: 11px 16px; }
.send { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: var(--teal); border: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.send[disabled] { opacity: .55; }
.incomeform { gap: 12px; }
.confirm { gap: 0; }
.confirm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.confirm-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.confirm-value { font-size: 13.5px; }
.confirm .btn { margin-top: 14px; }

/* ---- loading ----------------------------------------------------------- */
.loading { display: flex; flex-direction: column; gap: 14px; }
.skeleton { border-radius: 12px; background: linear-gradient(90deg, #E9ECEB 25%, #F3F5F4 37%, #E9ECEB 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.sk-card { height: 92px; } .sk-card.short { height: 64px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-text { text-align: center; font-size: 12.5px; color: var(--muted); }

.prose { gap: 10px; }
.prose p, .prose li { font-size: 13.5px; line-height: 1.6; color: #3A4450; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose .section-title { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton, .typing span { animation: none; }
  .chev { transition: none; }
}
