/* ──────────────────────────────────────────────────────────
   Layout shell
   ────────────────────────────────────────────────────────── */

.app-shell {
  position: relative;
  width: min(520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 18px 108px;
  /* `clip` avoids creating a scroll container, so position: sticky inside
     pile-stack works against the viewport. `hidden` is the fallback. */
  overflow-x: hidden;
  overflow-x: clip;
}

.view {
  display: none;
  padding-top: 2px;
}

.view.active {
  display: block;
  animation: view-in 0.32s var(--ease-out) both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ──────────────────────────────────────────────────────────
   Hero
   ────────────────────────────────────────────────────────── */

.hero {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(0, 174, 239, 0.18), transparent 55%),
    radial-gradient(120% 80% at 100% 100%, rgba(23, 212, 193, 0.14), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.01) 100%),
    var(--panel);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition:
    padding 0.28s var(--ease-out),
    border-radius 0.28s var(--ease-out),
    box-shadow 0.28s var(--ease-out);
}

/* Compact hero state — applied via JS when the user scrolls past the threshold.
   The hero stays sticky at the top while the inner block compresses into a
   slim toolbar showing only the avatar, balance amount, and refresh button. */
.hero.compact {
  padding-top: 12px;
  padding-bottom: 14px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
}

.hero.compact .hero-aurora {
  opacity: 0.2;
}

/* Per-view hero variants:
   - home: full hero with balance
   - finance / extras / cards: short hero with username (no balance, no title)
   - profile / admin: hero hidden entirely */

body[data-active-view="profile"] .hero,
body[data-active-view="admin"] .hero {
  display: none;
}

body[data-active-view="finance"] .hero,
body[data-active-view="extras"] .hero,
body[data-active-view="cards"] .hero {
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}

body[data-active-view="finance"] .hero .hero-aurora,
body[data-active-view="extras"] .hero .hero-aurora,
body[data-active-view="cards"] .hero .hero-aurora {
  opacity: 0.18;
}

body[data-active-view="finance"] .hero .hero-text,
body[data-active-view="extras"] .hero .hero-text,
body[data-active-view="cards"] .hero .hero-text,
body[data-active-view="finance"] .hero .balance-hero,
body[data-active-view="extras"] .hero .balance-hero,
body[data-active-view="cards"] .hero .balance-hero {
  display: none;
}

body[data-active-view="finance"] .hero .hero-top,
body[data-active-view="extras"] .hero .hero-top,
body[data-active-view="cards"] .hero .hero-top {
  margin-bottom: 0;
}

body[data-active-view="finance"] .hero .hero-avatar,
body[data-active-view="extras"] .hero .hero-avatar,
body[data-active-view="cards"] .hero .hero-avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.hero-username {
  display: none;
  flex: 1;
  min-width: 0;
  margin: 0 12px;
  text-align: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-active-view="finance"] .hero .hero-username,
body[data-active-view="extras"] .hero .hero-username,
body[data-active-view="cards"] .hero .hero-username,
body[data-active-view="home"] .hero.compact .hero-username {
  display: block;
}

body[data-active-view="profile"] .app-shell,
body[data-active-view="admin"] .app-shell {
  padding-top: 14px;
}

.hero-aurora {
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 60%;
  background:
    radial-gradient(50% 60% at 30% 40%, rgba(0, 174, 239, 0.48), transparent 70%),
    radial-gradient(50% 60% at 80% 60%, rgba(23, 212, 193, 0.34), transparent 70%);
  filter: blur(46px);
  opacity: 0.55;
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  transition: margin-bottom 0.28s var(--ease-out);
}

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

.hero-text {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  max-height: 220px;
  opacity: 1;
  overflow: hidden;
  will-change: max-height, opacity;
  transition:
    max-height 0.28s var(--ease-out),
    opacity 0.18s var(--ease-out),
    margin 0.28s var(--ease-out);
}

.hero.compact .hero-text {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.hero-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 200deg, #00d9a0 0deg, #6ea8fe 130deg, #b47bff 230deg, #00d9a0 360deg);
  display: grid;
  place-items: center;
  color: #08120f;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-md), inset 0 0 0 2px rgba(255, 255, 255, 0.18);
  transition:
    transform 0.22s var(--ease-out),
    width 0.28s var(--ease-out),
    height 0.28s var(--ease-out),
    font-size 0.28s var(--ease-out);
}

.hero.compact .hero-avatar {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.hero-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.28), transparent 55%);
  pointer-events: none;
  z-index: 1;
}

.hero-avatar:hover {
  transform: scale(1.04);
}

.hero-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
  z-index: 0;
}

.hero-avatar-letter {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow.soft {
  color: var(--muted);
}

h1 {
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.balance-hero {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-out),
    border-color 0.25s var(--ease-out),
    background 0.25s var(--ease-out),
    margin-top 0.28s var(--ease-out),
    padding 0.28s var(--ease-out);
}

.hero.compact .balance-hero {
  margin-top: 0;
  padding: 8px 14px;
  background: transparent;
  border-color: transparent;
}

.balance-hero:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: linear-gradient(140deg, rgba(0, 217, 160, 0.07), rgba(255, 255, 255, 0.02));
}

.balance-hero:active {
  transform: scale(0.99);
}

.balance-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-height: 30px;
  opacity: 1;
  overflow: hidden;
  will-change: max-height, opacity;
  transition: max-height 0.28s var(--ease-out), opacity 0.18s var(--ease-out);
}

.hero.compact .balance-hero-top {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.balance-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0, 217, 160, 0.12);
  color: var(--accent-2);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 700;
}

.balance-hero-cta svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.3;
}

.balance-hero strong {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  transition: font-size 0.28s var(--ease-out);
}

.hero.compact .balance-hero strong {
  font-size: 22px;
}

.balance-hero small {
  color: var(--muted-2);
  font-size: 12px;
  max-height: 18px;
  opacity: 1;
  overflow: hidden;
  will-change: max-height, opacity;
  transition: max-height 0.28s var(--ease-out), opacity 0.18s var(--ease-out);
}

.hero.compact .balance-hero small {
  max-height: 0;
  opacity: 0;
}

/* ──────────────────────────────────────────────────────────
   Buttons & generic atoms
   ────────────────────────────────────────────────────────── */

.icon-button,
.ghost-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.icon-button:hover,
.ghost-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-strong);
}

.icon-button.ghost {
  background: transparent;
  border-color: var(--line);
}

.icon-button.spin svg {
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button:active,
.ghost-button:active,
.nav-item:active,
.primary-button:active,
.segment:active,
.balance-hero:active,
.quick-card:active {
  transform: scale(0.985);
}

.icon-button svg,
.ghost-button svg,
.nav-item svg,
.card-title svg,
.primary-button svg,
.setting-row svg,
.action-card svg,
.ghost-action svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.icon-button.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.icon-button.danger {
  background: rgba(255, 92, 122, 0.12);
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.18);
}

.auth-notice {
  margin: 14px 0 0;
  padding: 13px 14px;
  border: 1px solid rgba(255, 180, 84, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(255, 180, 84, 0.08);
  color: var(--text);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.auth-notice[hidden] {
  display: none;
}

[data-admin-only][hidden] {
  display: none !important;
}

.auth-notice strong,
.auth-notice span {
  display: block;
}

.auth-notice span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────
   Section heads & links
   ────────────────────────────────────────────────────────── */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 4px 12px;
}

.section-head.inside {
  margin: 0 0 16px;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.section-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s var(--ease-out);
}

.link-button:hover {
  background: rgba(0, 217, 160, 0.1);
}

.link-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

/* ──────────────────────────────────────────────────────────
   Quick & summary cards
   ────────────────────────────────────────────────────────── */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-card {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  text-align: left;
  color: var(--text);
  display: grid;
  gap: 6px;
  overflow: hidden;
  transition: transform 0.22s var(--ease-out), border-color 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out);
}

.quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.quick-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.quick-card-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.quick-card.income .quick-card-icon {
  background: rgba(0, 217, 160, 0.14);
  color: var(--accent);
}

.quick-card.expense .quick-card-icon {
  background: rgba(255, 92, 122, 0.14);
  color: var(--danger);
}

.quick-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quick-card strong {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.quick-card small {
  color: var(--muted-2);
  font-size: 11px;
}

.quick-card.active-filter {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ──────────────────────────────────────────────────────────
   Soft cards & panels
   ────────────────────────────────────────────────────────── */

.soft-card,
.panel,
.profile-card,
.list-item,
.category-row,
.balance-card,
.prayer-time {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.soft-card {
  padding: 18px;
}

.panel {
  padding: 20px;
  margin-top: 14px;
}

.next-card {
  margin-top: 14px;
  background:
    linear-gradient(140deg, rgba(0, 217, 160, 0.10), rgba(110, 168, 254, 0.06)),
    var(--panel);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-title svg {
  color: var(--accent-2);
}

.next-card strong {
  display: block;
  margin-top: 12px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.next-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* ──────────────────────────────────────────────────────────
   Lists
   ────────────────────────────────────────────────────────── */

.stack-list,
.category-list {
  display: grid;
  gap: 10px;
}

.stack-list.compact {
  gap: 8px;
}

.list-item {
  min-height: 64px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  animation: item-rise 0.32s var(--ease-out) both;
  transition: transform 0.22s var(--ease-out), border-color 0.22s var(--ease-out);
}

.list-item:hover {
  border-color: var(--line-strong);
}

.list-item.managed {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.list-item.compact {
  min-height: 58px;
  padding: 10px 12px;
}

@keyframes item-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.item-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.item-icon.income {
  background: rgba(0, 217, 160, 0.14);
  color: var(--accent);
}

.item-icon.expense {
  background: rgba(255, 92, 122, 0.14);
  color: var(--danger);
}

.item-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.amount {
  font-weight: 800;
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.amount.income {
  color: var(--accent-2);
}

.amount.expense {
  color: var(--danger-2);
}

.item-actions {
  display: inline-flex;
  gap: 6px;
}

.empty {
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* Pile-up sticky stack — items overlap each other as the page scrolls.
   Each successive child has a slightly larger `top` and higher `z-index`
   so later items cover earlier ones during scroll, creating a deck-of-cards
   pile effect. */

.pile-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.pile-stack > * {
  position: sticky;
  flex-shrink: 0;
  margin: 0;
  background: var(--panel);
  transition: transform 0.22s var(--ease-out);
}

.pile-stack > *:nth-child(1)  { top: 0;    z-index: 1;  }
.pile-stack > *:nth-child(2)  { top: 6px;  z-index: 2;  }
.pile-stack > *:nth-child(3)  { top: 12px; z-index: 3;  }
.pile-stack > *:nth-child(4)  { top: 18px; z-index: 4;  }
.pile-stack > *:nth-child(5)  { top: 24px; z-index: 5;  }
.pile-stack > *:nth-child(6)  { top: 30px; z-index: 6;  }
.pile-stack > *:nth-child(7)  { top: 36px; z-index: 7;  }
.pile-stack > *:nth-child(8)  { top: 42px; z-index: 8;  }
.pile-stack > *:nth-child(9)  { top: 48px; z-index: 9;  }
.pile-stack > *:nth-child(10) { top: 54px; z-index: 10; }
.pile-stack > *:nth-child(n+11) { top: 60px; z-index: 11; }

/* Empty placeholder inside pile-stack should not stick. */
.pile-stack > .empty {
  position: relative;
  top: auto !important;
  z-index: 0 !important;
}

/* Prayer row — list-item layout for stacked prayer times. */

.pile-stack.prayer-stack > .prayer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  animation: item-rise 0.32s var(--ease-out) both;
}

.pile-stack.prayer-stack > .prayer-row.enabled {
  border-color: rgba(0, 217, 160, 0.32);
  background:
    linear-gradient(140deg, rgba(0, 217, 160, 0.10), rgba(110, 168, 254, 0.04)),
    var(--panel);
}

.prayer-row .item-icon {
  background: rgba(110, 168, 254, 0.14);
  color: var(--info-2);
}

.prayer-row.enabled .item-icon {
  background: rgba(0, 217, 160, 0.18);
  color: var(--accent-2);
}

.prayer-row-time {
  font-family: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
}

.prayer-row.enabled .prayer-row-time {
  color: var(--accent-2);
}

/* Expand transactions */

.expand-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.expand-row.top {
  margin-top: 0;
  margin-bottom: 8px;
}

.expand-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.expand-button svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
  transition: transform 0.25s var(--ease-out);
}

.expand-button.is-open svg {
  transform: rotate(180deg);
}

.expand-button:hover {
  background: rgba(0, 217, 160, 0.1);
  color: var(--accent-2);
  border-color: rgba(0, 217, 160, 0.28);
}

/* ──────────────────────────────────────────────────────────
   Finance report panel
   ────────────────────────────────────────────────────────── */

.report-panel {
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(0, 217, 160, 0.06), transparent 60%),
    var(--panel);
  margin-top: 0;
}

.month-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.month-row strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-soft);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.summary-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 6px;
  transition: transform 0.22s var(--ease-out), border-color 0.22s var(--ease-out);
}

.summary-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.summary-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-card strong {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.summary-card.income strong {
  color: var(--accent-2);
}

.summary-card.expense strong {
  color: var(--danger-2);
}

/* ──────────────────────────────────────────────────────────
   Segmented control
   ────────────────────────────────────────────────────────── */

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-top: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.segmented.three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented.four {
  grid-template-columns: repeat(4, 1fr);
}

.period-tabs {
  margin-top: 4px;
}

.segment {
  position: relative;
  z-index: 1;
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  transition: background 0.22s var(--ease-out), color 0.22s var(--ease-out);
}

.segment:hover {
  color: var(--text-soft);
}

.segment.active {
  background: linear-gradient(135deg, var(--accent), #00b389);
  color: #061312;
  box-shadow: 0 6px 16px rgba(0, 217, 160, 0.2);
}

/* ──────────────────────────────────────────────────────────
   Finance tools
   ────────────────────────────────────────────────────────── */

.finance-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
  align-items: end;
}

.limit-field,
.form-field {
  display: grid;
  gap: 6px;
}

.limit-field span,
.form-field span,
.lead-time-row > span,
.select-wrap span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

input::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.action-row.wrap {
  flex-wrap: wrap;
}

.ghost-action {
  flex: 1 1 140px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.ghost-action:disabled {
  cursor: default;
  opacity: 0.6;
}

.ghost-action:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.ghost-action.active {
  color: #061312;
  background: linear-gradient(135deg, var(--accent), #00b389);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(0, 217, 160, 0.2);
}

.ghost-action.danger {
  color: var(--danger);
  background: rgba(255, 92, 122, 0.08);
  border-color: rgba(255, 92, 122, 0.18);
}

.ghost-action.danger:hover {
  background: rgba(255, 92, 122, 0.14);
}

.ghost-action:active {
  transform: scale(0.985);
}

/* ──────────────────────────────────────────────────────────
   Categories & savings
   ────────────────────────────────────────────────────────── */

.category-row {
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 1fr minmax(120px, 40%);
  gap: 14px;
  align-items: center;
}

.bar {
  height: 6px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--panel-3);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width 0.4s var(--ease-out);
}

.saving-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.saving-meter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.saving-meter strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.meter-ring {
  --saving: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--panel) 56%, transparent 57%),
    conic-gradient(var(--accent) calc(var(--saving) * 1%), var(--panel-3) 0);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
}

.progress-line {
  height: 6px;
  margin-top: 16px;
  border-radius: var(--radius-pill);
  background: var(--panel-3);
  overflow: hidden;
}

.progress-line span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width 0.45s var(--ease-out);
}

.helper-text {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.helper-text.center {
  text-align: center;
}

/* ──────────────────────────────────────────────────────────
   Card grid (compact list inside Finance)
   ────────────────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.balance-card {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.balance-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.balance-card strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.balance-card small {
  color: var(--muted-2);
  font-size: 11px;
}

/* Liquid glass refinement */
.hero,
.soft-card,
.panel,
.profile-card,
.list-item,
.category-row,
.balance-card,
.prayer-row,
.summary-card,
.quick-card,
.finance-short-card,
.modal-card,
.bottom-nav {
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.hero {
  padding: 18px 18px 20px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    var(--panel);
}

.hero.compact {
  padding-top: 8px;
  padding-bottom: 9px;
  border-radius: 0 0 16px 16px;
}

.hero-top {
  margin-bottom: 10px;
}

.hero.compact .hero-top {
  margin-bottom: 4px;
}

.balance-hero {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.hero.compact .balance-hero {
  padding: 4px 8px;
}

.balance-hero strong {
  font-size: 26px;
}

.hero.compact .balance-hero strong {
  font-size: 18px;
}

.section-head {
  margin: 18px 2px 9px;
}

.quick-grid {
  gap: 9px;
}

.quick-card,
.summary-card {
  min-height: 74px;
  padding: 12px;
  border-radius: 14px;
}

.quick-card strong {
  font-size: 18px;
}

.quick-card-icon,
.item-icon {
  width: 32px;
  height: 32px;
  border-radius: 11px;
}

.soft-card,
.panel {
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    var(--panel);
}

.next-card {
  width: 100%;
  display: grid;
  gap: 4px;
  color: var(--text);
  text-align: left;
}

.next-card strong {
  margin-top: 8px;
  font-size: 22px;
}

.finance-short-card {
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(255, 255, 255, 0.06)),
    var(--panel);
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 3px;
}

.finance-short-card span,
.finance-short-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-short-card strong {
  font-size: 22px;
  line-height: 1.1;
}

.list-item,
.pile-stack.prayer-stack > .prayer-row {
  min-height: 54px;
  padding: 9px 11px;
  gap: 10px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    var(--panel);
}

.list-item.clickable {
  cursor: pointer;
}

.item-title {
  font-size: 13px;
}

.item-meta {
  font-size: 11px;
}

.amount {
  font-size: 13px;
}

.saving-meter {
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.saving-meter strong {
  margin-top: 2px;
  font-size: 20px;
}

.meter-ring {
  width: 52px;
  height: 52px;
  font-size: 12px;
}

.progress-line {
  margin-top: 10px;
}

.ghost-action,
.primary-button,
.segment,
.expand-button,
input,
select {
  border-radius: 12px;
}

.ghost-action {
  flex: 1 1 118px;
  min-height: 38px;
  padding: 0 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.035)),
    var(--panel-2);
}

.segment.active,
.ghost-action.active {
  background: linear-gradient(135deg, var(--accent-2), var(--info));
  color: #052033;
}

.quick-card.active-filter {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.admin-user-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.avatar.mini {
  overflow: hidden;
}

.avatar.mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bank-card-row {
  gap: 10px;
}

.card-edit-button {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.12);
}

.modal-card {
  border-radius: 18px;
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 14px;
  }

  .summary-grid {
    gap: 6px;
  }

  .summary-card {
    padding: 10px 8px;
  }

  .summary-card strong {
    font-size: 13px;
  }

  .finance-tools,
  .admin-add-row {
    grid-template-columns: 1fr;
  }
}

/* ──────────────────────────────────────────────────────────
   Cards view — drum carousel
   ────────────────────────────────────────────────────────── */

.cards-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 4px 18px;
}

.cards-header h2 {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cards-count {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card-wheel {
  position: relative;
  height: auto;
  overflow: visible;
  scroll-snap-type: none;
  scrollbar-width: none;
  perspective: none;
  -webkit-overflow-scrolling: touch;
  mask-image: none;
  -webkit-mask-image: none;
}

.card-wheel::-webkit-scrollbar {
  display: none;
}

.card-wheel-spacer {
  display: none;
}

.card-wheel-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform-style: flat;
  padding: 10px 18px 96px;
}

.bank-card {
  position: relative;
  width: min(360px, 100%);
  height: 120px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: #f4f5f8;
  scroll-snap-align: none;
  background: var(--card-bg, var(--grad-card-a));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-md);
  transform-style: flat;
  transition: opacity 0.32s var(--ease-out);
  will-change: auto;
  overflow: visible;
  cursor: default;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    radial-gradient(80% 60% at 100% 100%, rgba(0, 0, 0, 0.32), transparent 60%);
  pointer-events: none;
}

.bank-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.bank-card-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  z-index: 1;
}

.bank-card-row.foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 4px;
}

.bank-card-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bank-card-brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

.bank-card-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-card-chip {
  flex-shrink: 0;
  width: 30px;
  height: 22px;
  border-radius: 5px;
  background: linear-gradient(135deg, #f3d27a 0%, #b48a35 50%, #d8b35a 100%);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.35);
  position: relative;
}

.bank-card-chip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.3) 36%, rgba(0, 0, 0, 0.3) 38%, transparent 39%, transparent 60%, rgba(0, 0, 0, 0.3) 61%, rgba(0, 0, 0, 0.3) 63%, transparent 64%);
}

.bank-card-balance {
  text-align: right;
  display: grid;
  gap: 1px;
}

.bank-card-balance span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.bank-card-balance strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.bank-card-number {
  font-family: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.92);
}

.bank-card-meta {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  font-weight: 600;
}

.cards-empty {
  margin: 28px 18px 0;
  padding: 36px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted);
}

/* ──────────────────────────────────────────────────────────
   Profile
   ────────────────────────────────────────────────────────── */

.profile-card {
  padding: 22px;
  margin-top: 6px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(0, 217, 160, 0.14), transparent 55%),
    radial-gradient(120% 80% at 100% 100%, rgba(110, 168, 254, 0.10), transparent 55%),
    var(--panel);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.avatar {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background:
    conic-gradient(from 200deg, #00d9a0, #6ea8fe, #b47bff, #00d9a0);
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 900;
  color: #08120f;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-md), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar.mini {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.profile-card h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

/* ──────────────────────────────────────────────────────────
   Prayer block
   ────────────────────────────────────────────────────────── */

.prayer-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.lead-time-row {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.select-wrap {
  flex: 1;
  display: grid;
  gap: 6px;
}

.primary-button {
  align-self: end;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #00b389 100%);
  color: #061312;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(0, 217, 160, 0.25);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.primary-button:hover {
  box-shadow: 0 14px 30px rgba(0, 217, 160, 0.34);
}

.primary-button.off {
  background: var(--panel-3);
  color: var(--muted);
  box-shadow: none;
}

.prayer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.prayer-time {
  padding: 14px;
  display: grid;
  gap: 6px;
  background: var(--panel-2);
  border-color: var(--line);
}

.prayer-time.enabled {
  border-color: rgba(0, 217, 160, 0.35);
  background:
    linear-gradient(140deg, rgba(0, 217, 160, 0.10), rgba(110, 168, 254, 0.06)),
    var(--panel-2);
}

.prayer-time span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.prayer-time strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.toggle-mini,
.pill-button {
  min-height: 30px;
  border-radius: var(--radius-pill);
  padding: 0 12px;
  background: rgba(110, 168, 254, 0.14);
  color: var(--info-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid rgba(110, 168, 254, 0.22);
}

.toggle-mini:disabled {
  cursor: default;
  color: var(--muted);
  background: var(--panel-3);
  border-color: var(--line);
}

.prayer-time.enabled .toggle-mini {
  color: #061312;
  background: var(--accent);
  border-color: transparent;
}

/* ──────────────────────────────────────────────────────────
   Settings & profile rows
   ────────────────────────────────────────────────────────── */

.setting-row {
  display: flex;
  align-items: center;
  min-height: 50px;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row span {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.setting-row strong {
  max-width: 50%;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pill-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #00b389);
  border: 0;
}

.danger-zone {
  margin-top: 14px;
}

/* ──────────────────────────────────────────────────────────
   Admin
   ────────────────────────────────────────────────────────── */

.admin-panel {
  margin-top: 4px;
}

.admin-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.admin-user-add-row {
  grid-template-columns: 1fr auto;
}

.chore-panel {
  display: grid;
  gap: 14px;
}

.chore-panel .section-head.inside {
  margin-bottom: 2px;
}

.chore-panel .helper-text {
  margin: -4px 0 2px;
}

.chore-panel .admin-add-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.chore-panel .stack-list.compact {
  margin-top: 2px;
}

.chore-pair-row {
  margin-top: 8px;
}

.admin-user-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
  animation: item-rise 0.32s var(--ease-out) both;
}

.admin-user-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.status-pill {
  min-height: 22px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
}

.status-pill.admin {
  background: rgba(110, 168, 254, 0.14);
  color: var(--info-2);
  border-color: rgba(110, 168, 254, 0.24);
}

.status-pill.allowed {
  background: rgba(0, 217, 160, 0.14);
  color: var(--accent-2);
  border-color: rgba(0, 217, 160, 0.24);
}

.status-pill.blocked {
  background: rgba(255, 92, 122, 0.14);
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.24);
}

.admin-user-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-user-grid > div {
  padding: 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.admin-user-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-user-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
}

/* ──────────────────────────────────────────────────────────
   Modal
   ────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 18px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-in 0.2s ease both;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 12px;
  animation: sheet-in 0.28s var(--ease-out) both;
}

.primary-button.wide {
  width: 100%;
  margin-top: 4px;
}

body.modal-open {
  overflow: hidden;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}

/* ──────────────────────────────────────────────────────────
   Bottom navigation
   ────────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 10;
  width: min(560px, calc(100% - 24px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 4px;
  padding: 7px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: rgba(15, 18, 26, 0.78);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

body.light .bottom-nav {
  background: rgba(20, 28, 50, 0.78);
}

.nav-item {
  min-height: 46px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.nav-item:hover {
  color: var(--text-soft);
}

.nav-item.active {
  color: #061312;
  background: linear-gradient(135deg, var(--accent), #00b389);
  box-shadow: 0 6px 18px rgba(0, 217, 160, 0.32);
}

.nav-item.active svg {
  color: inherit;
}

/* ──────────────────────────────────────────────────────────
   Toast
   ────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 86px;
  z-index: 80;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 16, 28, 0.94);
  color: #f8fbff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(90px);
  opacity: 0;
  transition: transform 0.26s var(--ease-out), opacity 0.26s var(--ease-out);
  pointer-events: none;
  backdrop-filter: blur(14px);
}

body.light .toast {
  background: rgba(8, 26, 44, 0.94);
  color: #f8fbff;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ──────────────────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .app-shell {
    padding: 18px 14px 110px;
  }

  h1 {
    font-size: 24px;
  }

  .balance-hero strong {
    font-size: 28px;
  }

  .summary-grid,
  .card-grid,
  .prayer-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    gap: 8px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .summary-card {
    padding: 10px;
    min-height: 76px;
  }

  .summary-card strong {
    font-size: 14px;
  }

  .finance-tools {
    grid-template-columns: 1fr;
  }

  .admin-add-row {
    grid-template-columns: 1fr;
  }

  .admin-user-head,
  .admin-user-grid {
    grid-template-columns: 1fr;
  }

  .admin-user-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-row,
  .admin-actions {
    justify-content: flex-start;
  }

  .list-item.managed {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .list-item.managed .item-actions {
    grid-column: 2 / -1;
    justify-content: flex-end;
  }

  .category-row {
    grid-template-columns: 1fr;
  }

  .prayer-actions {
    display: grid;
  }

  .primary-button {
    width: 100%;
  }

  .card-wheel {
    height: 460px;
  }

  .bank-card {
    width: 100%;
  }
}

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

  .bank-card {
    transition: none;
  }
}

/* Final compact glass pass */
* {
  letter-spacing: 0 !important;
}

.hero,
.soft-card,
.panel,
.profile-card,
.list-item,
.category-row,
.prayer-row,
.summary-card,
.quick-card,
.finance-short-card,
.modal-card,
.bottom-nav {
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.hero {
  padding: 18px 18px 20px;
  border-radius: 18px;
}

.hero.compact {
  padding-top: 8px;
  padding-bottom: 9px;
}

.balance-hero {
  margin-top: 14px;
  padding: 12px 14px;
}

.hero.compact .balance-hero {
  padding: 4px 8px;
}

.balance-hero strong {
  font-size: 26px;
}

.hero.compact .balance-hero strong {
  font-size: 18px;
}

.soft-card,
.panel {
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    var(--panel);
}

.quick-card,
.summary-card {
  min-height: 74px;
  padding: 12px;
  border-radius: 14px;
}

.quick-card strong,
.finance-short-card strong {
  font-size: 18px;
}

.list-item,
.pile-stack.prayer-stack > .prayer-row {
  min-height: 54px;
  padding: 9px 11px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    var(--panel);
}

.list-item.clickable {
  cursor: pointer;
}

.item-title,
.amount {
  font-size: 13px;
}

.item-meta {
  font-size: 11px;
}

.finance-short-card {
  width: 100%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(255, 255, 255, 0.06)),
    var(--panel);
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 3px;
}

.finance-short-card span,
.finance-short-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.next-card {
  width: 100%;
  display: grid;
  gap: 4px;
  color: var(--text);
  text-align: left;
}

.next-card strong {
  margin-top: 8px;
  font-size: 22px;
}

.saving-meter strong {
  font-size: 20px;
}

.meter-ring {
  width: 52px;
  height: 52px;
}

.ghost-action {
  flex: 1 1 118px;
  min-height: 38px;
  padding: 0 10px;
}

.segment.active,
.ghost-action.active {
  background: linear-gradient(135deg, var(--accent-2), var(--info));
  color: #052033;
}

.quick-card.active-filter {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.admin-user-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.avatar.mini {
  overflow: hidden;
}

.avatar.mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bank-card-row {
  gap: 10px;
}

.card-edit-button,
.card-menu-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.12);
}

/* Scroll header and tighter home/prayer/cards pass */
.hero {
  position: relative !important;
  top: auto !important;
  z-index: 1;
  margin-bottom: 12px;
  transition: opacity 0.24s var(--ease-out), transform 0.24s var(--ease-out), filter 0.24s var(--ease-out);
}

body[data-active-view="finance"] .hero,
body[data-active-view="extras"] .hero {
  display: none !important;
}

body.mini-header-visible[data-active-view="home"] .hero {
  opacity: 0;
  transform: translateY(-18px) scale(0.985);
  filter: blur(8px);
  pointer-events: none;
}

.mini-header {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  z-index: 30;
  width: min(420px, calc(100% - 28px));
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    var(--panel);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px) scale(0.98);
  transition: opacity 0.22s var(--ease-out), transform 0.22s var(--ease-out);
  backdrop-filter: blur(24px) saturate(1.35);
  -webkit-backdrop-filter: blur(24px) saturate(1.35);
}

body.mini-header-visible .mini-header {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

body[data-active-view="profile"] .mini-header,
body[data-active-view="admin"] .mini-header {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate(-50%, -18px) scale(0.98) !important;
}

body.mini-header-visible::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top, 0px) + 78px);
  z-index: 29;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 17, 31, 0.98), rgba(7, 17, 31, 0.88) 70%, rgba(7, 17, 31, 0));
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

body.mini-header-visible[data-active-view="profile"]::before,
body.mini-header-visible[data-active-view="admin"]::before {
  display: none;
}

body.light.mini-header-visible::before {
  background:
    linear-gradient(180deg, rgba(238, 250, 255, 0.98), rgba(238, 250, 255, 0.90) 72%, rgba(238, 250, 255, 0));
}

body.mini-header-visible .auth-notice:not([hidden]) {
  margin-top: calc(env(safe-area-inset-top, 0px) + 74px);
}

body[data-active-view="finance"] #view-finance,
body[data-active-view="extras"] #view-extras {
  padding-top: calc(env(safe-area-inset-top, 0px) + 66px);
}

body.mini-header-visible:has(.auth-notice:not([hidden])) #view-finance,
body.mini-header-visible:has(.auth-notice:not([hidden])) #view-extras,
body.mini-header-visible:has(.auth-notice:not([hidden])) #view-admin {
  padding-top: 12px;
}

.mini-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  flex: 0 0 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-2), var(--info));
  color: #052033;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 900;
}

.mini-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.mini-header-text {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

.mini-header-text strong,
.mini-header-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-header-text strong {
  font-size: 14px;
  font-weight: 800;
}

.mini-header-text span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#view-home .section-head:first-child {
  margin-top: 12px;
}

#view-home .quick-card {
  min-height: 64px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 12px;
}

#view-home .quick-card .quick-card-icon {
  grid-row: 1 / span 3;
  margin: 0;
}

#view-home .quick-card span,
#view-home .quick-card small {
  font-size: 10px;
}

#view-home .quick-card strong {
  font-size: 16px;
  line-height: 1.05;
}

#view-home .next-card {
  padding: 12px 14px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 10px;
}

#view-home .next-card .card-title {
  grid-row: 1 / span 2;
  align-self: center;
}

#view-home .next-card .card-title span {
  display: none;
}

#view-home .next-card strong {
  margin: 0;
  font-size: 19px;
}

#view-home .next-card p {
  margin: 0;
  font-size: 12px;
}

.finance-short-card {
  min-height: 58px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
}

.finance-short-card strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: 17px;
  text-align: right;
}

.cards-header {
  padding: 8px 2px 12px;
}

.cards-header h2 {
  font-size: 21px;
}

.card-wheel {
  height: auto;
  overflow: visible;
  scroll-snap-type: none;
  mask-image: none;
  -webkit-mask-image: none;
}

.bank-card {
  height: 108px;
}

.bank-card-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.card-edit-button,
.card-menu-button {
  position: absolute;
  top: -2px;
  right: -4px;
  z-index: 12;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.10);
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}

.bank-card-balance {
  padding-right: 40px;
}

.card-action-menu {
  position: absolute;
  top: 34px;
  right: -4px;
  z-index: 20;
  min-width: 122px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(12, 18, 30, 0.88);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  animation: cardMenuIn 0.16s var(--ease-out);
}

.card-action-danger {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 85, 118, 0.14);
  color: #ffb2c2;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.card-action-danger svg {
  width: 16px;
  height: 16px;
}

/* TBC-inspired polish: compact banking surfaces, cleaner light mode, and
   stable card interactions without the old 3D scroll snap layer. */
.soft-card,
.panel,
.profile-card,
.list-item,
.category-row,
.balance-card,
.prayer-time,
.transaction-row,
.admin-user-card,
.quick-card,
.finance-short-card,
.summary-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.018)),
    var(--panel);
  border-color: var(--line);
  border-radius: 20px;
}

body.light .soft-card,
body.light .panel,
body.light .profile-card,
body.light .list-item,
body.light .category-row,
body.light .balance-card,
body.light .prayer-time,
body.light .transaction-row,
body.light .admin-user-card,
body.light .quick-card,
body.light .finance-short-card,
body.light .summary-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(238, 249, 255, 0.78)),
    var(--panel);
}

.primary-button,
.segment.active,
.nav-item.active,
.quick-card.active-filter {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #042033;
}

.card-wheel {
  height: auto !important;
  overflow: visible !important;
  scroll-snap-type: none !important;
  perspective: none !important;
  mask-image: none !important;
  -webkit-mask-image: none !important;
}

.card-wheel-list {
  transform-style: flat !important;
  gap: 14px;
  padding: 8px 18px 104px;
}

.card-wheel-spacer {
  display: none !important;
}

.bank-card {
  overflow: visible !important;
  transform: none !important;
  filter: none !important;
  opacity: 1 !important;
  cursor: default;
}

.card-menu-button {
  z-index: 30 !important;
  pointer-events: auto;
  touch-action: manipulation;
}

.card-action-menu {
  z-index: 40 !important;
}

@keyframes cardMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.prayer-control-panel,
.prayer-times-panel {
  margin-top: 10px;
}

.prayer-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.prayer-actions .primary-button {
  width: 100%;
  min-height: 38px;
}

.lead-time-row {
  margin: 10px 0 0;
}

.pile-stack.prayer-stack {
  gap: 8px;
}

.pile-stack.prayer-stack > .prayer-row {
  position: relative;
  top: auto !important;
  z-index: auto !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 56px;
}

.prayer-row-time {
  font-size: 16px;
}

.toggle-mini {
  grid-column: 2 / -1;
  justify-self: stretch;
  min-height: 28px;
}

.ghost-action.wide {
  flex-basis: 100%;
  width: 100%;
}

.finance-archived {
  display: none !important;
}
