:root {
  --bg: #07111f;
  --bg2: #0d1a2e;
  --card: rgba(15, 23, 42, 0.82);
  --card-strong: rgba(10, 17, 34, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e8eefc;
  --muted: #b8c4e2;
  --soft: #8ea0c8;
  --gold: #f5d08a;
  --gold-2: #caa66a;
  --accent: #8fc8ff;
  --success: #a8efc0;
  --warning: #ffd89c;
  --danger: #ffb1b1;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(157, 205, 255, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(245, 208, 138, 0.10), transparent 26%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.page {
  width: min(1200px, calc(100% - 28px));
  margin: 0 auto;
  padding: 10px 0 54px;
}

.auth-shell {
  width: min(1200px, calc(100% - 28px));
  margin: 22px auto 0;
}
.auth-wrap {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: 18px;
  margin-bottom: 18px;
}
.auth-card {
  background: rgba(9, 14, 27, 0.86);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 22px;
}
.auth-kicker {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--gold);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.auth-title { margin: 14px 0 8px; font-size: clamp(1.15rem, 2vw, 1.8rem); line-height: 1.12; }
.auth-copy, .auth-message { color: var(--muted); line-height: 1.65; margin: 0; }
.auth-message { margin-top: 10px; }
.auth-status-row, .auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.auth-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .84rem;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--muted);
}
.auth-badge.is-ok { color: var(--success); background: rgba(168,239,192,.12); }
.auth-badge.is-warn { color: var(--warning); background: rgba(255,216,156,.10); }
.auth-badge.is-muted { color: var(--muted); }
.auth-form { margin-top: 14px; display: grid; gap: 8px; }

.auth-copy-soft { margin-top: 10px; }
.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.password-row .control { margin: 0; }
.icon-btn,
.text-btn {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  border-radius: 14px;
  min-height: 48px;
  padding: 0 14px;
  cursor: pointer;
}
.text-btn {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  font-weight: 600;
}
.auth-inline-actions {
  display: flex;
  justify-content: flex-end;
}
button:disabled {
  opacity: .68;
  cursor: not-allowed;
  transform: none !important;
}

.auth-card-sync {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}
.auth-copy-col {
  min-width: 0;
}
.auth-status-col {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.auth-status-row-tight {
  justify-content: flex-end;
}
.sync-card {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.sync-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.sync-title {
  font-size: 1rem;
}
.sync-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .84rem;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--muted);
}
.sync-pill.is-ok { color: var(--success); background: rgba(168,239,192,.12); }
.sync-pill.is-warn { color: var(--warning); background: rgba(255,216,156,.10); }
.sync-pill.is-muted { color: var(--muted); }
.sync-pill.is-danger { color: var(--danger); background: rgba(255,177,177,.12); }
.sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.sync-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.sync-label {
  display: block;
  color: var(--muted);
  font-size: .84rem;
  margin-bottom: 6px;
}
.sync-item strong {
  display: block;
  line-height: 1.4;
  word-break: break-word;
}
.sync-help {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  min-height: 360px;
  padding: 34px;
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(8px);
}
.hero::before {
  width: 240px;
  height: 240px;
  right: -80px;
  top: -30px;
  background: radial-gradient(circle, rgba(245, 208, 138, 0.22), transparent 70%);
}
.hero::after {
  width: 260px;
  height: 260px;
  left: -80px;
  bottom: -70px;
  background: radial-gradient(circle, rgba(137, 196, 255, 0.18), transparent 70%);
}

.eyebrow, .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}

.pill-row, .tab-row, .actions, .summary-actions, .button-row, .metrics-grid, .print-grid, .labels-grid, .moves-list, .notes-grid, .form-grid, .control-grid, .topbar, .buy-row { display: flex; gap: 14px; }

.hero h1 {
  margin: 18px 0 12px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.hero-subtitle {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 0 0 18px;
}
.hero-copy {
  max-width: 760px;
  color: var(--text);
  line-height: 1.72;
}
.hero-copy p { margin: 0 0 10px; }
.hero-copy .soft { color: var(--soft); font-style: italic; }
.hero-copy .strong { color: var(--gold); }
.pill-row { flex-wrap: wrap; margin-top: 20px; }

.panel {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
}
.panel-title { font-size: .95rem; color: var(--gold); margin-bottom: 6px; }

.snapshot { padding: 26px; }
.control-grid { gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.field-wrap, .form-grid > .field { flex: 1 1 180px; }
.form-grid.compact > .field { flex-basis: 180px; }
.field.full { flex-basis: 100%; }
.label { display: block; color: var(--muted); font-size: .93rem; margin: 0 0 8px; }
.control, input, select, textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}
input::placeholder, textarea::placeholder { color: #a9b4d0; }
.control:focus, input:focus, select:focus, textarea:focus {
  border-color: rgba(143, 200, 255, .7);
  box-shadow: 0 0 0 4px rgba(143,200,255,.12);
}

.snapshot-title, .section-title { font-size: 1.2rem; margin: 0 0 8px; }
.snapshot-sub, .section-sub, .small-muted, .footer-note, .history-meta, .compare-meta, .muted-line, .hint { color: var(--muted); line-height: 1.65; }
.inline-note, .goal-sub, .envelope-week, .kpi-card .hint, .metric-hint { color: var(--soft); }

.metrics-grid { flex-wrap: wrap; margin-top: 18px; }
.metric, .summary-box, .kpi-card, .compare-card, .history-card, .form-card, .goal-card, .ledger-card, .bill-card, .alert-card, .status-card, .empty-state, .day-group, .note-card, .move-row, .envelope-card, .print-envelope, .print-label {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}
.metric {
  flex: 1 1 220px;
  min-width: 0;
  border-radius: var(--radius-lg);
}
.metric-top, .goal-head, .bill-head, .ledger-head, .day-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.metric-label, .compare-label { color: var(--muted); font-size: .92rem; }
.metric-value, .goal-amount, .envelope-amount, .kpi-card .value { font-size: 1.5rem; font-weight: 700; margin-top: 8px; }
.metric-icon { font-size: 1.45rem; }

.topbar { position: sticky; top: 8px; z-index: 15; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 12px 0 18px; padding: 14px; border-radius: 22px; background: rgba(7,17,31,.72); backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.08); }
.tab-row { flex-wrap: wrap; }
.tab-btn, .primary-btn, .secondary-btn, .full-btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.tab-btn:hover, .primary-btn:hover, .secondary-btn:hover, .full-btn:hover { transform: translateY(-1px); }
.tab-btn { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,.05); color: var(--muted); border: 1px solid rgba(255,255,255,.1); }
.tab-num { display:inline-flex; align-items:center; justify-content:center; width: 28px; height: 28px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--gold); font-size: .88rem; font-weight: 700; }
.tab-label { font-weight: 700; }
.tab-btn.active { background: linear-gradient(135deg, rgba(245,208,138,.24), rgba(143,200,255,.16)); color: var(--text); border-color: rgba(245,208,138,.34); }
.primary-btn, a.primary-btn, a.primary-btn:visited { background: linear-gradient(135deg, #ead1a0, #b98e5a); color: #101827; font-weight: 700; text-decoration: none; }
.secondary-btn, .full-btn, a.secondary-btn, a.secondary-btn:visited { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid rgba(255,255,255,.12); text-decoration: none; }
.btn-inline { padding: 10px 14px; min-height: auto; }

.stack { display: grid; gap: 18px; }
.section { padding: 22px; }
.notes-grid, .form-grid, .print-grid, .labels-grid, .buy-row, .bill-actions, .tag-row, .inline-actions, .split-grid { flex-wrap: wrap; }
.notes-grid, .small-grid, .alert-grid, .compare-grid, .history-grid, .history-metrics, .goals-grid, .summary-grid, .kpi-grid, .envelope-grid, .bill-list, .ledger-list, .goal-list, .nested-list, .table-like { display: grid; gap: 14px; }
.small-grid, .compare-grid, .history-grid, .goals-grid, .summary-grid, .kpi-grid, .alert-grid, .envelope-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.history-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.alert-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.note-card { flex: 1 1 280px; }
.note-title, .print-kicker, .label-kicker { color: var(--gold); margin-bottom: 8px; font-size: .84rem; letter-spacing: .06em; text-transform: uppercase; }
.note-body, .goal-meta, .ledger-meta, .bill-meta { color: var(--muted); line-height: 1.6; }

.envelope-head, .bill-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.envelope-title, .goal-title { font-weight: 700; }
.mini-badge, .badge, .status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--muted);
}
.mini-badge-danger, .status-overdue, .ledger-amount.expense, .move-amount { color: var(--danger); }
.status-paid, .ledger-amount.income, .move-amount.income { color: var(--success); }
.status-pending { color: var(--warning); }
.status-paid { background: rgba(168,239,192,.14); }
.status-overdue { background: rgba(255,177,177,.14); }
.status-pending { background: rgba(255,216,156,.12); }
.status-card.status-good, .alert-good { border-color: rgba(168,239,192,.25); }
.status-card.status-warn, .alert-warn { border-color: rgba(255,216,156,.25); }
.status-card.status-bad, .alert-danger, .envelope-card.is-over { border-color: rgba(255,177,177,.28); }

.progress-shell, .goal-progress {
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
}
.progress-fill, .goal-progress > span {
  height: 100%;
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(143,200,255,.85), rgba(245,208,138,.85));
}

.print-grid .print-envelope { flex: 1 1 340px; }
.labels-grid .print-label { flex: 1 1 220px; }
.print-title, .label-title { font-size: 1.3rem; font-weight: 700; margin: 10px 0 6px; }
.print-brand, .label-brand { color: var(--muted); }
.print-amount-box {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  font-weight: 700;
  margin-top: 12px;
}
.print-ritual { margin: 16px 0; color: var(--muted); line-height: 1.6; }
.print-fields { display: grid; gap: 10px; }
.print-fields div { display: flex; justify-content: space-between; gap: 16px; }
.buy-row { align-items: center; }
.buy-row .control { flex: 1 1 240px; }
.buy-result { margin-top: 14px; }

.empty-state {
  color: var(--muted);
  border-style: dashed;
}
.section-gap { margin-top: 18px; }
.history-card-active { border-color: rgba(143,200,255,.28); }
.value, .ledger-amount { font-weight: 800; font-size: 1.05rem; }
.compare-card strong, .history-card strong, .alert-card strong { display: block; margin: 4px 0 8px; font-size: 1.04rem; }
.history-metrics span, .compare-label { color: var(--muted); }
.moves-list { flex-direction: column; }
.move-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.move-title { font-weight: 600; }
.move-note { color: var(--muted); margin-top: 6px; }

.modal-shell {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 18, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  width: min(760px, 100%);
  background: var(--card-strong);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 26px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.hidden { display: none !important; }

@media (max-width: 960px) {
  .auth-wrap, .hero-grid { grid-template-columns: 1fr; }
  .auth-card-sync { grid-template-columns: 1fr; }
  .auth-status-col { justify-items: stretch; }
}

@media (max-width: 700px) {
  .sync-grid { grid-template-columns: 1fr; }
  .page, .auth-shell { width: min(100% - 20px, 1100px); }
  .hero, .snapshot, .section, .auth-card { padding: 20px; }
  .bill-actions, .goal-head, .bill-row, .auth-actions { align-items: stretch; }
  .btn-inline, .auth-actions .primary-btn, .auth-actions .secondary-btn { width: 100%; }
}

@media print {
  .no-print, .auth-shell, .modal-shell { display: none !important; }
  body { background: white; color: #111827; }
  .card, .summary-box, .goal-card, .ledger-card, .bill-card, .alert-card, .kpi-card, .envelope-card, .note-card, .move-row, .print-envelope, .print-label {
    box-shadow: none;
    background: white;
    color: #111827;
    border-color: rgba(17,24,39,.12);
  }
  .print-only { display: block !important; }
}

.guide-mini { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:0 0 18px; padding:14px 16px; border-radius:18px; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); }
.guide-mini-kicker { color: var(--gold); font-size: .84rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.guide-mini-copy { color: var(--muted); line-height: 1.55; }
.onboarding-card { margin: 0 0 18px; }
.onboarding-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.onboarding-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; }
.onboarding-step { text-align:left; padding:16px; border-radius:18px; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: var(--text); cursor:pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.onboarding-step:hover { transform: translateY(-1px); border-color: rgba(245,208,138,.28); background: rgba(255,255,255,.06); }
.onboarding-step strong { display:block; margin-bottom:8px; }
.onboarding-step span { color: var(--muted); line-height: 1.55; }
.onboarding-actions { display:flex; flex-wrap:wrap; gap:12px; }
.section-gap { margin-top: 16px; }
.panel-flash { animation: panelFlash 1.1s ease; }
@keyframes panelFlash { 0% { box-shadow: 0 0 0 0 rgba(245,208,138,.0); } 30% { box-shadow: 0 0 0 4px rgba(245,208,138,.18); } 100% { box-shadow: 0 0 0 0 rgba(245,208,138,0); } }
@media (max-width: 700px) { .topbar { top: 6px; } .onboarding-head, .guide-mini { align-items: stretch; } .guide-mini { flex-direction: column; } }

/* Final public version polish */
.compact-hero {
  padding: 20px 22px;
  margin-bottom: 16px;
}
.compact-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.compact-title {
  margin: 10px 0 6px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.18;
}
.mini-note {
  color: var(--soft);
  font-size: .95rem;
  line-height: 1.55;
}
.compact-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.mini-select {
  display: grid;
  gap: 6px;
  min-width: 110px;
}
.mini-select span {
  color: var(--muted);
  font-size: .82rem;
}
.compact-control {
  min-height: 42px;
  padding: 10px 12px;
}
.compact-summary .summary-box {
  min-height: 92px;
}
.period-card {
  padding-top: 18px;
}
.section-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.compact-topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  background: rgba(7, 17, 31, .72);
  backdrop-filter: blur(18px);
  border-radius: 22px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.08);
}
.compact-tabs {
  flex-wrap: wrap;
}
.compact-actions {
  margin-top: 10px;
  flex-wrap: wrap;
}
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.action-tile {
  justify-content: center;
  min-height: 56px;
}
.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.inner-card {
  background: rgba(255,255,255,.02);
}
.compact-range-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.range-line {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  margin-top: 12px;
}
.range-line-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.readonly-field .readonly-value {
  min-height: 48px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  padding: 0 14px;
}
.readonly-value.pos { color: var(--success); }
.readonly-value.neg { color: var(--danger); }
.neg { color: var(--danger) !important; }
.pos { color: var(--success) !important; }
.bill-card,
.goal-card,
.ledger-card {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  padding: 16px;
}
.bill-list,
.goal-list,
.ledger-list {
  display: grid;
  gap: 12px;
}
.bill-head,
.goal-head,
.ledger-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.bill-meta,
.goal-meta,
.ledger-meta,
.inline-note {
  color: var(--muted);
  line-height: 1.55;
  font-size: .92rem;
}
.goal-progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
  margin-top: 12px;
}
.goal-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(143,200,255,.9), rgba(245,208,138,.9));
}
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.05);
  font-size: .84rem;
}
.status-paid { color: var(--success); }
.status-pending { color: var(--warning); }
.status-overdue { color: var(--danger); }
.empty-state {
  color: var(--muted);
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,.12);
  padding: 16px;
}
.compact-auth .auth-title,
.auth-shell .auth-title {
  font-size: 1.15rem;
}
.auth-shell .auth-copy,
.auth-shell .sync-help {
  font-size: .94rem;
}
.auth-shell .sync-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.auth-shell .auth-card-sync {
  grid-template-columns: 1fr auto;
}
.auth-shell .sync-card {
  margin-top: 12px;
}
.auth-shell .auth-card {
  padding: 18px;
}
@media (max-width: 980px) {
  .split-grid { grid-template-columns: 1fr; }
  .compact-range-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-shell .sync-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .compact-topbar { top: 6px; }
  .compact-range-grid { grid-template-columns: 1fr; }
  .compact-summary, .summary-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr 1fr; }
  .auth-shell .auth-wrap { grid-template-columns: 1fr; }
  .auth-shell .auth-status-col { justify-items: stretch; }
  .auth-shell .auth-card-sync { grid-template-columns: 1fr; }
}

body.billing-locked #app {
  display: none;
}
body.billing-unlocked #app {
  display: block;
}
.billing-card {
  margin-bottom: 18px;
}
.billing-top {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.billing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.billing-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
}
.billing-help {
  color: var(--muted);
  line-height: 1.65;
  margin: 16px 0 0;
}
.billing-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.billing-actions a {
  text-decoration: none;
}
@media (max-width: 980px) {
  .billing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .billing-grid {
    grid-template-columns: 1fr;
  }
  .billing-actions .primary-btn,
  .billing-actions .secondary-btn,
  .billing-actions a.primary-btn,
  .billing-actions a.secondary-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}


/* Publicable simple v2: mobile-first fixes */
.tax-notes {
  min-height: 120px;
  resize: vertical;
}

@media (max-width: 700px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
  }

  .page {
    width: 100%;
    padding: 8px 10px 98px;
  }

  .compact-hero,
  .period-card,
  .section {
    border-radius: 20px;
  }

  .compact-hero {
    padding: 14px;
    margin-bottom: 10px;
  }

  .compact-title {
    font-size: 1.08rem;
    line-height: 1.25;
  }

  .mini-note,
  .section-sub,
  .hint {
    font-size: .9rem;
    line-height: 1.5;
  }

  .compact-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .summary-grid,
  .compact-summary,
  .small-grid,
  .compare-grid,
  .history-grid,
  .goals-grid,
  .kpi-grid,
  .alert-grid,
  .envelope-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar.compact-topbar {
    position: sticky;
    top: auto;
    bottom: 8px;
    z-index: 40;
    margin: 12px 0 0;
    padding: 8px;
    border-radius: 18px;
    max-height: none;
  }

  .compact-tabs,
  .compact-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .compact-tabs::-webkit-scrollbar,
  .compact-actions::-webkit-scrollbar {
    display: none;
  }

  .tab-btn,
  .compact-actions .btn-inline {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 9px 10px;
    font-size: .82rem;
    white-space: nowrap;
  }

  .tab-num {
    width: 22px;
    height: 22px;
    font-size: .74rem;
  }

  .tab-label {
    font-size: .82rem;
  }

  .control,
  input,
  select,
  textarea {
    min-height: 44px;
    padding: 10px 12px;
  }

  .metric,
  .summary-box,
  .kpi-card,
  .compare-card,
  .history-card,
  .form-card,
  .goal-card,
  .ledger-card,
  .bill-card,
  .alert-card,
  .status-card,
  .empty-state,
  .day-group,
  .note-card,
  .move-row,
  .envelope-card,
  .print-envelope,
  .print-label {
    padding: 14px;
  }

  .section-headline {
    gap: 8px;
  }

  .ledger-head,
  .bill-head,
  .goal-head {
    gap: 8px;
  }
}

body:not(.billing-locked) #app {
  display: block;
}


/* Dinero en Paz v3 — cuenta, nube y respaldo */
.cloud-panel {
  margin: 14px 0 18px;
}
.cloud-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
.cloud-auth-form {
  margin-top: 14px;
}
.cloud-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}
.cloud-actions .text-btn {
  min-height: 42px;
  padding: 0 4px;
}
.cloud-panel a {
  color: var(--gold);
  text-decoration: none;
}
.cloud-panel a:hover {
  text-decoration: underline;
}
.cloud-panel a.primary-btn,
.cloud-panel a.primary-btn:visited {
  color: #101827;
}
.cloud-panel a.secondary-btn,
.cloud-panel a.secondary-btn:visited {
  color: var(--text);
}

@media (max-width: 820px) {
  .cloud-grid {
    grid-template-columns: 1fr;
  }
  .cloud-actions .btn-inline {
    flex: 1 1 auto;
  }
}

@media (max-width: 700px) {
  .cloud-panel {
    padding: 16px;
  }
  .cloud-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .cloud-actions .btn-inline,
  .cloud-actions .text-btn {
    width: 100%;
  }
}


.install-card {
  background: linear-gradient(135deg, rgba(245, 208, 138, 0.10), rgba(143, 200, 255, 0.07));
}
.install-steps {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.install-step {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
}
.install-step strong {
  color: var(--gold);
}
.install-step span {
  color: var(--muted);
  line-height: 1.55;
}
.install-note {
  color: var(--success);
}

/* v3.3.6 — Stripe membership choices */
.strong-help {
  font-weight: 800;
  color: #ffd89c;
  line-height: 1.65;
  background: rgba(255,216,156,.10);
  border: 1px solid rgba(255,216,156,.20);
  padding: 12px 14px;
  border-radius: 14px;
}
.membership-choice-box {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border: 1px solid rgba(124, 91, 35, 0.22);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.72);
}
.membership-buy-now-box {
  border-color: rgba(22, 101, 52, 0.24);
  background: rgba(240, 253, 244, 0.72);
}
.membership-pay-actions {
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}


/* v3.3.9 — membresía clara, contraste corregido y fallback Stripe */
.membership-card .strong-help,
.membership-locked-panel .strong-help {
  color: #ffe8b8;
  background: rgba(255, 216, 156, 0.14);
  border-color: rgba(255, 216, 156, 0.32);
  text-shadow: 0 1px 1px rgba(0,0,0,.2);
}
.membership-card .success-help {
  color: #c8f7dc;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.28);
}
.membership-choice-box {
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.12);
  color: var(--text);
}
.membership-choice-box .sync-label,
.membership-choice-box .sync-help {
  color: rgba(236, 242, 255, .88);
}
.membership-choice-box .choice-title {
  color: #fff3d6;
  font-weight: 800;
  letter-spacing: .01em;
}
.membership-buy-now-box {
  background: rgba(40, 92, 69, 0.18);
  border-color: rgba(126, 231, 177, .26);
}
.membership-trial-box {
  background: rgba(106, 83, 42, 0.18);
  border-color: rgba(255, 216, 156, .22);
}
.membership-active-box {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(126, 231, 177, .30);
}
.membership-card .mini-help,
.membership-locked-panel .mini-help {
  margin-top: 6px;
  font-size: .9rem;
}
.membership-card .active-plan-note {
  color: #d6ffe6;
  font-weight: 650;
}
.membership-status-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 760px) {
  .membership-status-grid { grid-template-columns: 1fr; }
}

/* v3.3.12 — panel de membresía más limpio para cliente */
.membership-card-clean .sync-help {
  line-height: 1.55;
}
.membership-card-clean .client-clean-box {
  padding: 1rem;
}
.membership-main-actions {
  margin-top: .85rem;
}
.membership-support-details {
  margin-top: .9rem;
  padding: .8rem .9rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.045);
}
.membership-support-details summary {
  cursor: pointer;
  color: rgba(236,242,255,.86);
  font-weight: 750;
}
.membership-support-details[open] summary {
  margin-bottom: .45rem;
}
.membership-card-clean .membership-choice-box .choice-title {
  font-size: 1rem;
}
.membership-card-clean .membership-pay-actions .primary-btn,
.membership-card-clean .membership-pay-actions .secondary-btn {
  min-width: 170px;
  justify-content: center;
}
@media (max-width: 520px) {
  .membership-card-clean .membership-pay-actions .primary-btn,
  .membership-card-clean .membership-pay-actions .secondary-btn {
    width: 100%;
    min-width: 0;
  }
}

/* v3.3.29 — aviso visible para membresía automática y cambio de plan */
.membership-card-clean .membership-notice {
  margin-top: .75rem;
  padding: .75rem .85rem;
  border-radius: 14px;
  border: 1px solid rgba(245, 208, 138, .34);
  background: rgba(245, 208, 138, .10);
  color: #fdecc8;
  font-weight: 700;
}
