/* ============================================================
   FINAN · Painel Financeiro — design system
   ============================================================ */
:root {
  --bg: #070b14;
  --bg-2: #0b1120;
  --card: rgba(255, 255, 255, 0.04);
  --card-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --text: #e8ebf4;
  --muted: #8b93a7;
  --accent: #10b981;
  --accent-2: #06b6d4;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --grad: linear-gradient(135deg, #10b981, #06b6d4);
  --radius: 18px;
  --sidebar-w: 248px;
  --tabbar-h: 66px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(6, 182, 212, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: pan-y;
}

#app, .shell, .main, #view {
  max-width: 100%;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
img { max-width: 100%; }
::placeholder { color: #5c6478; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Shell ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  background: rgba(11, 17, 32, 0.82);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; }
.brand .b-name { font-weight: 800; font-size: 1.2rem; letter-spacing: 0.4px; }
.brand .b-sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 1.6px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 0.94rem;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(6, 182, 212, 0.14)); color: #4ade80; }
.nav a.active svg { color: #4ade80; }
.nav svg { flex: 0 0 auto; }

.sidebar .userchip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border);
}
.sidebar .userchip .uc-name { font-weight: 700; font-size: 0.9rem; }
.sidebar .userchip .uc-sub { font-size: 0.72rem; color: var(--muted); }
.sidebar .userchip button { margin-left: auto; color: var(--muted); padding: 6px; border-radius: 8px; }
.sidebar .userchip button:hover { color: var(--danger); background: rgba(244, 63, 94, 0.12); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 26px 28px 60px;
  max-width: calc(1200px + var(--sidebar-w));
  width: 100%;
}

/* ---------- Tab bar (mobile) ---------- */
.tabbar { display: none; }

/* ---------- Header da página ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; max-width: 100%; }
.page-head h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.3px; }
.page-head .sub { color: var(--muted); font-size: 0.85rem; width: 100%; margin-top: -6px; }
.page-head .spacer { flex: 1; min-width: 0; }
.page-head .chips { width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { position: relative; overflow: hidden; }
.stat .s-label { font-size: 0.75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; display: flex; align-items: center; gap: 7px; }
.stat .s-value { font-size: 1.5rem; font-weight: 800; margin-top: 8px; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .s-hint { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.stat .s-ico { position: absolute; right: 12px; top: 12px; opacity: 0.5; }
.stat.in .s-value { color: #34d399; }
.stat.out .s-value { color: #fb7185; }
.stat.pos .s-value { color: #34d399; }
.stat.neg .s-value { color: #fb7185; }

.stat.hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(6, 182, 212, 0.10)), var(--card);
  border-color: rgba(16, 185, 129, 0.35);
}
.stat.hero .s-value { font-size: 2.15rem; }
.stat.hero .s-label { color: #6ee7b7; }

/* ---------- Charts ---------- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-bottom: 14px; }
.grid-2 > .card { min-width: 0; }
.card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }

/* barras por usuário */
.ubars { display: flex; flex-direction: column; gap: 12px; }
.ubar-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.ubar-row .u-name { font-size: 0.82rem; font-weight: 700; }
.ubar-row .u-val { font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ubar-track { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 6px; overflow: hidden; grid-column: 1 / -1; }
.ubar-fill { height: 100%; border-radius: 6px; min-width: 3px; transition: width 0.5s ease; }

.person-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.person-card { padding: 16px; }
.person-card .pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.person-card .pc-name { font-weight: 800; font-size: 1rem; }
.person-card .pc-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.person-card .pc-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.person-card .pc-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.person-card .pc-val.in { color: #34d399; }
.person-card .pc-val.out { color: #fb7185; }
.person-card .pc-net { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; }
.person-card .pc-net .pc-val { font-size: 1.05rem; }

.quick-card { margin-bottom: 14px; }
.quick-card .money-wrap input { font-size: 1.55rem; }
.favs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.favs .chip { padding: 6px 11px; font-size: 0.78rem; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--border);
  font-weight: 700; font-size: 0.88rem; color: var(--text);
  transition: transform 0.1s, background 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--grad); border: 0; color: #04110c; }
.btn-primary:hover { background: var(--grad); filter: brightness(1.1); }
.btn-danger { background: rgba(244, 63, 94, 0.14); border-color: rgba(244, 63, 94, 0.4); color: #fb7185; }
.btn-danger:hover { background: rgba(244, 63, 94, 0.22); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 20px; font-size: 1rem; border-radius: 14px; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 10px; }
.btn-wa { background: rgba(37, 211, 102, 0.15); border-color: rgba(37, 211, 102, 0.4); color: #4ade80; }
.btn-wa:hover { background: rgba(37, 211, 102, 0.25); }

/* ---------- Chips / segmented ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
  max-width: 100%;
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-weight: 600; font-size: 0.84rem;
  white-space: nowrap; transition: all 0.15s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--grad); border-color: transparent; color: #04110c; font-weight: 700; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.chip .chip-ico { display: inline-flex; flex: 0 0 auto; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 6px; }
.segmented button {
  padding: 12px; border-radius: 10px; font-weight: 800; font-size: 0.95rem;
  color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.15s;
}
.segmented button.on-out { background: rgba(244, 63, 94, 0.18); color: #fb7185; }
.segmented button.on-in { background: rgba(16, 185, 129, 0.2); color: #34d399; }

/* ---------- Formulários ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.textarea { min-height: 84px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; }
.select option { background: var(--bg-2); color: var(--text); }

.money-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 6px 18px;
}
.money-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.money-wrap .cur { font-size: 1.15rem; color: var(--muted); font-weight: 700; }
.money-wrap input {
  flex: 1; background: none; border: 0; outline: none;
  font-size: 2rem; font-weight: 800; padding: 12px 0;
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}

.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-2 .field { margin-bottom: 0; }

/* upload de comprovante */
.upl {
  border: 1.5px dashed var(--border); border-radius: 14px;
  padding: 16px; display: flex; align-items: center; gap: 12px;
  color: var(--muted); cursor: pointer; transition: all 0.15s;
}
.upl:hover { border-color: var(--accent); color: var(--text); }
.upl .upl-txt b { display: block; color: var(--text); font-size: 0.9rem; }
.upl .upl-txt span { font-size: 0.76rem; }
.upl-preview { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.upl-preview img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; }
.upl-preview .pdf-ico { width: 46px; height: 46px; border-radius: 10px; background: rgba(244, 63, 94, 0.15); display: flex; align-items: center; justify-content: center; color: #fb7185; }
.upl-preview .p-name { font-size: 0.85rem; font-weight: 600; word-break: break-all; }
.upl-preview .p-size { font-size: 0.72rem; color: var(--muted); }
.upl-preview button { margin-left: auto; color: var(--muted); padding: 8px; border-radius: 10px; }
.upl-preview button:hover { color: var(--danger); background: rgba(244, 63, 94, 0.12); }

/* ---------- Lista de transações ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters .input { width: auto; flex: 1; min-width: 150px; padding: 9px 12px; }

.tx-day { font-size: 0.74rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 20px 4px 8px; display: flex; align-items: center; gap: 8px; }
.tx-day::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.tx-day .day-total { font-weight: 600; text-transform: none; letter-spacing: 0; }

.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.tx:hover { background: var(--card-2); }
.tx:active { transform: scale(0.99); }
.tx .tx-ico {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06);
}
.tx .tx-main { flex: 1; min-width: 0; }
.tx .tx-desc { font-weight: 700; font-size: 0.92rem; display: flex; align-items: center; gap: 6px; }
.tx .tx-desc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .tx-meta { font-size: 0.74rem; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .tx-val { font-weight: 800; font-size: 0.98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .tx-val.in { color: #34d399; }
.tx .tx-val.out { color: #fb7185; }
.tx .clip { color: var(--muted); flex: 0 0 auto; }

.more-btn { width: 100%; margin-top: 14px; }

/* ---------- Sheet / modal ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 6, 12, 0.7); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.2s;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 95;
  left: 50%; bottom: 0; transform: translate(-50%, 30px);
  width: min(600px, 100%);
  max-height: 92dvh; overflow-y: auto;
  background: #0d1424; border: 1px solid var(--border);
  border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  opacity: 0; transition: transform 0.25s ease, opacity 0.2s;
}
.sheet.show { transform: translate(-50%, 0); opacity: 1; }
.sheet .grab { width: 42px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); margin: 0 auto 14px; }
.sheet h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.sheet h2 .x { margin-left: auto; color: var(--muted); padding: 6px; border-radius: 10px; }
.sheet h2 .x:hover { background: var(--card); color: var(--text); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.detail-grid .d-item { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.detail-grid .d-item.full { grid-column: 1 / -1; }
.detail-grid .d-label { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; }
.detail-grid .d-val { font-size: 0.9rem; font-weight: 600; margin-top: 4px; word-break: break-word; }
.sheet .actions { display: flex; gap: 8px; }
.sheet .actions .btn { flex: 1; }

.receipt-view { display: block; width: 100%; border-radius: 14px; border: 1px solid var(--border); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #101a2e; border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow); animation: toast-in 0.25s ease;
}
.toast.ok { border-color: rgba(16, 185, 129, 0.5); color: #6ee7b7; }
.toast.err { border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card { width: min(400px, 100%); }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-logo img { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 12px 40px rgba(16, 185, 129, 0.35); }
.login-logo .l-name { font-size: 1.7rem; font-weight: 800; letter-spacing: 0.5px; }
.login-logo .l-sub { color: var(--muted); font-size: 0.8rem; letter-spacing: 2.5px; text-transform: uppercase; margin-top: -8px; }
.login-users { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.login-users button {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px; border-radius: 16px;
  background: var(--card); border: 1.5px solid var(--border);
  font-weight: 700; font-size: 0.85rem; color: var(--muted);
  transition: all 0.15s;
}
.login-users button.on { border-color: var(--accent); color: var(--text); background: rgba(16, 185, 129, 0.1); }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 48px; }
.pass-wrap .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 10px; color: var(--muted); }
.login-err { color: #fda4af; font-size: 0.83rem; font-weight: 600; text-align: center; margin: 10px 0 0; min-height: 1.2em; }

/* ---------- Avatar ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem; color: #04110c;
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; border-radius: 18px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.settings-grid .card.full { grid-column: 1 / -1; }
.list-rows { display: flex; flex-direction: column; gap: 6px; }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid transparent;
}
.list-row .lr-name { font-size: 0.88rem; font-weight: 600; }
.list-row .lr-badge { font-size: 0.66rem; color: var(--muted); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.list-row button { margin-left: auto; color: var(--muted); padding: 6px; border-radius: 8px; }
.list-row button:hover { color: var(--danger); background: rgba(244, 63, 94, 0.12); }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row .input { flex: 1; padding: 9px 12px; }
h4.sec { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin: 16px 0 8px; }
h4.sec:first-child { margin-top: 0; }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .e-ico { display: inline-flex; padding: 18px; border-radius: 20px; background: var(--card); margin-bottom: 14px; }
.empty b { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.empty span { font-size: 0.84rem; }

.skeleton { position: relative; overflow: hidden; background: var(--card); border-radius: var(--radius); min-height: 90px; border: 1px solid var(--border); }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Relatórios ---------- */
.top-cat { display: flex; flex-direction: column; gap: 8px; }
.top-cat .tc-row { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; }
.top-cat .tc-name { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-cat .tc-name .dot { width: 10px; height: 10px; border-radius: 4px; flex: 0 0 auto; }
.top-cat .tc-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top-cat .tc-track { flex: 0 0 100%; order: 2; height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 4px; overflow: hidden; margin: -2px 0 4px; }
.top-cat .tc-row { flex-wrap: wrap; }
.top-cat .tc-fill { height: 100%; border-radius: 4px; }

.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Responsivo / Mobile ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 26px); }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-2 { grid-template-columns: 1fr; }
  .person-grid { grid-template-columns: 1fr; }

  .tabbar {
    display: flex; align-items: stretch; justify-content: space-around;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(9, 13, 24, 0.9);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
  }
  .tabbar a, .tabbar .fab-wrap {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--muted); font-size: 0.62rem; font-weight: 700;
  }
  .tabbar a.active { color: #4ade80; }
  .fab {
    flex: 0 0 auto;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--grad); color: #04110c;
    display: flex; align-items: center; justify-content: center;
    margin-top: -6px;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
  }
  .fab:active { transform: scale(0.9); }

  .stat .s-value { font-size: 1.3rem; }
  .stat.hero .s-value { font-size: 1.8rem; }
  .chart-box { height: 220px; }
  .page-head h1 { font-size: 1.25rem; }
  .report-actions .btn { flex: 1; }
}

@media (max-width: 380px) {
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .stat.hero { grid-column: 1 / -1; }
}

/* iOS standalone: esconde dicas de "adicionar à tela" quando instalado */
.only-standalone { display: none; }
@media (display-mode: standalone) {
  .only-standalone { display: block; }
  .only-browser { display: none !important; }
}
