/* =====================================================================
   Client portal — mobile-first.
   The portal is designed as a phone app: one column, big tap targets,
   a bottom tab bar. On a desktop it shows as a centred phone-width column.
   Loaded after app.css, so these rules win.
   ===================================================================== */

:root { --portal-max: 560px; --tabbar: 68px; }

body { font-size: 16px; }
.portal { min-height: 100dvh; }

/* Header: compact app bar */
.portal-header-inner { max-width: var(--portal-max); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); }
.portal-header .brand { font-size: 1rem; }
.portal-header .brand-mark { width: 34px; height: 34px; }
.portal-nav { display: none; }

/* Content column */
.portal-main { max-width: var(--portal-max); padding: 18px 16px calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); gap: 18px; }
.portal-footer { padding: 8px 16px calc(var(--tabbar) + 20px + env(safe-area-inset-bottom)); font-size: .78rem; }
.portal-narrow { max-width: none; }
.page-head { display: block; }
.page-head > .row-wrap { margin-top: 12px; }
h1 { font-size: 1.5rem; }
.panel { padding: 20px; border-radius: 20px; }

/* Bottom tab bar: always on, thumb reachable */
.bottom-nav {
  display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--portal-max); z-index: 50; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  min-height: var(--tabbar);
}
@media (min-width: 761px) { .bottom-nav { border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); } }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; font-size: .72rem; font-weight: 700; color: var(--muted); border-radius: 12px; text-decoration: none; }
.bottom-nav a .bi { font-size: 1.35rem; }
.bottom-nav a.active { color: var(--primary-text); background: var(--primary-soft); }
.bottom-nav a:active { transform: scale(.96); }

/* Bigger controls: 16px text stops iPhones zooming into inputs */
.input, .select, .textarea { font-size: 16px; min-height: 50px; padding: 12px 14px; border-radius: 14px; }
.textarea { min-height: 96px; }
.input-group > .bi { left: 15px; font-size: 1.05rem; }
.input-group > .input { padding-left: 42px; }
.field label, .label { font-size: .9rem; }
.btn { min-height: 48px; border-radius: 14px; font-size: 1rem; padding: 0 18px; }
.btn-sm { min-height: 40px; font-size: .9rem; border-radius: 11px; }
.btn-lg { min-height: 56px; font-size: 1.05rem; }
.btn-icon { width: 44px; }
.form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.form-grid .span-2 { grid-column: auto; }
.form-section { padding-top: 10px; }
.kv { gap: 10px 14px; font-size: .95rem; }
.badge { font-size: .78rem; padding: 4px 11px; }

/* Home screen */
.app-hero { padding: 6px 2px 2px; }
.app-hero h1 { font-size: 1.85rem; letter-spacing: -.03em; line-height: 1.1; }
.app-hero h1 span { background: linear-gradient(90deg, var(--primary), #14b8a6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-hero p { color: var(--muted); margin-top: 8px; font-size: 1rem; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none !important; min-height: 112px; justify-content: space-between;
}
.quick:active { transform: scale(.98); }
.quick strong { font-size: 1rem; }
.quick small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.quick .stat-icon { width: 40px; height: 40px; border-radius: 12px; font-size: 1.2rem; }
.quick.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.quick.primary small { color: rgba(255, 255, 255, .8); }
.quick.primary .stat-icon { background: rgba(255, 255, 255, .18); color: #fff; }

.balance-card { background: linear-gradient(135deg, #1b2a6b, #3046d8 60%, #22b5a0); color: #fff; border: 0; padding: 20px; border-radius: 22px; display: flex; flex-direction: column; gap: 6px; }
.balance-card .label { color: rgba(255, 255, 255, .78); font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.balance-card .amount { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.balance-card .meta { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; color: rgba(255, 255, 255, .85); flex-wrap: wrap; }
.balance-card .badge { background: rgba(255, 255, 255, .18); color: #fff; }
.balance-card .btn { background: #fff; color: var(--primary-text); margin-top: 8px; }

.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.how li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.how .num { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-weight: 800; font-size: .95rem; }
.how strong { display: block; font-size: .98rem; }
.how span { color: var(--muted); font-size: .86rem; }

.feature-grid, .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.record-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.record { padding: 18px; border-radius: 18px; }
.record-amount { font-size: 1.7rem; }

/* Sticky submit bar sits just above the tab bar */
.sticky-actions {
  position: sticky; bottom: calc(var(--tabbar) + 8px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 8px; padding-top: 10px;
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
}

/* Selfie capture */
.capture-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; display: none; }
.capture-preview.show { display: block; }

/* Chat fills the phone screen */
.chat-screen { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tabbar) - 220px); }
.chat-screen .chat { flex: 1; max-height: none; }
.bubble { max-width: 86%; font-size: .98rem; }
.chat-form .textarea { min-height: 50px; height: 50px; }

/* Install banner */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--primary-soft); border: 1px solid transparent; }
.install-card .stat-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; }
.install-card p { font-size: .84rem; color: var(--primary-text); }

@media print { .bottom-nav, .sticky-actions { display: none !important; } }
