:root {
  --bg: #f4f6f5;
  --bg-soft: #e8eeeb;
  --surface: #ffffff;
  --surface-2: #fafbfa;
  --ink: #0f1a16;
  --ink-soft: #2d3b35;
  --muted: #6b7c74;
  --line: rgba(15, 26, 22, 0.08);
  --line-strong: rgba(15, 26, 22, 0.14);
  --brand: #0b5c44;
  --brand-dark: #084734;
  --brand-light: #127a5a;
  --brand-glow: rgba(11, 92, 68, 0.18);
  --accent: #e8940a;
  --accent-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --shadow-sm: 0 2px 8px rgba(15, 26, 22, 0.06);
  --shadow: 0 8px 28px rgba(15, 26, 22, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 26, 22, 0.12);
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 58px;
  --bottom-h: 72px;
  --tap: 44px;
  --sidebar-w: 272px;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100%;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { color: var(--brand); }

h1, h2, h3 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}
h1 { font-size: 1.65rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { color: var(--muted); line-height: 1.55; margin: 0 0 0.75rem; }

/* ========== Shell ========== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 380px at 0% -5%, rgba(11, 92, 68, 0.07), transparent 55%),
    radial-gradient(600px 300px at 100% 0%, rgba(232, 148, 10, 0.06), transparent 50%),
    var(--bg);
}

.page-content {
  padding: 1rem 1.25rem 2rem;
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

/* ========== Sidebar (desktop) ========== */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 1.35rem 1.1rem;
  background: linear-gradient(175deg, var(--brand-dark) 0%, var(--brand) 45%, #0a4d3a 100%);
  color: #ecf7f1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  background: linear-gradient(145deg, #2ecc94, var(--brand-dark));
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.brand-mark.sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.brand strong, .app-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand small,
.sidebar-user small,
.app-header-brand small {
  color: rgba(236, 247, 241, 0.72);
  font-size: 0.78rem;
}

.desktop-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.desktop-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: rgba(236, 247, 241, 0.85);
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.desktop-nav a.active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}

.sidebar-user-link:hover { opacity: 0.92; }

.sidebar-user strong { display: block; font-size: 0.92rem; }

.sidebar-add {
  margin-top: auto;
  padding-top: 0.5rem;
}

.sidebar-add .btn {
  width: 100%;
}

/* ========== App header (mobile) ========== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 0.5rem) 1rem 0.5rem;
  background: rgba(8, 71, 52, 0.97);
  color: #ecf7f1;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--tap);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.app-header-brand small {
  display: block;
  color: rgba(236, 247, 241, 0.7);
  font-size: 0.76rem;
}

.app-header-brand .app-title {
  font-family: var(--display);
  font-size: 1.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.icon-btn:active { background: rgba(255, 255, 255, 0.18); }

.icon-btn.dark {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* ========== Page toolbar ========== */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.page-toolbar form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.month-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 0.85rem;
  box-shadow: var(--shadow-sm);
}

.month-pill label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.month-pill input[type="month"],
.month-pill input[type="date"] {
  border: 0;
  background: transparent;
  padding: 0.45rem 0.5rem;
  min-height: auto;
  font-weight: 600;
  font-size: 0.92rem;
  width: auto;
  box-shadow: none;
}

.month-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.month-bar form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.month-bar label:not(.check) {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  margin: 0;
}

.month-bar label:not(.check) input {
  border: 0;
  background: transparent;
  padding: 0.35rem 0;
  min-height: auto;
  font-weight: 600;
  width: auto;
}

.toolbar-spacer { flex: 1; }

/* ========== Hero card (dashboard) ========== */
.hero-card {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 50%, #0d6b4f 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 40px var(--brand-glow);
  position: relative;
  overflow: hidden;
}

.hero-card p,
.rent-summary p,
.members-summary p,
.recurring-summary p,
.exp-summary p,
.settings-summary p {
  color: rgba(255, 255, 255, 0.92);
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.hero-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.hero-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.78);
}

.hero-card-month {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}

.hero-amount {
  font-family: var(--display);
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.hero-amount.due { color: #fecaca; }
.hero-amount.clear { color: #a7f3d0; }

.hero-sub {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 0.35rem;
  position: relative;
  z-index: 1;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 1.15rem;
  position: relative;
  z-index: 1;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem;
  backdrop-filter: blur(8px);
}

.hero-stat small {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.hero-stat strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
}

/* ========== Grid & panels ========== */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.2rem;
}

.panel + .panel { margin-top: 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.panel-head h2 { margin: 0; }
.panel-head .muted { margin: 0; font-size: 0.88rem; }

.section-block { margin-bottom: 1rem; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  margin-top: 0.3rem;
  letter-spacing: -0.02em;
}

.you-card { text-align: left; }

.muted { color: var(--muted); font-size: 0.9rem; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--radius-sm);
  min-height: var(--tap);
  padding: 0.65rem 1.05rem;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 14px var(--brand-glow);
}
.btn-primary:hover { background: var(--brand-light); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 148, 10, 0.25);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); }
.app-header .btn-ghost,
.sidebar .btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.header-add-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
}
.btn-sm {
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 10px;
}

/* ========== Forms ========== */
.form { display: grid; gap: 0.85rem; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.form-box {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  min-height: var(--tap);
  font-size: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

textarea { min-height: 96px; resize: vertical; }

.checks { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  font-weight: 500;
  min-height: 40px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.check:has(input:checked) {
  border-color: var(--brand-light);
  background: rgba(11, 92, 68, 0.06);
}

.check input { width: auto; min-height: auto; }

/* ========== Tables ========== */
.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.15rem;
}

table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

/* ========== Alerts ========== */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideDown 0.3s ease both;
}

.alert-success { background: var(--ok-soft); color: var(--ok); border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert-info { background: var(--info-soft); color: var(--info); border: 1px solid #bae6fd; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

/* ========== Auth ========== */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 1.5rem) 1.25rem calc(var(--safe-bottom) + 1.5rem);
  background:
    radial-gradient(800px 500px at 20% 10%, rgba(11, 92, 68, 0.15), transparent 60%),
    radial-gradient(600px 400px at 90% 80%, rgba(232, 148, 10, 0.1), transparent 55%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.5rem;
  animation: rise 0.45s ease both;
}

.auth-card .brand { margin-bottom: 1.25rem; color: var(--ink); }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { margin-bottom: 0.35rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.75rem 0 1.1rem; }

.chip {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

/* ========== Lists ========== */
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child { border-bottom: 0; }

.actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  min-width: 0;
}

.share-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  font-size: 0.88rem;
  color: var(--muted);
}

.share-row strong {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.share-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Expenses page ========== */
.panel-expenses {
  padding: 0;
  overflow: hidden;
}

.exp-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
}

.exp-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.2rem;
}

.exp-summary-total {
  font-family: var(--display);
  font-size: 1.85rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.exp-summary-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.exp-feed {
  padding: 0.85rem 0.9rem 1rem;
  display: grid;
  gap: 0.65rem;
}

.exp-cat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.exp-cat-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.exp-cat-head::-webkit-details-marker { display: none; }

.exp-cat-head::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 0.25rem;
  transition: transform 0.15s ease;
}

.exp-cat:not([open]) .exp-cat-head::after {
  transform: rotate(-90deg);
}

.exp-cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: #fff;
  background: var(--brand);
}

.exp-cat-icon--util { background: #0284c7; }
.exp-cat-icon--food { background: #d97706; }
.exp-cat-icon--rent { background: #7c3aed; }
.exp-cat-icon--setup { background: #78716c; }
.exp-cat-icon--general { background: var(--brand); }

.exp-cat-name {
  font-family: var(--display);
  font-size: 0.95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-cat-count {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}

.exp-cat-total {
  font-family: var(--display);
  font-size: 0.95rem;
  white-space: nowrap;
}

.exp-cat-body {
  display: grid;
  gap: 0.45rem;
  padding: 0 0.55rem 0.55rem;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding: 0.75rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.exp-item-main { min-width: 0; }

.exp-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.3rem;
}

.exp-item-title {
  font-size: 0.92rem;
  line-height: 1.3;
  min-width: 0;
}

.exp-item-amt {
  font-family: var(--display);
  font-size: 1rem;
  white-space: nowrap;
  color: var(--brand);
}

.exp-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.exp-item-paid {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.exp-item-paid--me {
  color: var(--brand);
  font-weight: 700;
}

.exp-split {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.exp-split-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.exp-split-row strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.exp-split-row--me {
  background: rgba(11, 92, 68, 0.05);
  border-radius: 8px;
  padding: 0.15rem 0.25rem;
  margin: 0 -0.25rem;
}

.exp-split-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.45rem;
}

.exp-receipt {
  appearance: none;
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--bg-soft);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.exp-receipt:hover,
.exp-receipt:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 4px 14px rgba(8, 71, 52, 0.12);
}

.exp-receipt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.exp-payment-proof {
  appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.exp-payment-proof::before {
  content: '📷 ';
}

.exp-payment-proof:hover,
.exp-payment-proof:focus-visible {
  background: color-mix(in srgb, var(--brand) 18%, transparent);
}

.receipt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.receipt-lightbox[hidden] { display: none !important; }

.receipt-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 16, 0.72);
  backdrop-filter: blur(4px);
}

.receipt-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.receipt-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.receipt-lightbox-head strong {
  font-size: 0.95rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-lightbox-close {
  appearance: none;
  border: 0;
  background: var(--bg-soft);
  color: var(--ink-soft);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.receipt-lightbox-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #0a0a0a;
  display: grid;
  place-items: center;
}

.receipt-lightbox-body img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vh, 560px);
  object-fit: contain;
}

.receipt-lightbox-foot {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  justify-content: center;
}

.exp-item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
}

.exp-item-actions form { margin: 0; }

.exp-action {
  appearance: none;
  border: 0;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

.exp-action--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

@media (max-width: 420px) {
  .exp-item {
    grid-template-columns: 1fr;
  }

  .exp-item-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--line);
  }

  .exp-item-actions {
    flex-direction: row;
  }
}

/* ========== Rent page ========== */
.rent-layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 961px) {
  .rent-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.panel-rent,
.panel-advance {
  padding: 0;
  overflow: hidden;
}

.rent-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
  color: #fff;
}

.rent-summary--paid {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.rent-summary--empty {
  background: linear-gradient(135deg, #475569, #64748b);
}

.rent-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.2rem;
}

.rent-summary-total,
.rent-summary-title {
  font-family: var(--display);
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: block;
}

.rent-summary-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}

.rent-status-pill {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.rent-status-pill.ok {
  background: rgba(255, 255, 255, 0.22);
}

.rent-status-pill.due {
  background: rgba(254, 226, 226, 0.25);
}

.rent-body {
  padding: 0.85rem 0.9rem 1rem;
}

.rent-admin {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.rent-admin-toggle {
  padding: 0.7rem 0.85rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  list-style: none;
}

.rent-admin-toggle::-webkit-details-marker { display: none; }

.rent-admin-body {
  padding: 0 0.85rem 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.rent-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
}

.rent-inline-form label {
  flex: 1;
  min-width: 140px;
  margin: 0;
}

.rent-admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.rent-share-list {
  display: grid;
  gap: 0.5rem;
}

.rent-share-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.rent-share-card--me {
  border-color: rgba(11, 92, 68, 0.2);
  background: linear-gradient(135deg, rgba(11, 92, 68, 0.05), var(--surface-2));
}

.rent-share-card--paid {
  opacity: 0.92;
}

.rent-share-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
}

.rent-share-info {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.rent-share-info strong {
  font-size: 0.92rem;
}

.rent-share-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.rent-share-amt-wrap {
  text-align: right;
}

.rent-share-amt {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
}

.rent-share-badge {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
}

.rent-share-badge.paid {
  background: var(--ok-soft);
  color: var(--ok);
}

.rent-share-badge.due {
  background: var(--danger-soft);
  color: var(--danger);
}

.rent-share-actions {
  padding: 0 0.85rem 0.75rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
  margin-top: -0.1rem;
}

.rent-mark-paid {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.45rem;
}

.rent-mark-paid input[type="date"] {
  min-height: 36px;
  padding: 0.45rem 0.65rem;
  width: auto;
  flex: 1;
  min-width: 130px;
}

.advance-head {
  padding: 1rem 1.05rem 0.5rem;
}

.advance-head h2 { margin: 0; }

.advance-balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0 0.9rem 0.85rem;
}

.advance-balance-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.advance-balance-card--me {
  border-color: rgba(11, 92, 68, 0.2);
  background: linear-gradient(135deg, rgba(11, 92, 68, 0.06), var(--surface-2));
}

.advance-balance-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.2;
}

.advance-balance-amt {
  font-family: var(--display);
  font-size: 1rem;
}

.advance-form-wrap {
  margin: 0 0.9rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.advance-form-toggle {
  padding: 0.75rem 0.85rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  list-style: none;
  color: var(--brand);
}

.advance-form-toggle::-webkit-details-marker { display: none; }

.advance-form-wrap .form {
  padding: 0 0.85rem 0.85rem;
}

.advance-history {
  border-top: 1px solid var(--line);
  padding: 0.85rem 0.9rem 1rem;
}

.advance-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.advance-history-head h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  margin: 0;
}

.advance-history-list {
  display: grid;
  gap: 0.45rem;
}

.advance-entry {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.advance-entry-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
}

.advance-entry-body {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.advance-entry-body strong {
  font-size: 0.9rem;
}

.advance-entry-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.advance-type {
  font-style: normal;
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.advance-type--deposit {
  background: var(--ok-soft);
  color: var(--ok);
}

.advance-type--refund {
  background: var(--danger-soft);
  color: var(--danger);
}

.advance-type--adjust {
  background: var(--accent-soft);
  color: #b45309;
}

.advance-entry-notes {
  font-size: 0.78rem;
  color: var(--muted);
}

.advance-entry-amt {
  font-family: var(--display);
  font-size: 0.95rem;
  white-space: nowrap;
}

.advance-entry-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0 0.75rem 0.65rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.5rem;
}

.advance-entry-actions form { margin: 0; }

/* ========== Recurring page ========== */
.recurring-layout {
  display: grid;
  gap: 1rem;
}

.panel-recurring,
.panel-recurring-form {
  padding: 0;
  overflow: hidden;
}

.recurring-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, #0369a1, #0284c7);
  color: #fff;
}

.recurring-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.2rem;
}

.recurring-summary-total {
  font-family: var(--display);
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: block;
}

.recurring-summary-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}

.recurring-summary-pill {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.recurring-body {
  padding: 0.85rem 0.9rem 1rem;
}

.recurring-template-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.recurring-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.recurring-card--paused {
  opacity: 0.82;
}

.recurring-card-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.65rem;
  padding: 0.8rem 0.85rem;
}

.rec-cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  background: var(--brand);
  flex-shrink: 0;
}

.rec-cat-icon--util { background: #0284c7; }
.rec-cat-icon--food { background: #d97706; }
.rec-cat-icon--rent { background: #7c3aed; }
.rec-cat-icon--setup { background: #78716c; }
.rec-cat-icon--general { background: var(--brand); }

.recurring-card-body {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.recurring-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.recurring-card-title-row strong {
  font-size: 0.95rem;
}

.recurring-status {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
}

.recurring-status.active {
  background: var(--ok-soft);
  color: var(--ok);
}

.recurring-status.paused {
  background: var(--bg-soft);
  color: var(--muted);
}

.recurring-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.recurring-card-amt {
  font-family: var(--display);
  font-size: 1rem;
  white-space: nowrap;
}

.recurring-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.85rem 0.75rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.recurring-card-actions form { margin: 0; }

.recurring-runs {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.recurring-runs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.recurring-runs-head h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  margin: 0;
}

.recurring-runs-list {
  display: grid;
  gap: 0.4rem;
}

.recurring-run-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.recurring-run-main {
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.recurring-run-main strong {
  font-size: 0.88rem;
}

.recurring-run-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.recurring-run-amt {
  font-family: var(--display);
  font-size: 0.92rem;
  white-space: nowrap;
}

.recurring-form-wrap {
  margin: 0;
}

.recurring-form-toggle {
  padding: 1rem 1.05rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
  color: var(--brand);
  border-bottom: 1px solid var(--line);
}

.recurring-form-toggle::-webkit-details-marker { display: none; }

.panel-recurring-form .form {
  padding: 1rem 1.05rem 1.1rem;
}

/* ========== Members page ========== */
.members-layout {
  display: grid;
  gap: 1rem;
}

.panel-members,
.panel-members-form {
  padding: 0;
  overflow: hidden;
}

.members-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
}

.members-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.2rem;
}

.members-summary-total {
  font-family: var(--display);
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: block;
}

.members-summary-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}

.members-summary-pill {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}

.members-body {
  padding: 0.85rem 0.9rem 1rem;
}

.members-list {
  display: grid;
  gap: 0.55rem;
}

.member-profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.member-profile-card--inactive {
  opacity: 0.78;
}

.member-profile-card--me {
  border-color: rgba(11, 92, 68, 0.22);
  background: linear-gradient(135deg, rgba(11, 92, 68, 0.06), var(--surface-2));
}

.member-profile-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
}

.member-profile-body {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.member-profile-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.member-profile-title strong {
  font-size: 0.95rem;
}

.member-profile-email {
  font-size: 0.82rem;
  color: var(--ink-soft);
  word-break: break-all;
}

.member-profile-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.member-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.member-badge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.member-badge--admin {
  background: #ede9fe;
  color: #6d28d9;
}

.member-badge--member {
  background: var(--bg-soft);
  color: var(--muted);
}

.member-badge--active {
  background: var(--ok-soft);
  color: var(--ok);
}

.member-badge--inactive {
  background: var(--danger-soft);
  color: var(--danger);
}

.member-badge--split {
  background: rgba(11, 92, 68, 0.08);
  color: var(--brand);
}

.member-profile-stats {
  text-align: right;
}

.member-profile-stat-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.member-profile-stat-val {
  font-family: var(--display);
  font-size: 1rem;
}

.member-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.9rem 0.75rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
  align-items: flex-start;
}

.member-profile-actions form { margin: 0; }

.member-pw-reset {
  width: 100%;
  flex: 1 1 100%;
}

.member-pw-reset summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}

.member-pw-reset summary::-webkit-details-marker { display: none; }

.member-pw-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: end;
  margin-top: 0.5rem;
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.member-pw-form input {
  flex: 1;
  min-width: 140px;
  min-height: 36px;
  padding: 0.45rem 0.65rem;
}

.members-form-wrap {
  margin: 0;
}

.members-form-toggle {
  padding: 1rem 1.05rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
  color: var(--brand);
  border-bottom: 1px solid var(--line);
}

.members-form-toggle::-webkit-details-marker { display: none; }

.panel-members-form .form {
  padding: 1rem 1.05rem 1.1rem;
}

.member-avatar-upload {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.member-avatar-upload-fields {
  display: grid;
  gap: 0.35rem;
}

/* ========== Profile page ========== */
.profile-layout { max-width: 560px; }

.panel-profile {
  padding: 0;
  overflow: hidden;
}

.profile-summary {
  padding: 1rem 1.05rem;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-light));
  color: #fff;
}

.profile-summary-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.profile-summary-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.15rem;
}

.profile-summary-name {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.profile-summary-note {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.82);
}

.profile-section {
  padding: 1rem 1.05rem 1.1rem;
}

.profile-section--card {
  margin: 0.75rem 1rem 0;
  padding: 0.9rem 0.95rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-section--card:first-of-type {
  margin-top: 1rem;
}

.profile-section--card:last-child {
  margin-bottom: 1rem;
}

.profile-form {
  display: contents;
}

.profile-fields {
  display: grid;
  gap: 0.75rem;
}

.profile-optional {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.76rem;
}

.profile-section-head {
  margin-bottom: 0.75rem;
}

.profile-section-head h3 {
  margin: 0;
  font-size: 1rem;
}

.profile-section-head p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
}

.profile-avatar-card {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: var(--surface-2);
  display: grid;
  gap: 0.65rem;
}

.profile-avatar-card.has-photo {
  border-style: solid;
}

.profile-avatar-preview img {
  width: 120px;
  height: 120px;
  max-height: none;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 50%;
  aspect-ratio: 1;
  background: var(--surface);
}

.profile-avatar-empty {
  text-align: center;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.profile-avatar-empty p {
  margin: 0;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.profile-avatar-empty-icon { font-size: 1.6rem; }

.profile-avatar-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.profile-avatar-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
}

.profile-remove-avatar {
  margin-top: 0.65rem;
  width: fit-content;
}

.profile-actions {
  margin-top: 0.85rem;
}

.profile-actions .btn { width: 100%; }

/* ========== Avatar crop modal ========== */
.avatar-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.avatar-crop-modal[hidden] { display: none !important; }

.avatar-crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 16, 0.62);
}

.avatar-crop-sheet {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(92dvh, 720px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 1rem 1rem 1.1rem;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 0.75rem;
}

.avatar-crop-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.avatar-crop-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.12rem;
}

.avatar-crop-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.avatar-crop-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
}

.avatar-crop-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.avatar-crop-stage {
  width: 100%;
  max-height: min(52dvh, 420px);
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
}

.avatar-crop-stage img {
  display: block;
  max-width: 100%;
}

.avatar-crop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.avatar-crop-actions .btn { width: 100%; }

.member-avatar-upload-preview .pending-avatar--photo img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.member-avatar-preview-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.exp-form-member-chip {
  gap: 0.4rem;
  padding-left: 0.45rem;
}

.exp-form-member-chip .pending-avatar--xs {
  margin-right: 0.1rem;
}

/* ========== Settings page ========== */
.settings-layout {
  max-width: 720px;
}

.panel-settings {
  padding: 0;
  overflow: hidden;
}

.settings-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, #334155, #475569);
  color: #fff;
}

.settings-summary-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 0.2rem;
}

.settings-summary-title {
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  display: block;
}

.settings-summary-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.45;
}

.settings-summary-pill {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.settings-form {
  padding: 0.85rem 0.9rem 1.1rem;
  display: grid;
  gap: 0.85rem;
}

.settings-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.85rem 0.9rem;
}

.settings-section-head {
  margin-bottom: 0.75rem;
}

.settings-section-head h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  margin: 0 0 0.15rem;
}

.settings-section-head .muted {
  margin: 0;
  font-size: 0.82rem;
}

.settings-fields {
  display: grid;
  gap: 0.75rem;
}

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

.settings-hint {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  line-height: 1.45;
}

.settings-hint strong {
  color: var(--ink-soft);
}

.settings-info {
  margin: 0;
}

.settings-actions {
  padding-top: 0.15rem;
}

.settings-actions .btn {
  width: 100%;
}

@media (max-width: 560px) {
  .settings-fields--2 {
    grid-template-columns: 1fr;
  }
}

/* ========== Receipts ========== */
.receipt-upload { display: grid; gap: 0.35rem; }
.receipt-pick-btn { cursor: pointer; margin: 0; }
.receipt-pick-btn input { display: none; }
.receipt-preview-wrap { margin-top: 0.25rem; }

.receipt-preview,
.receipt-thumb {
  display: block;
  width: 100%;
  max-width: 220px;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.receipt-thumb {
  width: 64px;
  height: 64px;
  max-width: 64px;
  max-height: 64px;
}

.receipt-thumb-link { display: inline-block; }

/* ========== Pending card ========== */
.pending-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1rem 1.05rem 1.05rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pending-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pending-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.pending-title {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.pending-status {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pending-status--due {
  background: var(--danger-soft);
  color: var(--danger);
}

.pending-status--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pending-mine {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.pending-mine--due {
  background: linear-gradient(135deg, #fff5f5, #fff);
  border-color: #fecaca;
}

.pending-mine--back {
  background: linear-gradient(135deg, #ecfdf5, #fff);
  border-color: #a7f3d0;
}

.pending-mine--ok {
  background: var(--ok-soft);
  border-color: #a7f3d0;
}

.pending-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
}

.pending-avatar--sm {
  width: 34px;
  height: 34px;
  font-size: 0.72rem;
}

.pending-avatar--xs {
  width: 26px;
  height: 26px;
  font-size: 0.62rem;
}

.pending-avatar--lg {
  width: 72px;
  height: 72px;
  font-size: 1.25rem;
}

.pending-avatar--photo {
  background: var(--surface-2);
  border: 2px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
  padding: 0;
}

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

.pending-avatar--photo.pending-avatar--back {
  background: var(--surface-2);
  border: 2px solid #a7f3d0;
}

.list-item--people {
  align-items: center;
}

.list-item-people {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.list-item-arrow {
  color: var(--muted);
  font-weight: 700;
}

.settle-user-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.app-header-user {
  display: inline-flex;
  flex-shrink: 0;
  text-decoration: none;
}

.pending-avatar--back {
  background: var(--ok);
}

.pending-mine-body {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.pending-mine-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pending-mine-amt-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pending-mine-sign {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.pending-mine-sign--plus {
  background: #d1fae5;
  color: var(--ok);
}

.pending-mine-sign--minus {
  background: #fee2e2;
  color: var(--danger);
}

.pending-mine-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 0.45rem;
  margin-top: 0.15rem;
}

.pending-mine-formula-item {
  display: grid;
  gap: 0.08rem;
}

.pending-mine-formula-item small {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.pending-mine-formula-item strong {
  font-size: 0.82rem;
  font-weight: 700;
}

.pending-mine-formula-net strong {
  font-size: 0.9rem;
}

.pending-mine-op {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--muted);
  padding-bottom: 0.15rem;
}

.pending-mine-amt {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.pending-mine-detail {
  font-size: 0.82rem;
  color: var(--muted);
}

.pending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.pending-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.pending-chip--due {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.pending-chip--back {
  background: var(--ok-soft);
  border-color: #a7f3d0;
  color: var(--ok);
}

.pending-lists {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.pending-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}

.pending-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  list-style: none;
}

.pending-group-head::-webkit-details-marker { display: none; }

.pending-group-head::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}

.pending-group:not([open]) .pending-group-head::after {
  transform: rotate(-90deg);
}

.pending-group-head strong {
  font-family: var(--display);
  font-size: 0.95rem;
}

.pending-roster {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.pending-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.pending-row-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-row-amt {
  font-family: var(--display);
  font-size: 0.95rem;
  white-space: nowrap;
}

.pending-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.15rem;
  border-top: 1px solid var(--line);
}

.pending-actions .btn { flex: 1 1 auto; }

/* ========== Member cards (dashboard) ========== */
.member-list {
  display: grid;
  gap: 0.65rem;
}

.member-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 0.85rem 0.9rem;
}

.member-card--me {
  background: linear-gradient(135deg, rgba(11, 92, 68, 0.06), var(--surface-2));
  border-color: rgba(11, 92, 68, 0.18);
  box-shadow: inset 0 0 0 1px rgba(11, 92, 68, 0.06);
}

.member-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.member-card-id {
  min-width: 0;
}

.member-card-id strong {
  display: inline;
  font-size: 0.95rem;
}

.member-tag {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

.member-card-status {
  text-align: right;
}

.member-status-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.member-status-amt {
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1.15;
}

.member-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.member-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  min-width: 0;
}

.member-stat span {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.member-stat strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-rent-badge {
  display: inline-block;
  margin-top: 0.2rem;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
}

.member-rent-badge.paid {
  background: var(--ok-soft);
  color: var(--ok);
}

.member-rent-badge.due {
  background: var(--danger-soft);
  color: var(--danger);
}

.member-card-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
}

.member-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.member-pill--due {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.member-pill--back {
  background: var(--ok-soft);
  border-color: #a7f3d0;
  color: var(--ok);
}

@media (max-width: 420px) {
  .member-card-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ========== Upcoming & settle ========== */
/* ========== What's next (upcoming + settle) ========== */
.panel-next { padding-bottom: 1rem; }

.next-total-chip {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecaca;
  white-space: nowrap;
}

.next-block { margin-top: 0.15rem; }

.next-block--border {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.next-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.next-block-head h3 {
  font-family: var(--display);
  font-size: 0.98rem;
  margin: 0;
}

.next-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand);
}

.due-list, .transfer-list {
  display: grid;
  gap: 0.5rem;
}

.due-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease, transform 0.12s ease;
}

.due-card:active {
  transform: scale(0.99);
  background: var(--bg-soft);
}

.due-card--overdue {
  border-color: #fecaca;
  background: linear-gradient(135deg, #fff5f5, var(--surface-2));
}

.due-card--today {
  border-color: #fde68a;
  background: linear-gradient(135deg, #fffbeb, var(--surface-2));
}

.due-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: var(--brand);
  color: #fff;
}

.due-card--rent .due-card-icon { background: #7c3aed; }
.due-card--recurring .due-card-icon { background: #0284c7; }
.due-card--expense .due-card-icon { background: var(--brand); }

.due-card-body {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.due-card-body strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.due-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
}

.due-type {
  font-style: normal;
  font-weight: 700;
  color: var(--ink-soft);
}

.due-status {
  font-style: normal;
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
}

.due-status--upcoming {
  background: var(--bg-soft);
  color: var(--muted);
}

.due-status--due-today {
  background: var(--accent-soft);
  color: #b45309;
}

.due-status--overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.due-card-amt {
  font-family: var(--display);
  font-size: 1rem;
  white-space: nowrap;
}

.transfer-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.transfer-card--mine {
  background: linear-gradient(135deg, #fff5f5, var(--surface-2));
  border-color: #fecaca;
}

.transfer-card--incoming {
  background: linear-gradient(135deg, #ecfdf5, var(--surface-2));
  border-color: #a7f3d0;
}

.transfer-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.transfer-side--to { align-items: center; }

.transfer-name {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

.transfer-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.15rem;
}

.transfer-arrow {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}

.transfer-amt {
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--brand);
  white-space: nowrap;
}

.transfer-you-tag {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
}

.transfer-you-tag.incoming {
  color: var(--ok);
  background: var(--ok-soft);
}

.next-actions {
  margin-top: 0.85rem;
}

.next-actions .btn {
  width: 100%;
}

@media (max-width: 360px) {
  .transfer-name { font-size: 0.68rem; }
  .transfer-amt { font-size: 0.88rem; }
}

.me-row { background: rgba(11, 92, 68, 0.04); }

.me-tag {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.3rem;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ========== Form sheet ========== */
.form-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 20, 16, 0.5);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.form-overlay.open { opacity: 1; }

.form-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  max-height: min(92dvh, 920px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 1rem 1rem calc(var(--safe-bottom) + 1rem);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.18);
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.form-sheet.open { transform: translateY(0); }

.form-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--surface);
  padding-bottom: 0.75rem;
  margin-bottom: 0.35rem;
  z-index: 2;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--surface) 35%);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.sticky-actions .btn { flex: 1; }

/* ========== Expense form (full page) ========== */
.expense-form-page {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: calc(var(--bottom-h) + var(--safe-bottom) + 0.5rem);
}

.panel-expense-form {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.expense-form-page .exp-form-header {
  border-radius: 0;
  position: relative;
  top: auto;
}

.expense-form-page .exp-form {
  padding: 0.75rem 1rem 0;
  gap: 0.65rem;
}

.expense-form-page .exp-form-footer {
  position: sticky;
  bottom: calc(var(--bottom-h) + var(--safe-bottom) - 0.25rem);
  background: linear-gradient(180deg, transparent, var(--surface) 28%);
  padding: 1rem;
  margin: 0.5rem 0 0;
  z-index: 2;
  display: grid;
  gap: 0.45rem;
}

.page-toolbar--back {
  max-width: 680px;
  margin: 0 auto 0.65rem;
}

@media (min-width: 961px) {
  .expense-form-page {
    padding-bottom: 2rem;
  }

  .expense-form-page .exp-form-footer {
    bottom: 0;
  }
}

/* ========== Expense form sheet (legacy) ========== */
.expense-form-sheet {
  padding: 0 0 calc(var(--safe-bottom) + 0.35rem);
  display: flex;
  flex-direction: column;
}

.exp-form-grab {
  width: 40px;
  height: 4px;
  background: rgba(15, 26, 22, 0.14);
  border-radius: 999px;
  margin: 0.55rem auto 0;
  flex-shrink: 0;
}

.exp-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 1rem;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 55%, var(--brand-light) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
}

.exp-form-header h2 {
  color: #fff;
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.exp-form-header p {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  line-height: 1.4;
}

.exp-form-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 0.15rem;
}

.exp-form-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.exp-form-close:active { background: rgba(255, 255, 255, 0.28); }

.exp-form {
  padding: 0.65rem 1rem 0;
  gap: 0.6rem;
}

.exp-form-block {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
  display: grid;
  gap: 0.65rem;
}

.exp-form-block--hero {
  background: linear-gradient(180deg, #fff 0%, var(--surface-2) 100%);
  border-color: var(--line-strong);
  gap: 0.75rem;
}

.exp-form-block--notes { padding: 0.75rem 0.9rem; }

.exp-form-block-head {
  display: grid;
  gap: 0.2rem;
}

.exp-form-block-head h3 {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
}

.exp-form-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.exp-form-field {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.exp-form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.exp-form-optional {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.76rem;
}

.exp-form-amount-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.exp-form-amount-wrap:focus-within {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.exp-form-currency {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--brand);
  line-height: 1;
}

.exp-form-amount-input {
  border: 0 !important;
  box-shadow: none !important;
  padding: 0.35rem 0 !important;
  min-height: auto !important;
  background: transparent !important;
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.exp-form-amount-input:focus {
  box-shadow: none !important;
}

.exp-form-category-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.exp-form-category-wrap .exp-cat-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
}

.exp-form-category-wrap select { flex: 1; min-width: 0; }

.exp-form-datetime { margin: 0; }

.exp-form-split-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.28rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.exp-form-split-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s ease, color 0.15s ease;
}

.exp-form-split-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.exp-form-members.checks { gap: 0.4rem; }

.exp-form-member-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.exp-form-member-chip span { pointer-events: none; }

.exp-form-members.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.exp-form-custom-shares {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.15rem;
}

.exp-form-custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.exp-form-field--compact .exp-form-label {
  font-size: 0.76rem;
  font-weight: 600;
}

.exp-form-field--compact input {
  padding: 0.65rem 0.75rem;
  min-height: 42px;
}

.exp-form-receipt {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: var(--surface);
  display: grid;
  gap: 0.65rem;
}

.exp-form-receipt.has-preview {
  border-style: solid;
  border-color: var(--line);
}

.exp-form-receipt-empty {
  text-align: center;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.exp-form-receipt-empty p {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.exp-form-receipt-icon { font-size: 1.5rem; line-height: 1; }

.exp-form-receipt-meta {
  font-size: 0.74rem;
  color: var(--muted);
}

.exp-form-receipt-preview .receipt-preview {
  max-width: 100%;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background: var(--surface-2);
}

.exp-form-receipt-actions {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  flex-wrap: wrap;
}

.exp-form-remove-receipt {
  width: fit-content;
  font-size: 0.82rem;
}

.exp-form-footer {
  display: grid;
  gap: 0.45rem;
  padding: 0.85rem 1rem 0.5rem;
  margin: 0;
}

.exp-form-footer .btn-primary {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  flex: none;
}

.exp-form-footer .btn-ghost { width: 100%; flex: none; }

@media (max-width: 400px) {
  .exp-form-custom-grid { grid-template-columns: 1fr; }
}

@media (min-width: 961px) {
  .expense-form-sheet { padding: 1.35rem 1.4rem 1rem; }
  .exp-form-grab { display: none; }
  .exp-form-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin: -1.35rem -1.4rem 0.65rem;
    padding: 1.1rem 1.35rem 1.15rem;
  }
  .exp-form { padding: 0 0.05rem; }
  .exp-form-footer { padding-left: 0; padding-right: 0; }
}

/* ========== Bottom nav ========== */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--bottom-h) + var(--safe-bottom));
  padding: 0.4rem 0.5rem calc(var(--safe-bottom) + 0.35rem);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  box-shadow: 0 -4px 24px rgba(15, 26, 22, 0.06);
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 0.1rem;
}

.bottom-nav a,
.bottom-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  min-height: 52px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.bottom-nav a.active,
.bottom-nav button.active {
  color: var(--brand);
}

.bottom-nav a:active,
.bottom-nav button:active {
  transform: scale(0.96);
}

.nav-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.nav-ico svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav a.active .nav-ico svg,
.bottom-nav button.active .nav-ico svg {
  stroke-width: 2.25;
}

/* FAB — fixed above bottom nav, centered */
.bottom-nav-spacer {
  display: block;
  pointer-events: none;
}

.bottom-fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + var(--bottom-h) - 30px);
  z-index: 55;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-light), var(--brand-dark));
  color: #fff;
  border: 4px solid var(--surface);
  box-shadow: 0 8px 24px var(--brand-glow);
  display: grid;
  place-items: center;
  text-decoration: none;
  transform: translateX(-50%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bottom-fab:active {
  transform: translateX(-50%) scale(0.94);
}

.bottom-fab svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* ========== Action sheet ========== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 16, 0.45);
  z-index: 60;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sheet-overlay.open { opacity: 1; }

.action-sheet {
  position: fixed;
  left: 0.65rem;
  right: 0.65rem;
  bottom: calc(var(--safe-bottom) + 0.65rem);
  z-index: 70;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 0.65rem 0.65rem 0.75rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.action-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--line-strong);
  margin: 0.1rem auto 0.65rem;
}

.sheet-title {
  font-family: var(--display);
  font-size: 1.05rem;
  padding: 0.15rem 0.55rem 0.55rem;
  font-weight: 700;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 0.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease;
}

.sheet-item:active { background: var(--bg); }
.sheet-item.active { background: rgba(11, 92, 68, 0.1); color: var(--brand); }
.sheet-item.danger { color: var(--danger); background: var(--danger-soft); }

.sheet-cancel {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 0.85rem;
  cursor: pointer;
}

/* ========== Animations ========== */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.panel, .auth-card, .hero-card, .exp-item {
  animation: rise 0.35s ease both;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 16, 0.35);
  z-index: 30;
}

.overlay.show { display: block; }

/* ========== Responsive ========== */
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: 1fr; }
  .hero-amount { font-size: 2rem; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .is-app .page-content {
    padding: 0.85rem 0.9rem calc(var(--bottom-h) + var(--safe-bottom) + 1.25rem);
  }

  .bottom-nav { display: grid; }
  #moreToggle { display: none; }
  .header-add-btn { display: none; }

  .grid-2, .grid-3, .grid-4, .form-row { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.35rem; }

  table { min-width: 0; }
  .table-wrap { overflow: visible; margin: 0; }
  table, thead, tbody, th, td, tr { display: block; width: 100%; }
  thead { display: none; }

  tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.6rem;
    box-shadow: var(--shadow-sm);
  }

  tbody td {
    border: 0;
    padding: 0.32rem 0;
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 0.3rem 0.7rem;
    align-items: start;
  }

  tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 0.12rem;
  }

  tbody td > * { min-width: 0; max-width: 100%; }

  tbody td.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.35rem;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
    border-top: 1px dashed var(--line);
    grid-template-columns: none;
  }

  tbody td.actions::before { display: none; }

  .share-list { width: 100%; }
  .share-row { font-size: 0.86rem; }

  .month-bar .btn, .month-bar button { width: 100%; }
  .actions .btn, .actions button { flex: 1 1 auto; }
  .panel { padding: 1rem; border-radius: var(--radius-lg); }

  .app-header-brand .app-title { max-width: 62vw; }
}

@media (min-width: 961px) {
  .app-header { display: none; }
  .bottom-nav, .bottom-fab, .action-sheet, .sheet-overlay { display: none !important; }
  .page-content { padding: 1.5rem 1.75rem 2.5rem; }

  .form-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(560px, calc(100vw - 2rem));
    max-height: min(86vh, 860px);
    border-radius: var(--radius-xl);
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    padding: 1.35rem 1.4rem;
  }

  .form-sheet.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .pending-actions .btn { flex: 0 0 auto; }
}

@media (display-mode: standalone) {
  body { background: var(--bg); }
  .app-header { padding-top: calc(var(--safe-top) + 0.6rem); }
}
