*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f2f5fa;
  --text: #0b0d12;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --blue: #2563ff;
  --green: #10b981;
  --green-ink: #067a5b;
  --amber-ink: #b45309;
  --red: #dc2626;
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 8px 30px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 18px 60px rgba(15, 23, 42, 0.08);
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
  --tabbar-h: 64px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: var(--font); cursor: pointer; color: inherit; background: none; border: none; }
input, select, textarea { font-family: var(--font); font-size: 16px; color: var(--text); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(37, 99, 255, 0.15); }

#app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}
.card h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 14px; }
.card-sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}

/* ===== Hero ===== */
.hero {
  padding: 24px 22px;
  background:
    radial-gradient(circle at 12% 0%, rgba(232, 75, 138, 0.06), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(37, 99, 255, 0.07), transparent 40%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}
.hero-value {
  font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05;
  font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.hero-delta { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.hero-delta .up { color: var(--green-ink); }
.hero-delta .down { color: var(--amber-ink); }
.hero-delta .vs { color: var(--muted); font-weight: 500; }
.hero-split { display: flex; gap: 18px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.hero-split strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.split-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* Hero KPI stat boxes */
.stat-boxes { display: flex; gap: 8px; margin-top: 6px; }
.stat-box { flex: 1; min-width: 0; border-radius: var(--radius-md); padding: 11px 13px; border: 1px solid transparent; }
.sb-label { font-size: 11.5px; font-weight: 650; margin-bottom: 3px; opacity: 0.85; }
.sb-value { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-green { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); color: var(--green-ink); }
.stat-red { background: rgba(220, 38, 38, 0.09); border-color: rgba(220, 38, 38, 0.2); color: var(--red); }
.stat-blue { background: rgba(37, 99, 255, 0.09); border-color: rgba(37, 99, 255, 0.2); color: var(--blue); }
.stat-neutral { background: var(--surface-soft); border-color: var(--border); color: var(--ink-2); }
.hero-avg { text-align: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.hero-avg strong { color: var(--ink-2); font-weight: 750; font-variant-numeric: tabular-nums; }

/* ===== Month switcher ===== */
.page-head { margin-bottom: 14px; }
.mode-seg { display: inline-flex; background: var(--surface-soft); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 10px; }
.mode-seg button { min-height: 34px; padding: 5px 20px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--muted); }
.mode-seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
.potential-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.potential-card .pc-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--blue); font-variant-numeric: tabular-nums; margin: 2px 0; }
.potential-card .pc-ic { font-size: 30px; opacity: 0.85; }
.plan-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px 0; min-height: 54px; border-top: 1px solid var(--border); }
.plan-row:first-of-type { border-top: none; }
.plan-main { flex: 1; min-width: 0; text-align: left; }
.plan-stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.step-btn { width: 32px; height: 32px; border-radius: 9px; border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 19px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; justify-content: center; line-height: 1; }
.step-btn:active { background: var(--surface-soft); }
.plan-remaining { min-width: 26px; text-align: center; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--blue); }
.plan-name { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.plan-badge { font-size: 10.5px; font-weight: 700; color: #7c3aed; background: rgba(124, 58, 237, 0.1); border-radius: 999px; padding: 2px 8px; }
.plan-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.plan-pot { font-size: 15px; font-weight: 750; color: var(--blue); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.month-switch { display: flex; align-items: center; gap: 2px; margin-bottom: 12px; }
.month-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; flex: 1; text-align: center; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); transition: background 0.15s;
}
.icon-btn:active { background: var(--surface-soft); }
.icon-btn:disabled { color: var(--muted-2); cursor: default; }
.icon-btn svg { width: 22px; height: 22px; }

/* ===== Chips ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 8px 15px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chip.active { border-color: var(--text); background: var(--text); color: #fff; }
.chip.active-tint { color: var(--text); }
.chip-hint { font-size: 12px; color: var(--muted-2); font-weight: 500; }
.chip.active .chip-hint, .chip.active-tint .chip-hint { color: inherit; opacity: 0.65; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 16px; font-weight: 700; transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--text); color: #fff; width: 100%; }
.btn-primary:disabled { opacity: 0.35; cursor: default; }
.btn-ghost { background: var(--surface-soft); color: var(--ink-2); }
.btn-danger { background: rgba(220, 38, 38, 0.08); color: var(--red); }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: var(--radius-sm); }
.text-btn { font-size: 13px; font-weight: 600; color: var(--blue); padding: 6px 4px; }

/* ===== Paid pill ===== */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 40px; min-width: 86px; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; border: 1px solid transparent;
  transition: background 0.15s;
}
.pill-paid { background: rgba(16, 185, 129, 0.1); color: var(--green-ink); border-color: rgba(16, 185, 129, 0.22); }
.pill-open { background: rgba(245, 158, 11, 0.1); color: var(--amber-ink); border-color: rgba(245, 158, 11, 0.25); }
.pill-planned { background: rgba(37, 99, 255, 0.1); color: var(--blue); border-color: rgba(37, 99, 255, 0.22); }

/* ===== Goals ===== */
.goal-row { margin-bottom: 16px; }
.goal-row:last-child { margin-bottom: 2px; }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; gap: 10px; }
.goal-name { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.goal-name .dot { width: 9px; height: 9px; border-radius: 50%; }
.goal-nums { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-nums strong { color: var(--text); font-weight: 700; }
.goal-track { height: 8px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.goal-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.goal-done { font-size: 12px; color: var(--green-ink); font-weight: 650; margin-top: 5px; }

/* ===== Chart ===== */
.chart-slot { min-height: 200px; }
.chart-slot svg { display: block; }
.chart-empty {
  height: 180px; display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); font-size: 14px;
}
.chart-caption {
  margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: center;
  min-height: 18px; font-variant-numeric: tabular-nums;
}
.legend { display: flex; gap: 14px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 550; }
.legend-item .dot { width: 8px; height: 8px; border-radius: 50%; }
.swatch-hatch {
  width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0;
  border: 1px dashed var(--pc);
  background: color-mix(in srgb, var(--pc) 20%, transparent);
}

/* Month detail sheet (tap a bar in Verlauf) */
.detail-summary { margin: 4px 0 14px; }
.ds-total { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ds-splits { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.ds-splits strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.detail-biz { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; margin-bottom: 4px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.db-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.db-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.db-name { flex: 1; color: var(--ink-2); font-weight: 550; }
.db-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.detail-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow-y: auto; margin-top: 10px; }
.detail-row { display: flex; align-items: center; gap: 11px; padding: 9px 2px; }
.detail-row + .detail-row { border-top: 1px solid var(--border); }
.detail-main { flex: 1; min-width: 0; }
.detail-name { font-size: 14.5px; font-weight: 650; }
.detail-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.detail-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.detail-amt { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }

/* Auto initials-avatars (identity, not data-encoding) */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; line-height: 1; letter-spacing: -0.01em; text-transform: uppercase; }
.chip-ic { font-size: 15px; line-height: 1; }
.m-ic { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.ic-img { width: 1.4em; height: 1.4em; object-fit: cover; border-radius: 5px; display: inline-block; vertical-align: middle; }
.logo-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; display: block; }
.logo-preview:empty { display: none; }
.bar-hit { cursor: pointer; }

/* ===== Horizontal bars ===== */
.hbar { margin-bottom: 13px; }
.hbar:last-child { margin-bottom: 2px; }
.hbar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 10px; }
.hbar-label { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar-label .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hbar-label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; }

/* ===== Aging / open payments ===== */
.age-group { border-top: 1px solid var(--border); }
.age-group:first-of-type { border-top: none; }
.age-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 13px 0; text-align: left; min-height: 52px;
}
.age-head .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.age-info { flex: 1; min-width: 0; }
.age-name { font-size: 15px; font-weight: 650; }
.age-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.age-meta .age-warn { color: var(--amber-ink); font-weight: 600; }
.age-meta .age-late { color: var(--red); font-weight: 600; }
.age-sum { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.age-chev { color: var(--muted-2); transition: transform 0.2s; }
.age-group.open .age-chev { transform: rotate(180deg); }
.age-body { padding: 2px 0 14px; }
.age-entry {
  display: flex; align-items: center; gap: 10px; padding: 7px 0 7px 20px;
  font-size: 13px; color: var(--ink-2);
}
.age-entry .age-date { min-width: 74px; font-variant-numeric: tabular-nums; }
.age-entry .age-what { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.age-entry .age-amt { font-weight: 650; font-variant-numeric: tabular-nums; }
.check-btn {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(16, 185, 129, 0.1); color: var(--green-ink); flex-shrink: 0;
}
.age-payall { margin: 6px 0 0 20px; }
.all-paid { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 0; color: var(--muted); font-size: 14px; }
.all-paid .big { font-size: 30px; }

/* ===== All-time strip ===== */
.alltime {
  text-align: center; font-size: 12.5px; color: var(--muted); padding: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}

/* ===== Offline banner ===== */
.banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--amber-ink); border-radius: var(--radius-md);
  padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}

/* ===== Entry list ===== */
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-btn { flex: 1; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-md); border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 15px; text-align: left; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-btn.active { border-color: var(--text); }
.check-list { max-height: 52vh; overflow-y: auto; margin-bottom: 4px; }
.check-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 4px; border-top: 1px solid var(--border); text-align: left; min-height: 56px; }
.check-item:first-child { border-top: none; }
.check-item .ci-name { flex: 1; font-size: 15px; font-weight: 600; }
.check-item .ci-check { color: var(--green-ink); font-weight: 800; width: 20px; text-align: center; font-size: 16px; }
.filter-row select {
  flex: 1; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong); background: var(--surface);
  font-weight: 600; font-size: 15px; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.list-summary { font-size: 13px; color: var(--muted); margin: 2px 2px 10px; font-variant-numeric: tabular-nums; }
.month-header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 4px 8px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.month-header .mh-sum { font-variant-numeric: tabular-nums; font-weight: 650; }
.entry-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.entry-row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 14px; min-height: 62px; border-top: 1px solid var(--border);
  transition: background 0.15s;
}
.entry-row:first-child { border-top: none; }
.entry-row:active { background: var(--surface-soft); }
.entry-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.entry-main { flex: 1; min-width: 0; }
.entry-name { font-size: 15px; font-weight: 650; }
.entry-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.entry-amount { font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.empty-state { padding: 34px 20px; text-align: center; color: var(--muted-2); font-size: 14px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 9px;
}
.form-input {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); outline: none; transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--text); }
.seg { display: flex; background: var(--surface-soft); border-radius: var(--radius-md); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; min-height: 42px; border-radius: 11px; font-size: 14px; font-weight: 650;
  color: var(--muted); transition: background 0.15s, color 0.15s;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
/* Compact entry form */
.entry-form { margin-top: 4px; }
.entry-form .form-group { margin-bottom: 10px; }
.entry-form .form-label { margin-bottom: 6px; }
.biz-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.biz-row .chips { gap: 6px; flex: 0 0 auto; }
.biz-row .seg-sm { flex: 1; min-width: 150px; }
.chip-icon-only { padding: 8px 13px; min-height: 42px; }
.seg-sm button { min-height: 40px; font-size: 13.5px; }
.form-input-date { width: auto; min-width: 165px; }
/* iOS renders type=date top-aligned with a different inner box; normalise to match text inputs */
.form-input-date { -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
.form-input-date::-webkit-date-and-time-value { text-align: left; margin: 0; }
.chip-more { color: var(--blue); border-style: dashed; }
.entry-form .chips-wrap { gap: 7px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.form-row .form-col { margin-bottom: 0; min-width: 0; }
.form-row .form-input { width: 100%; box-sizing: border-box; }
.form-row .form-input-date { min-width: 0; }
.entry-form .form-row + .amount-note { margin-top: 7px; margin-bottom: 10px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; padding: 4px 2px; width: 100%; text-align: left;
}
.toggle-row .t-label { font-size: 15px; font-weight: 600; }
.toggle { width: 51px; height: 31px; border-radius: 999px; background: rgba(15, 23, 42, 0.12); position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  transition: left 0.2s;
}
.toggle.on { background: var(--green); }
.toggle.on::after { left: 22px; }
.amount-note { font-size: 12.5px; color: var(--muted); margin-top: 7px; display: flex; gap: 10px; align-items: center; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}
.swatch.active { border-color: var(--text); transform: scale(1.08); }
.icon-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-opt { width: 44px; height: 44px; border-radius: var(--radius-md); border: 1.5px solid var(--border-strong); background: var(--surface); font-size: 22px; display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, background 0.15s; }
.icon-opt.active { border-color: var(--text); background: var(--surface-soft); }
.subject-edit { display: flex; gap: 8px; }
.subject-edit .form-input { flex: 1; }
.tag { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-soft); border-radius: 999px; padding: 8px 9px 8px 14px; font-size: 13.5px; font-weight: 600; margin: 0 7px 8px 0; }
.tag button { color: var(--muted); font-size: 15px; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.tag button:active { background: rgba(15, 23, 42, 0.08); }
.form-hint { font-size: 13px; color: var(--muted); }

/* ===== Manage rows ===== */
.m-row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 13px 2px; min-height: 56px; border-top: 1px solid var(--border);
}
.m-row:first-of-type { border-top: none; }
.m-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.m-main { flex: 1; min-width: 0; }
.m-name { font-size: 15px; font-weight: 650; }
.m-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.m-badge { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface-soft); border-radius: 999px; padding: 3px 9px; }
.m-chev { color: var(--muted-2); }
.m-add { margin-top: 10px; }
.m-arch-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 12px 2px; margin-top: 4px; border-top: 1px solid var(--border);
  font-size: 13.5px; font-weight: 650; color: var(--muted);
}
.m-arch-toggle .m-chev { transition: transform 0.2s; }
.m-arch-toggle.open .m-chev { transform: rotate(90deg); }
.m-arch-list .m-row { opacity: 0.72; }

/* ===== Sheets ===== */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(11, 13, 18, 0.4); opacity: 0; transition: opacity 0.22s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 640px; margin: 0 auto; box-shadow: var(--shadow-soft);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-grab { width: 38px; height: 5px; border-radius: 999px; background: rgba(15, 23, 42, 0.14); margin: 4px auto 16px; }
.sheet-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--surface-soft); color: var(--muted);
}
.sheet-close svg { width: 18px; height: 18px; }
.sheet-close:active { background: rgba(15, 23, 42, 0.1); }
.sheet-title { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 4px; }
.sheet-context { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.sheet-msg { font-size: 15px; color: var(--ink-2); line-height: 1.5; margin-bottom: 20px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }

/* ===== Toasts ===== */
#toasts {
  position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px;
  z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  margin: 0 auto; max-width: 500px; pointer-events: auto;
  background: var(--text); color: #fff; border-radius: var(--radius-md);
  padding: 12px 18px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 9px;
  animation: toast-in 0.25s ease;
}
.toast.err { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s; }

/* ===== Tab bar ===== */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-inner { max-width: 640px; margin: 0 auto; display: flex; height: var(--tabbar-h); }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted-2); font-size: 10.5px; font-weight: 650;
  transition: color 0.15s;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--text); }
.tab-new svg {
  width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: #fff; padding: 9px;
  box-shadow: 0 4px 14px rgba(11, 13, 18, 0.25);
}
.tab-new { gap: 1px; }
.tab-new.active svg { background: var(--blue); }

/* ===== Auth ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 20px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 36px 28px; box-shadow: var(--shadow-soft); text-align: center;
}
.logo-mark {
  width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #e84b8a 0%, #2563ff 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: 0 10px 26px rgba(37, 99, 255, 0.25);
}
.auth-title { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.auth-card .form-input { margin-bottom: 12px; text-align: left; }
.auth-error { min-height: 20px; font-size: 13px; color: var(--red); font-weight: 600; margin-top: 12px; }
.auth-forgot { margin-top: 6px; }

/* ===== Loading ===== */
.boot-loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; margin-right: 10px;
  border: 2.5px solid var(--border-strong); border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.section-gap { height: 10px; }

/* ===== Phase 5 polish — soft depth, less generic ===== */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 280px at 12% -14%, rgba(232, 75, 138, 0.10), transparent 60%),
    radial-gradient(1100px 280px at 92% -20%, rgba(37, 99, 255, 0.12), transparent 55%);
}
#app-main, .auth-wrap { position: relative; z-index: 1; }
#tabbar { z-index: 50; }
.hero {
  background:
    radial-gradient(circle at 12% 0%, rgba(232, 75, 138, 0.07), transparent 46%),
    radial-gradient(circle at 88% 6%, rgba(37, 99, 255, 0.08), transparent 44%),
    var(--surface);
}
.potential-card {
  background: linear-gradient(135deg, rgba(37, 99, 255, 0.10), rgba(124, 58, 237, 0.07)), var(--surface);
  border-color: rgba(37, 99, 255, 0.16);
}
.potential-card .eyebrow { color: var(--blue); }
.avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.chip.active, .chip.active-tint { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06); }
.hero-value { background: linear-gradient(180deg, var(--text), #2c3446); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
