/* ==========================================================================
   Racha da Firma — design tokens
   Paleta: preto-verde de campo à noite + verde-grama + âmbar (cartão/atenção)
   Tipografia: Teko (scoreboard/condensada) para display, Inter para leitura
   ========================================================================== */

:root {
  --bg: #0a0e0a;
  --bg-alt: #0d120c;
  --surface: #141a10;
  --surface-2: #1b2315;
  --line: #29331f;
  --line-soft: #1f2818;

  --green: #6fcf3d;
  --green-strong: #94e85f;
  --green-dim: #3f6b28;
  --amber: #ffb020;
  --red: #ff6a5d;

  --text: #edf1e6;
  --text-dim: #9fac93;
  --text-faint: #5f6b56;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-glow: 0 0 0 1px rgba(111, 207, 61, 0.12), 0 20px 40px -20px rgba(0, 0, 0, 0.8);
  --font-display: "Teko", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #142112 0%, var(--bg) 55%), var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle pitch-line texture across the background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 118px,
      rgba(111, 207, 61, 0.05) 119px,
      transparent 120px
    );
}

a { color: inherit; }

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--green-strong);
  outline-offset: 2px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 18px 120px;
}

/* ---------- Hero / scoreboard card ---------- */

.hero {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border-radius: var(--radius-lg);
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--line) 0 8px, transparent 8px 16px);
}

.hero-kicker {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--green-strong);
  margin: 0 0 2px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin: 0 0 14px;
  color: var(--text);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 16px;
}

.hero-meta-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.hero-meta-item svg { flex: none; margin-top: 2px; color: var(--green-strong); }

.hero-meta-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1px;
}

.hero-meta-value {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}

.map-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.map-btn:hover { border-color: var(--green-dim); }
.map-btn:active { transform: scale(0.97); }
.map-btn svg { color: var(--green-strong); }

/* ---------- Finance bar (public) ---------- */

.finance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.finance-bar strong { color: var(--green-strong); font-weight: 600; }

/* ---------- Roster ---------- */

.roster-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 32px 0 12px;
}

.roster-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: 0.01em;
}

.roster-count {
  font-size: 14px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.roster-count strong { color: var(--green-strong); }

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  animation: row-in 0.25s ease;
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.roster-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--bg);
  background: var(--green);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.roster-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.roster-name {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-status {
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-status.is-paid { color: var(--green-strong); }
.roster-status.is-pending { color: var(--amber); }

.roster-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.icon-action {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-faint);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.icon-action.remove:hover {
  color: var(--red);
  border-color: rgba(255, 106, 93, 0.35);
  background: rgba(255, 106, 93, 0.08);
}
.icon-action.pay {
  color: var(--amber);
  border-color: rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.08);
}
.icon-action.pay:hover {
  border-color: rgba(255, 176, 32, 0.55);
  background: rgba(255, 176, 32, 0.14);
}

.roster-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 28px 18px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.roster-empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- Sticky CTA ---------- */

.cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
  pointer-events: none;
}

.cta-btn {
  pointer-events: auto;
  width: 100%;
  max-width: 524px;
  border: none;
  border-radius: 999px;
  padding: 15px 20px;
  background: var(--green);
  color: #0b1206;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px -8px rgba(111, 207, 61, 0.55);
  transition: transform 0.15s ease, background 0.15s ease;
}
.cta-btn:hover { background: var(--green-strong); }
.cta-btn:active { transform: scale(0.98); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 9, 5, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(16px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

@media (min-width: 560px) {
  .modal { border-radius: var(--radius-lg); }
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 4px;
}

.modal-sub {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 18px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: none;
}

.field input {
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 16px;
  padding: 12px 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}
.field input:focus { border-color: var(--green-dim); }
.field input.error { border-color: var(--red); }

.field-error {
  font-size: 12.5px;
  color: var(--red);
  margin-top: 6px;
  display: none;
}
.field-error.show { display: block; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 600;
  font-size: 15px;
  font-family: var(--font-body);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green); color: #0b1206; }
.btn-primary:hover { background: var(--green-strong); }
.btn-danger { background: var(--red); color: #200504; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--text-faint); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translate(-50%, 12px);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 24px -8px rgba(0,0,0,0.6);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.toast-ok { border-color: var(--green-dim); }
.toast.toast-err { border-color: var(--red); }

/* ---------- Loading / skeleton ---------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.state-banner {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 18px;
  line-height: 1.5;
}
.state-banner strong { color: var(--amber); }

/* ---------- Admin-only additions ---------- */

.admin-shell {
  max-width: 860px;
}

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-glow);
}

.admin-login-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 2px;
}
.admin-login-sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; }

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

.topbar-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 4px;
  margin-right: 18px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-color: var(--green); }

.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 520px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 6px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.admin-row .roster-name { font-size: 14.5px; }
.admin-row .whatsapp { font-size: 12.5px; color: var(--text-faint); }

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(255,106,93,.35); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(111,207,61,0.12);
  color: var(--green-strong);
  border: 1px solid rgba(111,207,61,0.25);
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-faint); }

.helper-text { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 4px;
}
@media (min-width: 520px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-box {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-box .stat-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}
.stat-box .stat-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}
.stat-box.accent .stat-value { color: var(--green-strong); }
.stat-box.warn .stat-value { color: var(--amber); }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.toggle-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--green);
}
.toggle-row label { font-size: 14px; font-weight: 500; margin: 0; cursor: pointer; }
.toggle-row .helper-text { margin: 0; }

.empty-inline { color: var(--text-faint); font-size: 13.5px; padding: 10px 2px; }

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