:root {
  --emerald-900: #0a1a1a;
  --emerald-800: #0f2424;
  --emerald-700: #1a6b6b;
  --emerald-300: #6ee7b7;
  --emerald-500: #2d9d9d;
  --emerald-600: #2d9d9d;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;
  --accent-coral: #e07a5f;
  --slate-900: #0c1616;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --amber-100: #fef3c7;
  --amber-300: #fcd34d;
  --amber-700: #b45309;
  --red-600: #dc2626;
  --red-50: #fef2f2;
  --white: #fff;
  --radius: 16px;
  --shadow-panel: 0 8px 32px rgba(10, 26, 26, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--slate-900);
  background:
    radial-gradient(ellipse 80% 40% at 0% 0%, rgba(45, 157, 157, 0.08), transparent 50%),
    linear-gradient(180deg, #f0fdf4 0%, #f8fafc 240px, #f8fafc 100%);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

.site-bar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--emerald-100);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.site-link:hover {
  color: #fff;
}

.site-link-muted {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

h1, h2, h3 { margin: 0; }

.app-header {
  background: linear-gradient(135deg, var(--emerald-900) 0%, var(--emerald-800) 55%, #0d2828 100%);
  color: var(--white);
  box-shadow: 0 8px 32px rgba(10, 26, 26, 0.25);
  position: relative;
}

.app-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}
.app-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.12);
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
}
.brand-logo {
  width: 44px; height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.brand h1 {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--emerald-100); }
.header-meta { font-size: 12px; color: var(--emerald-100); text-align: right; line-height: 1.5; }
.header-meta strong { color: #fff; }

.tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 14px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: var(--emerald-100);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.tab-btn.active {
  color: var(--emerald-900);
  background: #fff;
  border-color: rgba(255, 255, 255, 0.9);
}

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }
.hidden { display: none !important; }

.panel {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-panel);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}

.panel:hover {
  box-shadow: 0 12px 40px rgba(10, 26, 26, 0.1);
}
.panel h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--emerald-900);
  margin: 0 0 8px;
  line-height: 1.35;
}
.panel .sub {
  font-size: 14px;
  color: var(--slate-500);
  line-height: 1.65;
  margin: 0 0 18px;
}
.panel .sub:last-child { margin-bottom: 0; }
.panel > .btn-row,
.panel > .btn-grid { margin-top: 4px; }
.household-panel {
  background: linear-gradient(180deg, var(--emerald-50) 0%, #fff 100%);
  border-color: var(--emerald-100);
}
.household-panel .sub { margin-bottom: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--slate-50);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-panel); }
.card .label { font-size: 12px; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.04em; }
.card .value { font-size: 22px; font-weight: 700; margin-top: 6px; color: var(--emerald-900); }
.card.accent { background: var(--emerald-50); border-color: var(--emerald-100); }
.card.warn { background: var(--amber-100); border-color: var(--amber-300); }
.card.warn .value { color: var(--amber-700); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--slate-200); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate-500); background: var(--slate-50); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--emerald-700);
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800));
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  min-height: 40px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  box-shadow: 0 4px 16px rgba(10, 26, 26, 0.15);
}
.btn:hover { background: linear-gradient(135deg, var(--emerald-600), var(--emerald-800)); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(10, 26, 26, 0.2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--emerald-900); border-color: var(--slate-300); }
.btn.secondary:hover { background: var(--slate-50); }
.btn.danger { background: #fff; color: var(--red-600); border-color: #fca5a5; }
.btn.danger:hover { background: var(--red-50); }
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; min-height: 34px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--emerald-700);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  min-height: 32px;
}
.btn-ghost:hover { background: var(--emerald-50); text-decoration: underline; }
.btn-ghost.danger-text { color: var(--red-600); }
.btn-ghost.danger-text:hover { background: var(--red-50); }
.btn-ghost.sm { font-size: 12px; padding: 5px 8px; min-height: 0; }

.table-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  margin-top: 8px;
}
.action-bar .btn-ghost { padding: 4px 6px; min-height: 0; font-size: 12px; }

.setup-details {
  margin-bottom: 14px;
  border: 1px solid var(--amber-300);
  border-radius: 10px;
  background: var(--amber-100);
  overflow: hidden;
}
.setup-details summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber-700);
  cursor: pointer;
  list-style: none;
}
.setup-details summary::-webkit-details-marker { display: none; }
.setup-details summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s;
}
.setup-details[open] summary::before { transform: rotate(90deg); }
.setup-details .setup-body {
  padding: 0 14px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--amber-700);
}
.setup-details .setup-body code {
  font-size: 11px;
  word-break: break-all;
}

.drive-toolbar { display: grid; gap: 12px; }
.drive-toolbar .btn-grid .btn { width: 100%; }

.link { color: var(--emerald-700); cursor: pointer; font-weight: 600; background: none; border: none; padding: 0; font-size: inherit; }
.link:hover { text-decoration: underline; }
.muted { color: var(--slate-500); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.green { background: var(--emerald-100); color: var(--emerald-800); }
.pill.gray { background: var(--slate-100); color: var(--slate-500); }
.pill.amber { background: var(--amber-100); color: var(--amber-700); }

.member-block { border: 1px solid var(--slate-200); border-radius: 14px; margin-bottom: 16px; overflow: hidden; }
.member-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 10px 12px;
  padding: 12px 14px; background: var(--emerald-50);
}
@media (max-width: 640px) {
  .member-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .member-actions { justify-content: flex-start; }
}
.member-head .name { font-size: 16px; font-weight: 700; color: var(--emerald-900); }
.member-body { padding: 16px 18px 18px; }
.member-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500);
  margin: 18px 0 10px;
  font-weight: 700;
}
.member-section-title:first-child { margin-top: 0; }

.asset-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--slate-200); vertical-align: middle; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field input[type="file"],
form input[type="text"],
form input[type="number"],
form input[type="date"],
form select,
form input[type="file"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
  background: #fff;
  color: var(--slate-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input::placeholder,
form input::placeholder {
  color: var(--slate-500);
  opacity: 0.85;
}
.field input:focus,
.field select:focus,
form input:focus,
form select:focus {
  outline: none;
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.field-row .field { margin-bottom: 0; }
.checkbox-field { display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.checkbox-field input { margin-top: 4px; flex-shrink: 0; }
.help {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 7px;
  line-height: 1.55;
}
.preview {
  font-size: 14px;
  color: var(--emerald-800);
  margin-top: 10px;
  font-weight: 600;
  line-height: 1.5;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 50; overflow-y: auto;
  /* Track the visible area when the on-screen keyboard is up (JS sets --app-vvh) */
  height: var(--app-vvh, 100%);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  /* Head and foot stay visible; only the body scrolls */
  display: flex; flex-direction: column;
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  max-height: calc(var(--app-vvh, 100dvh) - 80px);
}
.modal-wide { max-width: 620px; }
.welcome-body .sub { margin-bottom: 20px; line-height: 1.65; font-size: 14px; }
.welcome-choices { display: flex; flex-direction: column; gap: 12px; }
.welcome-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 2px solid var(--slate-200);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.welcome-choice:hover { border-color: var(--emerald-300); background: var(--emerald-50); }
.welcome-choice.selected {
  border-color: var(--emerald-600);
  background: var(--emerald-50);
  box-shadow: 0 0 0 1px var(--emerald-600);
}
.welcome-choice-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--emerald-900);
  margin-bottom: 8px;
}
.welcome-benefits {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--slate-600);
  line-height: 1.5;
}
.welcome-benefits li { margin-bottom: 4px; }
.welcome-benefits li:last-child { margin-bottom: 0; }
.welcome-action {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--slate-200);
}
.welcome-action.hidden { display: none; }
.welcome-action .help { margin-bottom: 4px; }
.welcome-action .btn { margin-top: 14px; }
.welcome-action .field { margin-top: 14px; margin-bottom: 0; }

.drive-help-host { margin-top: 12px; }
.popup-help-list {
  margin: 8px 0 10px;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--slate-600);
  line-height: 1.55;
}
.popup-help-list li { margin-bottom: 6px; }
.popup-help-list li:last-child { margin-bottom: 0; }
.popup-help .setup-body .help { margin-top: 8px; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--slate-200); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-head h3 { font-size: 16px; color: var(--emerald-900); }
.modal-body {
  padding: 22px 24px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
  scroll-padding: 60px; /* keep focused inputs clear of head/foot */
}
.modal-body form .field:last-of-type { margin-bottom: 6px; }
.modal-foot {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: #fff;
}
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--slate-500); line-height: 1; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 120px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { background: var(--slate-100); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { background: var(--emerald-600); height: 100%; border-radius: 6px; }

.notice { padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; line-height: 1.5; }
.notice.compact { padding: 9px 12px; font-size: 12px; margin-bottom: 10px; }
.notice.ok { background: var(--emerald-50); border: 1px solid var(--emerald-100); color: var(--emerald-800); }
.notice.err { background: var(--red-50); border: 1px solid #fecaca; color: var(--red-600); }
.notice.warn { background: var(--amber-100); border: 1px solid var(--amber-300); color: var(--amber-700); }

.rate-sources { margin-top: 14px; }
.rate-sources .sub { margin-bottom: 8px; }
.source-list { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--slate-500); line-height: 1.6; }
.source-list li { margin-bottom: 2px; }

.hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(6, 78, 59, 0.18);
  max-height: 260px;
}
.hero-img { display: block; width: 100%; height: 100%; max-height: 260px; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px 22px;
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.78) 0%, rgba(6, 78, 59, 0.35) 45%, rgba(6, 78, 59, 0) 70%);
  color: #fff;
}
.hero-title { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; text-shadow: 0 1px 6px rgba(0,0,0,0.35); }
.hero-sub { margin-top: 4px; font-size: 14px; color: #e3f5ec; text-shadow: 0 1px 5px rgba(0,0,0,0.35); }
@media (max-width: 640px) {
  .hero-title { font-size: 20px; }
  .hero-sub { font-size: 12.5px; }
}

.card-meta { margin-top: 6px; font-size: 11.5px; color: var(--slate-500, #64748b); }

th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--emerald-800, #065f46); }
th.sortable::after { content: "\2195"; opacity: 0.35; font-size: 10px; margin-left: 4px; }
th.sortable.sort-asc::after { content: "\2191"; opacity: 0.9; }
th.sortable.sort-desc::after { content: "\2193"; opacity: 0.9; }
th.sortable.num::after { margin-left: 3px; }

.share-cell { width: 120px; min-width: 90px; }
.share-track { background: var(--slate-100, #f1f5f9); border-radius: 6px; height: 10px; overflow: hidden; }
.share-fill { height: 100%; background: var(--emerald-500, #10b981); border-radius: 6px; }
tr.total-row td { border-top: 2px solid var(--slate-200, #e2e8f0); background: var(--slate-50, #f8fafc); }

.spark-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--slate-100, #f1f5f9); }
.spark-row:last-child { border-bottom: none; }
.spark-label { min-width: 150px; display: flex; flex-direction: column; }
.spark-name { font-weight: 600; font-size: 14px; color: var(--slate-700, #334155); }
.spark-cur { font-size: 12px; color: var(--slate-500, #64748b); font-variant-numeric: tabular-nums; }
.spark-wrap { flex: 1; min-width: 0; }
.spark-svg { width: 100%; height: 72px; display: block; }
@media (max-width: 640px) {
  .spark-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .spark-label { flex-direction: row; justify-content: space-between; min-width: 0; }
}

.trend-legend { display: flex; gap: 16px; font-size: 12px; color: var(--slate-600, #475569); margin: 4px 0 10px; }
.trend-legend .swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: middle; }
.trend-chart { width: 100%; overflow: hidden; }
.trend-svg { width: 100%; height: 260px; display: block; }
.trend-axis { font-size: 9px; fill: var(--slate-500, #64748b); }

.subpanel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--slate-200, #e2e8f0); }
.subpanel .checkbox-field { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--slate-700, #334155); }

#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--slate-900); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); opacity: 0; transform: translateY(8px); transition: all 0.2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--emerald-800); }
.toast.err { background: var(--red-600); }

.empty {
  text-align: center;
  color: var(--slate-500);
  padding: 22px 18px;
  font-size: 14px;
  line-height: 1.65;
  border-radius: 12px;
  background: var(--slate-50);
  border: 1px dashed var(--slate-300);
}

/* Hide asset-form / panel sections (mirrors server .hidden + panel-collapse-body) */
.field-hidden { display: none !important; }
.panel-collapse-body[data-collapsed="true"] { display: none; }
.panel-collapse-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; border: none; background: transparent;
  font-weight: 600; color: var(--emerald-900); font-size: 14px;
  text-align: left; cursor: pointer;
}
.panel-collapse-toggle:hover { color: var(--emerald-700); }
.panel-chevron {
  display: inline-block; font-size: 12px; color: var(--slate-500);
  transition: transform 0.15s; line-height: 1;
}
.panel-collapse-toggle[aria-expanded="false"] .panel-chevron { transform: rotate(-90deg); }
.collapsible-panel {
  border: 1px solid var(--slate-200); border-radius: 10px;
  margin-bottom: 8px; background: #fff; overflow: hidden;
}
.collapsible-panel .panel-collapse-body {
  padding: 4px 16px 16px; font-size: 14px; line-height: 1.6;
  color: var(--slate-700); border-top: 1px solid var(--slate-100);
}

/* Collapsible member cards on dashboard */
.member-block[data-collapsed="true"] .member-body { display: none; }
.member-block[data-collapsed="true"] .member-chevron { transform: rotate(-90deg); }
.member-head-toggle {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  border: none; background: transparent; padding: 0; text-align: left; cursor: pointer;
}
.member-chevron {
  flex-shrink: 0; font-size: 11px; color: var(--emerald-700);
  transition: transform 0.15s; line-height: 1;
}

/* Per-member zakat breakdown card */
.breakdown { border: 1px solid var(--emerald-100); background: var(--emerald-50); border-radius: 10px; padding: 12px 14px; margin-bottom: 6px; font-size: 13px; color: var(--slate-700); }
.bd-head { font-weight: 700; color: var(--emerald-900); margin-bottom: 8px; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; }
.bd-item { font-variant-numeric: tabular-nums; }
.bd-total { margin-top: 8px; font-weight: 600; color: var(--slate-900); }
.bd-note { margin-top: 6px; font-size: 12px; color: var(--slate-500); }
.bd-note.warn { color: var(--amber-700); }
.wealth-col-exempt { color: #92400e; font-weight: 600; }
.wealth-col-trade { color: var(--amber-700); font-weight: 600; }

td.num.pos { color: var(--emerald-700); }
td.num.neg { color: var(--red-600); }

.guide-panel { padding-top: 8px; }
.guide-panel .panel-collapse-body p { margin: 10px 0; }
.guide-panel .panel-collapse-body ul,
.guide-panel .panel-collapse-body ol { margin: 8px 0; padding-left: 20px; line-height: 1.7; }
.guide-panel .panel-collapse-body li { margin-bottom: 4px; }

/* Sub-navigation (About / FAQ) */
.subnav { display: flex; gap: 6px; margin: 6px 0 10px; flex-wrap: wrap; }
.subnav-btn { background: var(--slate-100); border: 1px solid var(--slate-200); color: var(--slate-700); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.subnav-btn.active { background: var(--emerald-800); color: #fff; border-color: var(--emerald-800); }

/* Guide tables */
.guide-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.guide-table th, .guide-table td { border: 1px solid var(--slate-200); padding: 7px 10px; text-align: left; }
.guide-table th { background: var(--emerald-50); color: var(--emerald-900); text-transform: none; letter-spacing: 0; font-size: 13px; }
.guide-table th.hl, .guide-table td.hl { background: var(--emerald-100); }

.arabic { font-size: 26px; color: var(--emerald-800); margin: 4px 0; }

@media (max-width: 640px) {
  .site-bar {
    padding: 8px 14px 0;
  }

  .app-header-inner {
    padding: 12px 14px 6px;
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .header-meta {
    width: 100%;
    text-align: left;
    font-size: 11px;
  }

  .container {
    padding: 16px 14px 48px;
  }

  .panel {
    padding: 16px;
    border-radius: 14px;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }

  .card .value {
    font-size: 18px;
  }

  .btn-row .btn,
  .btn-grid .btn {
    width: 100%;
  }

  .tab-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .modal-overlay {
    padding: 16px 12px 0;
    align-items: flex-end;
  }

  .modal {
    max-width: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    max-height: calc(var(--app-vvh, 100dvh) - 16px);
  }

  .modal-foot {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  #toast-root {
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    align-items: stretch;
  }

  .toast {
    text-align: center;
  }

  .field-row { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr; }
  .bar-row .bar-val { grid-column: 2; text-align: right; }
  .bd-grid { grid-template-columns: 1fr; }
}

/* --- Inline form help (translatable) --- */
.help-lang {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.help-lang-label { font-size: 12px; color: var(--slate-500); margin-right: 2px; }
.help-lang-pill {
  border: 1px solid var(--emerald-100);
  background: #fff;
  color: var(--emerald-800);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.5;
}
.help-lang-pill.active {
  background: var(--emerald-600);
  border-color: var(--emerald-600);
  color: #fff;
  font-weight: 600;
}
.form-intro {
  font-size: 13px;
  line-height: 1.6;
  color: var(--emerald-800);
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 14px;
}
.cat-explainer {
  font-size: 13px;
  line-height: 1.6;
  color: var(--amber-700, #92400e);
  background: var(--amber-100, #fef3c7);
  border: 1px solid var(--amber-300, #fcd34d);
  border-radius: 10px;
  padding: 9px 13px;
  margin: -8px 0 16px;
}
.cat-explainer:empty { display: none; }
/* RTL help lines (Urdu/Arabic) read right-to-left within the same layout */
.help[dir="rtl"], .form-intro[dir="rtl"], .cat-explainer[dir="rtl"] { text-align: right; }

/* --- Welcome: region & preferences chooser --- */
.welcome-prefs {
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: 12px;
  padding: 14px 16px 6px;
  margin-bottom: 18px;
}
.welcome-prefs-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--emerald-800);
  margin-bottom: 10px;
}
.welcome-prefs .help { margin: 2px 0 10px; }
.field-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-row3 .field { margin-bottom: 8px; }
.pref-lang-wrap select { width: 100%; }
@media (max-width: 640px) {
  .field-row3 { grid-template-columns: 1fr; }
}
