/* Tunya Fit CRM — black / gold / bone, phone-first */
:root {
  --bg: #0b0b0a;
  --card: #161513;
  --card2: #1e1c19;
  --line: #2a2823;
  --gold: #febd00;
  --gold-dim: #8a6b10;
  --bone: #e9e7e3;
  --dim: #9a958c;
  --red: #e5483f;
  --green: #3fba6a;
  --amber: #e8a13c;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--bone);
  font: 400 16px/1.45 Manrope, system-ui, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
  border-bottom: 1px solid var(--line);
}
#logo { height: 26px; filter: invert(1); }
#who {
  font-weight: 700; font-size: 13px; color: var(--gold);
  border: 1px solid var(--gold-dim); border-radius: 999px;
  padding: 4px 12px; cursor: pointer; text-transform: uppercase; letter-spacing: .04em;
}
#view { padding: 16px; max-width: 720px; margin: 0 auto; }

h2 { font-size: 20px; font-weight: 800; margin: 4px 0 14px; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 700; color: var(--dim); text-transform: uppercase;
     letter-spacing: .08em; margin: 18px 0 8px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.dim { color: var(--dim); font-size: 13px; }
.big { font-size: 28px; font-weight: 800; }
.gold { color: var(--gold); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

button, .btn {
  font: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn {
  display: block; width: 100%; text-align: center;
  background: var(--gold); color: #141210; font-weight: 800;
  border-radius: 12px; padding: 14px; font-size: 16px;
  text-transform: uppercase; letter-spacing: .03em;
}
.btn.ghost { background: var(--card2); color: var(--bone); border: 1px solid var(--line); }
.btn.small { padding: 9px 12px; width: auto; display: inline-block; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .45; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--card2); color: var(--bone); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
}
.chip.on { background: var(--gold); color: #141210; border-color: var(--gold); }

input, select, textarea {
  font: inherit; color: var(--bone); background: var(--card2);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold-dim); }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--dim);
        text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

#amount {
  font-size: 42px; font-weight: 800; text-align: center; color: var(--gold);
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
}

.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.member-row:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.active { background: var(--green); }
.dot.expiring { background: var(--amber); }
.dot.expired { background: var(--red); }
.dot.none { background: var(--dim); }

.pill { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
        text-transform: uppercase; letter-spacing: .05em; flex: none; }
.pill.active { background: #10381f; color: var(--green); }
.pill.expiring { background: #3d2c10; color: var(--amber); }
.pill.expired { background: #3d1512; color: var(--red); }
.pill.none { background: var(--card2); color: var(--dim); }
.pill.draft { background: #3d2c10; color: var(--amber); }
.pill.submitted { background: #10381f; color: var(--green); }
.pill.hot { background: #3d1512; color: var(--red); }
.pill.warm { background: #3d2c10; color: var(--amber); }
.pill.cold { background: #14283d; color: #6aa8e8; }

#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: #12110f; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; background: none; color: var(--dim); font-size: 12px; font-weight: 700;
  padding: 12px 0 10px; text-transform: uppercase; letter-spacing: .04em;
}
#tabs button.on { color: var(--gold); }
#tab-pay { position: relative; }
#tab-pay::before {
  content: "$"; display: block; margin: -26px auto 4px; width: 44px; height: 44px;
  background: var(--gold); color: #141210; border-radius: 50%;
  font-size: 22px; font-weight: 800; line-height: 44px;
}

#sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
/* display:flex above would silently defeat the hidden attribute — the overlay
   then sits invisible over the whole app eating every click. Never remove. */
#sheet[hidden] { display: none; }
#sheet-card {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 18px 16px;
  border: 1px solid var(--line);
}
@media (max-width: 640px) {
  /* phones keep the thumb-friendly bottom sheet */
  #sheet { align-items: flex-end; padding: 0; }
  #sheet-card { max-width: 720px; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
.member-row:hover { background: var(--card2); border-radius: 8px; }
.member-row .chev { color: var(--gold); font-weight: 800; flex: none; }
#toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #141210; font-weight: 800;
  padding: 10px 20px; border-radius: 999px; z-index: 30; font-size: 14px;
  white-space: nowrap;
}
.report-table { width: 100%; border-collapse: collapse; }
.report-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.report-table td:last-child { text-align: right; }
.report-table input { padding: 7px 9px; text-align: right; }
.section-note { font-size: 13px; color: var(--dim); font-style: italic; margin: 6px 0 10px; }
.gate { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: center; }
