/* Rolo member portal. Self-hosted fonts, no inline styles anywhere (CSP
   style-src 'self'), so every visual state is a class in this file. */

@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/figtree-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/figtree-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(/assets/fonts/eb-garamond-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url(/assets/fonts/eb-garamond-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Tokens: LIGHT (default, matches the iOS app) ───────────────────── */
:root {
  --bg:          #F6F6F3;
  --surface:     #FFFFFF;
  --surface-2:   #F1F2EC;
  --input:       #FFFFFF;
  --accent:      #66A636;
  --accent-press:#5A9530;
  --accent-soft: #E0F0D5;
  --text:        #14241F;
  --text-2:      #5B6966;
  --text-3:      #9AA8A3;
  --error:       #C5453B;
  --gold:        #C9A14A;
  --success-text:#3E7D1F;
  --warn-text:   #8A6A1E;
  --border:        rgba(20,36,31,.09);
  --border-strong: rgba(20,36,31,.18);
  --hover:         rgba(20,36,31,.05);
  --chip-muted:    rgba(20,36,31,.06);
  --feature-bg:    #0F1F1C;
  --feature-text:  #FFFFFF;
  --feature-text-2:rgba(255,255,255,.62);
  --avatar-bg:     #0F1F1C;
  --avatar-text:   #8FCB5F;
  --scrim:         rgba(15,31,28,.55);
  --r-lg: 16px; --r-md: 12px; --r-sm: 8px; --r-pill: 100px;
  --ease: cubic-bezier(.22,1,.36,1);
  color-scheme: light;
}

/* ── DARK (toggle, or the system setting when no choice is saved) ───── */
:root[data-theme="dark"] {
  --bg:          #0F1F1C;
  --surface:     #142C28;
  --surface-2:   #18332E;
  --input:       #0C1916;
  --text:        #FFFFFF;
  --text-2:      #9DB0AB;
  --text-3:      #5B6966;
  --error:       #F0938C;
  --success-text:#9ECF6E;
  --warn-text:   #DCBE74;
  --border:        rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.14);
  --hover:         rgba(255,255,255,.06);
  --chip-muted:    rgba(255,255,255,.08);
  --feature-bg:    #18332E;
  --feature-text:  #FFFFFF;
  --feature-text-2:#9DB0AB;
  --avatar-bg:     rgba(102,166,54,.16);
  --avatar-text:   #66A636;
  --accent-soft:   rgba(102,166,54,.18);
  --scrim:         rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  text-wrap: pretty;
  -webkit-text-size-adjust: 100%;
  transition: background-color .25s var(--ease);
}
html, body {
  min-height: 100%;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, li, label, span, a, button, div { text-wrap: pretty; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
.noscript { padding: 48px 24px; text-align: center; color: var(--text-2); }

/* ── Icons ─────────────────────────────────────────────── */
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 28px; height: 28px; }
.logo-mark { display: block; color: var(--text); width: 26px; height: 26px; }
.logo-mark-lg { width: 56px; height: 56px; }

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  background: var(--bg); color: var(--text); padding: 0 16px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.icon-btn { background: none; border: none; color: var(--text-2); cursor: pointer; padding: 9px; border-radius: 12px; line-height: 0; transition: color .15s, background .15s; font-family: inherit; }
.icon-btn:hover { color: var(--text); background: var(--hover); }
.switcher { max-width: 220px; padding: 8px 32px 8px 12px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; }
.switcher-label { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Screens ───────────────────────────────────────────── */
.screen { flex: 1; padding: 24px 16px 56px; max-width: 520px; margin: 0 auto; width: 100%; animation: fadeUp .32s var(--ease); }
.screen-auth { display: flex; flex-direction: column; justify-content: center; max-width: 440px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Cards ─────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 22px; margin-bottom: 14px; border: 1px solid var(--border); }
.card-sm { background: var(--surface); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--border); }
.feature { background: var(--feature-bg); color: var(--feature-text); border-radius: var(--r-lg); padding: 24px; margin-bottom: 16px; border: 1px solid rgba(255,255,255,.06); }
.feature-label { font-size: 12px; color: var(--feature-text-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.feature-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.feature-amount { font-family: 'EB Garamond', serif; font-size: 40px; font-weight: 500; letter-spacing: -.5px; color: var(--accent); line-height: 1.1; }
.feature-period { font-size: 15px; color: var(--feature-text-2); margin-left: 4px; font-family: 'Figtree', sans-serif; }
.feature-meta { margin-top: 12px; font-size: 13px; color: var(--feature-text-2); display: grid; gap: 4px; justify-items: start; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.summary-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; }
.summary-tile.dark { background: var(--feature-bg); color: var(--feature-text); border-color: rgba(255,255,255,.06); }
.summary-k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.summary-tile.dark .summary-k { color: var(--feature-text-2); }
.summary-v { font-family: 'EB Garamond', serif; font-size: 28px; font-weight: 500; line-height: 1.1; }
.summary-tile.dark .summary-v { color: var(--accent); }
.summary-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.summary-tile.dark .summary-sub { color: var(--feature-text-2); }

/* ── Auth ──────────────────────────────────────────────── */
.auth-header { text-align: center; margin-bottom: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-title { font-family: 'EB Garamond', serif; font-size: 30px; font-weight: 500; }
.auth-subtitle { font-size: 15px; color: var(--text-2); line-height: 1.5; }
.join-banner { display: flex; align-items: center; gap: 14px; background: rgba(102,166,54,.1); border: 1px solid rgba(102,166,54,.28); border-radius: var(--r-lg); padding: 16px; margin-bottom: 18px; }
.join-banner-name { font-weight: 600; font-size: 16px; }
.join-banner-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.code-input { font-size: 26px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-3); line-height: 1.5; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label, .label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 7px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 7px; line-height: 1.45; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 14px 15px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 16px; outline: none; background: var(--input); color: var(--text);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none; font-family: inherit;
}
input:disabled { color: var(--text-3); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102,166,54,.16); }
textarea { resize: vertical; min-height: 76px; }
select { background-image: none; padding-right: 15px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text); margin: 4px 0 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 1px; flex-shrink: 0; }
.amount-wrap { position: relative; }
.amount-prefix { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 16px; font-weight: 600; color: var(--text-2); pointer-events: none; }
.amount-wrap input { padding-left: 46px; }
.amount-big { font-size: 28px !important; font-weight: 600; }
.segmented { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 5px; gap: 4px; margin-bottom: 16px; }
.segmented button { flex: 1; padding: 10px 6px; border: 0; background: none; border-radius: var(--r-pill); font: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ── Buttons ───────────────────────────────────────────── */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 16px; border-radius: var(--r-pill); font-size: 16px; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-align: center; transition: background .15s, opacity .15s, transform .08s, border-color .15s; font-family: inherit; text-decoration: none; color: inherit; }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-press); }
.btn-secondary { background: rgba(102,166,54,.14); color: var(--accent); }
.btn-secondary:hover:not(:disabled) { background: rgba(102,166,54,.22); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: rgba(229,101,92,.14); color: var(--error); }
.btn-danger:hover:not(:disabled) { background: rgba(229,101,92,.22); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.btn-sm { display: inline-flex; width: auto; padding: 10px 18px; font-size: 14px; }
.btn + .btn { margin-top: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin: 0; flex: 1; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; font-family: inherit; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.feature .btn-outline { border-color: rgba(255,255,255,.22); color: var(--feature-text); }

/* ── Alerts and toast ──────────────────────────────────── */
.alert { padding: 13px 15px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; line-height: 1.5; }
.alert-error   { background: rgba(229,101,92,.12); color: var(--error); border: 1px solid rgba(229,101,92,.3); }
.alert-success { background: rgba(102,166,54,.12); color: var(--success-text); border: 1px solid rgba(102,166,54,.3); }
.alert-info    { background: var(--chip-muted); color: var(--text-2); border: 1px solid var(--border); }
.alert-warn    { background: rgba(201,161,74,.12); color: var(--warn-text); border: 1px solid rgba(201,161,74,.3); }
.toast { position: fixed; top: 0; left: 50%; transform: translate(-50%, -130%); z-index: 400; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; box-shadow: 0 12px 32px rgba(0,0,0,.18); transition: transform .34s var(--ease); pointer-events: none; }
.toast.show { transform: translate(-50%, 16px); pointer-events: auto; }
.toast-success { background: var(--accent); color: #fff; }
.toast-error { background: var(--error); color: #fff; }

/* ── Typography ────────────────────────────────────────── */
.page-title { font-family: 'EB Garamond', serif; font-size: 30px; font-weight: 500; letter-spacing: -.3px; margin-bottom: 4px; line-height: 1.15; }
.page-subtitle { font-size: 15px; color: var(--text-2); margin-bottom: 22px; line-height: 1.45; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 22px 0 12px; }
.section-title:first-child { margin-top: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── Community nav ─────────────────────────────────────── */
.tab-bar { display: flex; background: var(--surface); border-radius: var(--r-pill); padding: 5px; margin-bottom: 22px; gap: 2px; border: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; padding: 10px 12px; text-align: center; font-size: 14px; font-weight: 600; color: var(--text-2); border-radius: var(--r-pill); text-decoration: none; white-space: nowrap; }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.community-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.community-logo { width: 46px; height: 46px; border-radius: var(--r-md); background: var(--avatar-bg); color: var(--avatar-text); font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.community-logo img { width: 100%; height: 100%; object-fit: cover; }
.community-list { display: grid; gap: 12px; }
.community-card { background: var(--surface); border-radius: var(--r-md); padding: 16px; border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: border-color .18s, transform .12s; }
.community-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.community-card .grow { flex: 1; min-width: 0; }
.community-name { font-size: 16px; font-weight: 600; }
.community-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ── Rows (requests, history, tickets) ─────────────────── */
.row { padding: 15px 16px; margin-bottom: 10px; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--border); border-left: 3px solid transparent; }
.row-open { border-left-color: var(--gold); }
.row-paid { border-left-color: var(--accent); }
.row-muted { border-left-color: var(--text-3); }
.row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.row-title { font-size: 15px; font-weight: 600; margin-bottom: 3px; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.row-amount { font-size: 20px; font-weight: 700; letter-spacing: -.4px; white-space: nowrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.row-actions .btn { width: auto; }
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.badge-ok { background: rgba(102,166,54,.18); color: var(--success-text); }
.badge-warn { background: rgba(201,161,74,.16); color: var(--warn-text); }
.badge-bad { background: rgba(229,101,92,.16); color: var(--error); }
.badge-muted { background: var(--chip-muted); color: var(--text-2); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv-k { color: var(--text-2); }
.kv-v { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 32px 20px; color: var(--text-3); }
.empty-state .ic { width: 32px; height: 32px; margin-bottom: 10px; opacity: .7; }
.empty-state p { font-size: 15px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; padding: 18px 0; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(102,166,54,.25); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.year-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.year-row select { width: auto; padding: 10px 14px; }
.year-row .label { margin: 0; }

/* ── Profile ───────────────────────────────────────────── */
.avatar { width: 72px; height: 72px; border-radius: 22px; background: var(--avatar-bg); color: var(--avatar-text); font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-family: 'EB Garamond', serif; font-size: 23px; font-weight: 500; margin-top: 8px; text-align: center; }
.profile-email { font-size: 14px; color: var(--text-2); margin-top: 4px; text-align: center; overflow-wrap: anywhere; }
.center { text-align: center; }
.center .btn-sm { margin: 10px auto 0; }
.section-head { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.section-head:first-child { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: var(--r-pill); background: var(--chip-muted); color: var(--text-2); }

/* ── Sheet (confirm, re-auth, amount) ──────────────────── */
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; z-index: 300; animation: fade .18s var(--ease); }
.sheet { background: var(--surface); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.25); animation: sheetUp .26s var(--ease); max-height: 92vh; overflow-y: auto; }
.sheet-title { font-family: 'EB Garamond', serif; font-size: 26px; font-weight: 500; margin-bottom: 8px; }
.sheet-msg { font-size: 14px; color: var(--text-2); line-height: 1.5; margin-bottom: 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--r-lg); }
}

/* ── Footer ────────────────────────────────────────────── */
.foot { text-align: center; font-size: 12px; color: var(--text-3); padding: 0 16px 28px; }

@media (min-width: 480px) { .screen { padding: 32px 24px 56px; } }
@media (min-width: 1024px) {
  .topbar { height: 68px; padding: 0 48px; }
  .screen-community { max-width: 1040px; display: grid; grid-template-columns: 220px 1fr; column-gap: 48px; align-items: start; }
  .screen-community .community-head { grid-column: 1 / -1; }
  .screen-community .tab-bar { flex-direction: column; background: none; border: 0; padding: 0; position: sticky; top: 92px; overflow: visible; }
  .screen-community .tab { flex: none; text-align: left; padding: 12px 16px; font-size: 15px; }
  .screen-community .tab:not([aria-current="page"]):hover { background: var(--hover); color: var(--text); }
  .screen-community .view-body { min-width: 0; }
  .screen-wide { max-width: 680px; }
}

.theme-corner { position: fixed; top: 12px; right: 12px; z-index: 101; }
