:root {
  --ink: #1F2A24;
  --muted: #7C9385;
  --bg: #F7F5F1;
  --card: #FFFFFF;
  --primary: #0E7C6B;
  --primary-dark: #0A5C4F;
  --amber: #D9A441;
  --coral: #E15554;
  --border: #EAE6DD;
  --radius: 18px;
  --green: #0E7C6B;
  --surface: #FFFFFF;
  --bg-secondary: #F0EDE6;
  --primary-rgb: 14, 124, 107;
}

[data-theme="dark"] {
  --ink: #ECEAE3;
  --muted: #8FA69B;
  --bg: #10161A;
  --card: #1B2422;
  --primary: #16B89E;
  --primary-dark: #0F8A76;
  --amber: #E3B15C;
  --coral: #FF6B6A;
  --border: #2A3330;
  --green: #16B89E;
  --surface: #1B2422;
  --bg-secondary: #232D2A;
  --primary-rgb: 22, 184, 158;
}

[data-theme="dark"] .modal-content {
  background: var(--card);
  color: var(--ink);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background: var(--card);
  color: var(--ink);
}
[data-theme="dark"] .form-control::placeholder { color: var(--muted); }
[data-theme="dark"] .form-label { color: var(--ink); }
[data-theme="dark"] .btn-close { filter: invert(1); }
[data-theme="dark"] select.form-select option { background: var(--card); color: var(--ink); }

.theme-toggle-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.05rem;
  padding: 4px;
  min-width: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 8px;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:active {
  background: var(--border);
}

.app-menu {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 10px 30px rgba(0,0,0,0.14);
  padding: 6px;
  min-width: 210px;
}
.app-menu .dropdown-item {
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-menu .dropdown-item:hover,
.app-menu .dropdown-item:focus {
  background: var(--bg);
  color: var(--ink);
}
.app-menu .dropdown-item.app-menu-danger {
  color: var(--coral);
}
.app-menu .dropdown-item.app-menu-danger:hover {
  background: rgba(225,85,84,0.1);
  color: var(--coral);
}
.app-menu .dropdown-divider {
  border-color: var(--border);
  margin: 4px 6px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  padding-bottom: 110px;
  min-height: 100vh;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

h1, h2, h3, h4, .display-num {
  font-family: 'Sora', 'Inter', sans-serif;
  color: var(--ink);
}

.tabular { font-variant-numeric: tabular-nums; }

/* ---- Top bar / period switcher ---- */
.topbar {
  padding: 16px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar .brand {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.period-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 2px 18px 14px;
}

.period-switch a {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.1rem;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.period-switch a:hover { background: var(--border); }

.period-switch .period-label {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  min-width: 140px;
  text-align: center;
}

/* ---- Wallet hero ---- */
.wallet-hero {
  margin: 4px 16px 18px;
  padding: 26px 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.wallet-hero::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -70px;
  right: -50px;
}

.wallet-hero .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.75);
  margin-bottom: 4px;
}

.wallet-hero .amount {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
}

.wallet-hero .sub-row {
  display: flex;
  gap: 22px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.wallet-hero .sub-row div span.k {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wallet-hero .sub-row div span.v {
  font-weight: 600;
  font-size: 1rem;
}

/* Back button - Floating */
.wallet-hero .back-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s ease, transform 0.15s ease;
  padding: 0;
}

.wallet-hero .back-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.05);
}

.wallet-hero .back-btn:active {
  transform: scale(0.95);
}

/* ---- Savings Page Specific ---- */
.savings-page .wallet-hero {
  /* Inherit all base styles */
}

.savings-page .wallet-hero .label {
  /* Optional: customize label if different from accounts */
}

/* ---- Accounts Page Specific ---- */
.accounts-page .wallet-hero {
  /* Inherit all base styles */
}

.accounts-page .wallet-hero .label {
  /* Optional: customize label if different from savings */
}

/* ---- Ring ---- */
.ring-wrap {
  position: absolute;
  right: 20px;
  top: 22px;
  width: 68px; height: 68px;
}
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { stroke: rgba(255,255,255,0.25); fill: none; stroke-width: 7; }
.ring-fg { stroke: #fff; fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff;
}

/* ---- Cards - More compact & beautiful ---- */
.section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 16px 16px 8px;
  font-weight: 600;
}

.card-list { 
  margin: 0 10px; 
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.cat-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.cat-card .row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.cat-card .cat-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-card .cat-nums {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.cat-card .delete-link {
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 2px 4px;
  font-size: 0.9rem;
}

.cat-card .delete-link:hover {
  opacity: 1;
  color: var(--coral);
}

.bar-track {
  height: 4px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.warn { 
  background: var(--amber);
  background: linear-gradient(90deg, var(--amber), #f59e0b);
}

.bar-fill.over { 
  background: var(--coral);
  background: linear-gradient(90deg, var(--coral), #dc2626);
}

/* Budget input compact */
.cat-card .input-group {
  margin-top: 4px;
}

.cat-card .input-group-text {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cat-card .form-control {
  border-radius: 0 8px 8px 0;
  padding: 4px 10px;
  height: 32px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.2s;
}

.cat-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

/* Form card compact */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 8px 10px;
  font-size: 0.85rem;
}

.form-card .fw-semibold {
  font-size: 0.82rem;
}

.btn-brand {
  border-radius: 10px;
  padding: 8px 0;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  background: var(--primary);
  color: white;
  border: none;
  transition: all 0.2s;
}

.btn-brand:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
  background: var(--primary-dark);
}

 /* ---- Forms ---- */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 14px 16px;
}

.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,124,107,0.12);
}

.btn-brand {
  background: var(--primary);
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
}
.btn-brand:hover { background: var(--primary-dark); color: #fff; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 12px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .meta { font-size: 0.78rem; color: var(--muted); }

.delete-link {
  color: var(--coral);
  font-size: 0.85rem;
  text-decoration: none;
}

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 4px 10px;
  z-index: 50;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  padding-top: 4px;
}
.bottom-nav a i { display: block; font-size: 1.2rem; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--primary); }

/* ---- Auth pages ---- */
.auth-shell {
  max-width: 400px;
  margin: 0 auto;
  padding: 60px 24px;
  min-height: 100vh;
}
.auth-shell h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}
.auth-shell p.sub { color: var(--muted); margin-bottom: 28px; }
.auth-shell .btn-brand { width: 100%; padding: 12px; margin-top: 8px; }
.auth-shell .switch-link { text-align: center; margin-top: 18px; font-size: 0.9rem; }

.btn-add-sm {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.btn-add-sm:hover { background: var(--primary-dark); color: #fff; }

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 18px 10px;
}
.list-header .section-title { margin: 0; }

.modal-content-brand {
  border-radius: 20px;
  border: none;
}

.btn-danger-soft {
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 20px;
  font-weight: 600;
}
.btn-danger-soft:hover { background: #c94443; color: #fff; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 30px 20px;
  font-size: 0.9rem;
}

/* Switch-style active state */
.active-yearly {
    background: #ffc107;
    color: #000 !important;
    border-radius: 20px;
    padding: 4px 10px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated underline style */
.active-yearly::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 3px;
    background: #ffc107;
    border-radius: 4px;
}

/* Language switch (EN | SO) */
.lang-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
}
.lang-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---- Quick add ("+" button + bottom sheet) ---- */
.qa-fab {
  position: fixed;
  left: 50%;
  bottom: 38px;
  transform: translateX(-50%);
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: var(--primary);
  color: #fff;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.45);
  z-index: 60;
}
.qa-fab:active { transform: translateX(-50%) scale(0.94); }
.qa-sheet {
  max-width: 480px;
  margin: 0 auto;
  height: auto !important;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  background: var(--card);
  color: var(--ink);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.qa-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 4px auto 10px; }
.qa-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-shrink: 0; }
.qa-tabs { flex: 1; display: flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.qa-close { flex: 0 0 auto; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--ink); font-size: 0.88rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.qa-close i { font-size: 1.1rem; color: var(--coral); }
.qa-close:active { background: var(--bg); }
.qa-tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.qa-tabs button.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.qa-amount { text-align: center; font-family: 'Sora', sans-serif; font-size: 2rem; font-weight: 700; line-height: 1.15; margin: 2px 0 6px; flex-shrink: 0; }
.qa-cur { color: var(--muted); font-size: 1.2rem; margin-right: 4px; vertical-align: middle; }
.qa-chips { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; flex: 0 1 auto; min-height: 60px; max-height: 190px; overflow-y: auto; margin-bottom: 8px; }
.qa-chip { border: 1px solid var(--border); background: var(--card); color: var(--ink); border-radius: 999px; padding: 5px 11px; font-size: 0.8rem; }
.qa-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.qa-row { display: flex; gap: 8px; margin-bottom: 6px; flex-shrink: 0; }
.qa-row .form-select { flex: 1; min-width: 0; }
.qa-date { position: relative; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font-size: 0.85rem; white-space: nowrap; overflow: hidden; }
.qa-date input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
#qaNote { margin-bottom: 6px; flex-shrink: 0; }
.qa-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; flex-shrink: 0; }
.qa-pad button { border: 0; background: var(--bg); color: var(--ink); border-radius: 10px; padding: 0; height: 38px; font-size: 1.1rem; font-weight: 600; line-height: 1; }
.qa-pad button:active { background: var(--border); }
.qa-error { color: var(--coral); font-size: 0.85rem; text-align: center; margin-bottom: 8px; flex-shrink: 0; }
#qaSave { flex-shrink: 0; }
.qa-toast {
  position: fixed; left: 50%; bottom: 108px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  border-radius: 14px; padding: 10px 14px; font-size: 0.85rem;
  display: flex; align-items: center; gap: 12px; z-index: 70; max-width: 92%;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.qa-toast button { border: 0; background: transparent; color: var(--amber); font-weight: 700; padding: 0; }

/* ---------- Reports ---------- */
.rep-tabs { display: flex; gap: 8px; margin: 6px 16px 12px; }
.rep-tabs a { flex: 1; text-align: center; padding: 9px 0; border-radius: 999px; border: 1px solid var(--border); background: var(--card); font-size: 0.86rem; font-weight: 600; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.rep-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25); }
.rep-row.is-today { outline: 2px solid var(--green, #1a9d6a); }
.rep-actions { display: flex; gap: 8px; margin: 14px 16px 6px; }
.rep-actions .btn { flex: 1; font-size: 0.9rem; }

/* ---------- Renewal page ---------- */
.renew-plan { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: var(--card); }
.renew-plan:has(input:checked) { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.07); }
.renew-plan input { accent-color: var(--primary); width: 18px; height: 18px; flex-shrink: 0; }
.renew-plan .rp-main { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.renew-plan .rp-main small { color: var(--muted); font-size: 0.75rem; }
.renew-plan .rp-price { font-weight: 700; }

/* ---------- Admin: user list + status pills ---------- */
.user-list { margin: 0 16px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.user-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--ink); }
.user-row:last-of-type { border-bottom: 0; }
.user-row:active { background: var(--bg); }
.user-row .ur-main { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-row .ur-main small { color: var(--muted); font-size: 0.78rem; }
.st-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.st-active  { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
.st-trial   { background: rgba(70, 130, 220, 0.14); color: #3a6fc4; }
.st-soon, .st-pending { background: rgba(217, 164, 65, 0.18); color: #9a6f12; }
.st-expired, .st-rejected { background: rgba(225, 85, 84, 0.13); color: var(--coral); }
.st-admin   { background: var(--ink); color: #fff; }
.um-info { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 0.9rem; margin-bottom: 14px; }
.um-info dt { color: var(--muted); font-weight: 500; margin: 0; }
.um-info dd { margin: 0; word-break: break-word; }

/* ---------- Admin dashboard tiles ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 16px 14px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 10px 8px; display: flex; flex-direction: column; text-align: center; }
.kpi.wide { grid-column: 1 / -1; }
.kpi .k-num { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.35rem; line-height: 1.2; }
.kpi .k-lbl { font-size: 0.72rem; color: var(--muted); }
.kpi.warn .k-num { color: #b07d10; }
.kpi.bad .k-num { color: var(--coral); }

/* little dot on the + button while entries are waiting to upload */
.qa-fab.has-queue::after { content: ''; position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); border: 2px solid #fff; }

/* ---------- Notification bell ---------- */
.bell-btn { position: relative; }
.bell-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--coral); color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 17px; text-align: center; border: 2px solid var(--bg); box-sizing: content-box; }
.notif-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink); background: var(--card); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: rgba(var(--primary-rgb), 0.07); }
.notif-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }
.notif-item.read .dot { background: transparent; }
.notif-item .nt { font-weight: 600; font-size: 0.92rem; }
.notif-item .nb { font-size: 0.84rem; color: var(--muted); margin-top: 1px; white-space: pre-line; }
.notif-item .nw { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

.share-box { background: var(--bg); border: 1px dashed var(--border); border-radius: 12px; padding: 12px; font-size: 0.88rem; text-align: left; word-break: break-word; }

/* ---- notification permission prompt ---- */
.np-card {
  position: fixed; left: 50%; bottom: 92px; width: calc(100% - 28px); max-width: 452px;
  transform: translate(-50%, 24px); opacity: 0; transition: .25s; z-index: 65;
  display: flex; gap: 12px; padding: 14px;
  background: var(--card); border: 1px solid var(--border, rgba(0,0,0,.08)); border-radius: 18px;
  box-shadow: 0 10px 32px rgba(0,0,0,.18);
}
.np-card.show { transform: translate(-50%, 0); opacity: 1; }
.np-ico { flex: 0 0 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.np-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.np-body strong { font-size: .98rem; }
.np-body span { font-size: .84rem; color: var(--muted); line-height: 1.35; }
.np-btns { display: flex; gap: 8px; margin-top: 8px; }
.np-btns button { border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: .88rem; }
.np-yes { background: var(--primary); color: #fff; }
.np-no { background: transparent; color: var(--muted); }
.np-toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #1f2d2a; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 80; font-size: .9rem; }

/* ================= Step 6: polish ================= */
/* back arrow in the top bar (sub-pages) */
.topbar-back { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--border); color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.topbar-back:active { transform: scale(.94); }
.topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* pills: text centred, never wraps, scrolls sideways if there are many */
.rep-tabs { overflow-x: auto; scrollbar-width: none; }
.rep-tabs::-webkit-scrollbar { display: none; }
.rep-tabs a { display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; line-height: 1; white-space: nowrap; font-size: .82rem; flex: 1 0 auto; }
.form-card .rep-tabs { margin: 12px 0 0; }

/* more compact transaction tiles */
.cat-card .list-row { padding: 6px 0; min-height: 46px; }
.cat-card .list-row > div:first-child { line-height: 1.22; font-size: .94rem; min-width: 0; }
.cat-card .list-row .meta { font-size: .72rem; margin-top: 1px; }
.cat-card .list-row .tabular { font-size: .94rem; }
.cat-card .list-row .d-flex.gap-3 { gap: 10px !important; }
.cat-card .list-row .btn { font-size: .95rem; }

/* budget page: summary + compact editable rows, saved one by one */
.bud-sum { margin: 0 10px 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.bud-sum .bs-top { display: flex; justify-content: space-between; align-items: baseline; }
.bud-sum .bs-lbl { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.bud-sum .bs-total { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.5rem; color: var(--primary); }
.bud-sum .bs-sub { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.bud-sum .bs-left.over { color: var(--coral); font-weight: 600; }
.bud-sum .bs-bar { height: 5px; background: var(--border); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bud-sum .bs-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .25s; }
.bud-sum .bs-bar.over > i { background: var(--coral); }
.bud-actions { display: flex; gap: 8px; margin: 0 10px 10px; }
.bud-actions .btn { flex: 1; font-size: .86rem; padding: 8px 10px; }
.bud-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); min-height: 48px; }
.bud-row:last-child { border-bottom: 0; }
.bud-row .bn { flex: 1; min-width: 0; font-size: .94rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bud-row .bn small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; }
.bud-box { display: flex; align-items: center; width: 128px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 0 8px; transition: border-color .15s, box-shadow .15s; }
.bud-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .15); background: var(--card); }
.bud-box span { color: var(--muted); font-size: .85rem; margin-right: 4px; }
.bud-box input { border: 0; background: transparent; width: 100%; text-align: right; font-weight: 600; font-size: .95rem; outline: 0; color: var(--ink); padding: 0; -moz-appearance: textfield; }
.bud-box input::-webkit-outer-spin-button, .bud-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bud-state { width: 18px; flex: 0 0 18px; text-align: center; font-size: .95rem; color: var(--primary); }
.bud-state.err { color: var(--coral); cursor: pointer; }
.bud-row .bud-del { width: 24px; flex: 0 0 24px; text-align: center; padding: 0; color: var(--coral); opacity: .75; }
.bud-row.saving .bud-box { border-color: var(--primary); }
.bud-row.saved .bud-box { animation: budflash .9s; }
@keyframes budflash { 0% { background: rgba(var(--primary-rgb), .18); } 100% { background: var(--bg); } }
@media (prefers-reduced-motion: reduce) { .bud-row.saved .bud-box { animation: none; } }
.rep-tabs { padding: 3px 3px 6px; }
.rep-tabs a.active { box-shadow: none; }
.search-group { border-radius: 12px; flex-wrap: nowrap; }
.search-group:focus-within { box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .18); }
.search-group .form-control { border-radius: 12px 0 0 12px; box-shadow: none !important; }
.search-group .btn { border-radius: 0 12px 12px 0; padding: 0 16px; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
