/* ═══════════════════════════════════════════════════════════════════════
   GroupWeight – groupweight.css
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Reset / Root ────────────────────────────────────────────────────── */
.gw-root { all: initial; display: block; }
.gw-root *, .gw-root *::before, .gw-root *::after { box-sizing: border-box; margin: 0; padding: 0; }
.gw-root { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.55; color: #e2e8f0; background: transparent; }

/* ── Wrap ────────────────────────────────────────────────────────────── */
.gw-wrap { max-width: 1080px; margin: 0 auto; padding: 0 1rem 3rem; }

/* ── Views (full-page sections, only one visible at a time) ──────────── */
.gw-view          { display: none; }
.gw-view.active   { display: block; }

/* ── Splash / Spinner ────────────────────────────────────────────────── */
.gw-splash { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; gap: .75rem; color: #94a3b8; }
.gw-spinner { width: 32px; height: 32px; border: 3px solid rgba(74,222,128,.15); border-top-color: #4ade80; border-radius: 50%; animation: gw-spin .7s linear infinite; }
@keyframes gw-spin { to { transform: rotate(360deg); } }

/* ── Header ──────────────────────────────────────────────────────────── */
.gw-header { padding: 1.5rem 0 1.25rem; }
.gw-header-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.gw-logo { display: flex; align-items: center; gap: .55rem; }
.gw-logo span { font-size: 1.45rem; font-weight: 700; color: #f8fafc; letter-spacing: -.02em; }
.gw-tagline { font-size: .85rem; color: #94a3b8; font-style: italic; }

/* ── Status messages ─────────────────────────────────────────────────── */
.gw-status { padding: .7rem 1rem; border-radius: .45rem; font-size: .875rem; margin-bottom: 1rem; display: none; }
.gw-status--info    { background: rgba(96,165,250,.12);  color: #93c5fd; border-left: 3px solid #3b82f6; }
.gw-status--success { background: rgba(74,222,128,.12);  color: #86efac; border-left: 3px solid #22c55e; }
.gw-status--error   { background: rgba(248,113,113,.12); color: #fca5a5; border-left: 3px solid #ef4444; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.gw-card { background: rgba(255,255,255,.04); border: 1px solid rgba(148,163,184,.12); border-radius: .75rem; padding: 1.5rem; margin-bottom: 1.25rem; }
.gw-card--centered { max-width: 420px; margin-left: auto; margin-right: auto; text-align: center; }
.gw-card--chart { min-height: 280px; }
.gw-card--table { padding-bottom: 1rem; }
.gw-card-title { font-size: 1rem; font-weight: 600; color: #f1f5f9; margin-bottom: 1.1rem; }
.gw-card-title-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.gw-card-title-row .gw-card-title { margin-bottom: 0; }

/* ── Grid ────────────────────────────────────────────────────────────── */
.gw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }

/* ── Stats strip ─────────────────────────────────────────────────────── */
.gw-stats { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.gw-stat { background: rgba(255,255,255,.04); border: 1px solid rgba(148,163,184,.1); border-radius: .55rem; padding: .75rem 1rem; flex: 1; min-width: 120px; }
.gw-stat-label { display: block; font-size: .75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.gw-stat-value { font-size: 1.15rem; font-weight: 600; color: #f1f5f9; }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.gw-tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 2px solid rgba(148,163,184,.12); margin-bottom: 1.5rem; padding-bottom: 0; }
.gw-tab { background: none; border: none; border-bottom: 3px solid transparent; color: #64748b; cursor: pointer; font-size: .875rem; font-weight: 600; padding: .6rem .9rem; margin-bottom: -2px; transition: color .15s, border-color .15s; white-space: nowrap; }
.gw-tab:hover       { color: #e2e8f0; }
.gw-tab--active     { color: #4ade80; border-bottom-color: #4ade80; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.gw-form { display: flex; flex-direction: column; gap: .85rem; }
.gw-field { display: flex; flex-direction: column; gap: .35rem; }
.gw-field label { font-size: .8rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }
.gw-field input, .gw-field select, .gw-field textarea {
  background: #1e293b; border: 1px solid rgba(148,163,184,.3);
  border-radius: .4rem; color: #f1f5f9; font-size: .9rem; padding: .55rem .75rem;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.gw-field input::placeholder, .gw-field textarea::placeholder { color: #475569; }
.gw-field input:focus, .gw-field select:focus, .gw-field textarea:focus {
  outline: none; border-color: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.12);
  background: #1e293b;
}
.gw-field select { cursor: pointer; }
.gw-field select option { background: #1e293b; color: #e2e8f0; }
.gw-field select { background-image: none; }
.gw-field--check { flex-direction: row; align-items: center; gap: .6rem; }
.gw-field--check input[type=checkbox] { width: 16px; height: 16px; accent-color: #4ade80; flex-shrink: 0; }
.gw-field--check label { font-size: .875rem; text-transform: none; letter-spacing: 0; color: #cbd5e1; }
.gw-field-group { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.gw-optional { font-size: .7rem; font-weight: 400; color: #64748b; text-transform: none; letter-spacing: 0; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.gw-btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: none; border-radius: .4rem; cursor: pointer; font-size: .875rem; font-weight: 600; padding: .55rem 1.1rem; transition: background .15s, opacity .15s; white-space: nowrap; }
.gw-btn:disabled { opacity: .45; cursor: not-allowed; }
.gw-btn--primary   { background: #4ade80; color: #0f172a; }
.gw-btn--primary:hover { background: #86efac; }
.gw-btn--secondary { background: rgba(74,222,128,.15); color: #4ade80; border: 1px solid rgba(74,222,128,.3); }
.gw-btn--secondary:hover { background: rgba(74,222,128,.25); }
.gw-btn--danger    { background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.gw-btn--danger:hover { background: rgba(239,68,68,.28); }
.gw-btn--ghost     { background: transparent; color: #94a3b8; border: 1px solid rgba(148,163,184,.25); }
.gw-btn--ghost:hover { background: rgba(148,163,184,.1); color: #e2e8f0; }
.gw-btn--full      { width: 100%; }
.gw-btn--sm        { font-size: .8rem; padding: .35rem .75rem; }
.gw-btn--xs        { font-size: .75rem; padding: .2rem .5rem; }
.gw-btn--active    { outline: 2px solid #4ade80; }
.gw-btn-row        { display: flex; gap: .5rem; flex-wrap: wrap; }
.gw-link-btn       { background: none; border: none; color: #4ade80; cursor: pointer; font-size: inherit; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.gw-import-label   { cursor: pointer; }

/* ── Table ───────────────────────────────────────────────────────────── */
.gw-table-wrap { overflow-x: auto; }
.gw-table { border-collapse: collapse; font-size: .85rem; width: 100%; }
.gw-table th { background: rgba(148,163,184,.08); color: #64748b; font-size: .75rem; letter-spacing: .05em; padding: .6rem .85rem; text-align: left; text-transform: uppercase; white-space: nowrap; }
.gw-table td { border-bottom: 1px solid rgba(148,163,184,.07); color: #cbd5e1; padding: .65rem .85rem; vertical-align: middle; }
.gw-table tr:last-child td { border-bottom: none; }
.gw-table tr:hover td { background: rgba(255,255,255,.02); }
.gw-empty { color: #64748b; font-style: italic; text-align: center; padding: 2rem !important; }
.gw-delta--down { color: #4ade80; }
.gw-delta--up   { color: #f87171; }
.gw-date        { color: #94a3b8; font-size: .82rem; white-space: nowrap; }

/* Leaderboard extras */
.gw-table--leaderboard .gw-rank { font-size: 1.1rem; text-align: center; width: 2.5rem; }
.gw-row--me td { background: rgba(74,222,128,.04); }
.gw-row--me td:first-child { border-left: 2px solid #4ade80; }
.gw-you-badge { font-size: .7rem; background: rgba(74,222,128,.2); color: #4ade80; border-radius: 999px; padding: .05rem .4rem; margin-left: .25rem; }

/* ── Chart ───────────────────────────────────────────────────────────── */
.gw-chart-wrap { position: relative; height: 220px; width: 100%; margin-bottom: .75rem; }
.gw-chart-wrap canvas { max-width: 100%; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.gw-badge        { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; }
.gw-badge--owner { background: rgba(251,191,36,.12); color: #fbbf24; }
.gw-badge--warn  { background: rgba(251,146,60,.15);  color: #fb923c; }
.gw-badge--muted { background: rgba(148,163,184,.12); color: #94a3b8; }
.gw-badge        { background: rgba(148,163,184,.12); color: #94a3b8; }

/* ── Misc ────────────────────────────────────────────────────────────── */
.gw-muted         { color: #64748b; font-size: .875rem; }
.gw-muted--center { text-align: center; }
.gw-micro         { color: #64748b; font-size: .775rem; line-height: 1.5; }
.gw-divider       { border: none; border-top: 1px solid rgba(148,163,184,.12); margin: 1.25rem 0; }
.gw-lock-icon     { font-size: 2.2rem; margin-bottom: .5rem; }
.gw-note-icon     { cursor: help; margin-left: .3rem; }
.gw-label         { font-size: .8rem; color: #64748b; }
.gw-export-btns   { display: flex; gap: .4rem; flex-wrap: wrap; }
.gw-info-box      { background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.2); border-radius: .4rem; color: #93c5fd; font-size: .82rem; margin-top: 1rem; padding: .65rem .9rem; text-align: left; }
.gw-info-box a    { color: #60a5fa; }
.gw-warning-box   { background: rgba(251,146,60,.1); border: 1px solid rgba(251,146,60,.25); border-radius: .4rem; color: #fdba74; font-size: .82rem; padding: .6rem .85rem; }

/* ── Progress bar ─────────────────────────────────────────────────────── */
.gw-progress-wrap  { margin-bottom: 1rem; }
.gw-progress-track { background: rgba(148,163,184,.12); border-radius: 999px; height: 8px; overflow: hidden; width: 100%; }
.gw-progress-bar   { background: #4ade80; border-radius: 999px; height: 100%; transition: width .2s; width: 0; }

/* ── Groups ──────────────────────────────────────────────────────────── */
.gw-group-card { background: rgba(255,255,255,.02); border: 1px solid rgba(148,163,184,.1); border-radius: .6rem; margin-bottom: .85rem; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.gw-group-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .4rem; }
.gw-group-name  { font-size: .95rem; color: #e2e8f0; margin-right: .4rem; }
.gw-group-meta  { font-size: .8rem; color: #64748b; }
.gw-group-code-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.gw-invite-code { font-family: monospace; font-size: .9rem; letter-spacing: .08em; background: rgba(74,222,128,.1); color: #4ade80; border-radius: .3rem; padding: .15rem .5rem; }
.gw-group-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.gw-group-picker { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ── Modals ──────────────────────────────────────────────────────────── */
.gw-modal-backdrop { align-items: center; background: rgba(0,0,0,.7); bottom: 0; display: flex; justify-content: center; left: 0; position: fixed; right: 0; top: 0; z-index: 9999; padding: 1rem; }
.gw-modal { background: #1e293b; border: 1px solid rgba(148,163,184,.18); border-radius: .75rem; max-width: 480px; padding: 1.75rem; width: 100%; max-height: 90vh; overflow-y: auto; }
.gw-modal-title { color: #f1f5f9; font-size: 1.05rem; font-weight: 700; margin-bottom: 1.25rem; }
.gw-modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }
.gw-request-row { align-items: center; border-bottom: 1px solid rgba(148,163,184,.08); display: flex; justify-content: space-between; padding: .65rem 0; gap: 1rem; }
.gw-request-row:last-child { border-bottom: none; }

/* ── Noscript ────────────────────────────────────────────────────────── */
.gw-noscript { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); border-radius: .5rem; color: #fca5a5; font-family: sans-serif; margin: 2rem auto; max-width: 480px; padding: 1rem; text-align: center; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .gw-grid { grid-template-columns: 1fr; }
  .gw-stats { gap: .5rem; }
  .gw-stat  { min-width: calc(50% - .25rem); }
  .gw-tab   { font-size: .78rem; padding: .5rem .6rem; }
  .gw-card  { padding: 1.1rem; }
  .gw-table th, .gw-table td { padding: .5rem .6rem; font-size: .8rem; }
  .gw-card-title-row { flex-direction: column; align-items: flex-start; }
}

/* ── Rekey stepped UI ────────────────────────────────────────────────── */
.gw-rekey-check {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  background: rgba(74,222,128,.07);
  border: 1px solid rgba(74,222,128,.2);
  border-radius: .5rem;
  padding: .85rem 1rem;
  cursor: pointer;
}
.gw-rekey-check input[type=checkbox] {
  width: 18px; height: 18px;
  accent-color: #4ade80;
  flex-shrink: 0;
  margin-top: .1rem;
  cursor: pointer;
}
.gw-rekey-check label {
  font-size: .9rem;
  color: #cbd5e1;
  cursor: pointer;
  line-height: 1.45;
}
.gw-rekey-step-label {
  color: #4ade80;
  font-size: .8rem;
}

/* ── Backup nudge banner ─────────────────────────────────────────────── */
.gw-backup-nudge {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  background: linear-gradient(135deg, rgba(251,191,36,.1), rgba(251,146,60,.08));
  border: 1px solid rgba(251,191,36,.3);
  border-radius: .65rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}
.gw-backup-nudge-content {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
}
.gw-backup-nudge-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: .1rem;
}
.gw-backup-nudge-content strong {
  display: block;
  color: #fbbf24;
  font-size: .95rem;
  margin-bottom: .25rem;
}
.gw-backup-nudge-content p {
  color: #94a3b8;
  font-size: .82rem;
  line-height: 1.5;
  margin: 0;
}
.gw-backup-nudge-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── v3 additions ────────────────────────────────────────────────────── */
.gw-select-sm {
  background: #1e293b;
  border: 1px solid rgba(148,163,184,.3);
  border-radius: .35rem;
  color: #e2e8f0;
  font-size: .8rem;
  padding: .3rem .6rem;
  cursor: pointer;
}
.gw-select-sm:focus { outline: none; border-color: #4ade80; }
.gw-select-sm option { background: #1e293b; color: #e2e8f0; }

.gw-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: .85rem;
}
.gw-session-row:last-child { border-bottom: none; }
.gw-session-date   { color: #cbd5e1; }
.gw-session-expiry { color: #64748b; font-size: .78rem; }

.gw-backup-code {
  display: block;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: .3rem;
  padding: .35rem .5rem;
  font-family: monospace;
  font-size: .85rem;
  color: #4ade80;
  letter-spacing: .1em;
  text-align: center;
}

.gw-badge--success {
  background: rgba(74,222,128,.15);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,.25);
}

/* Rekey check box */
.gw-rekey-check {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  background: rgba(74,222,128,.07);
  border: 1px solid rgba(74,222,128,.2);
  border-radius: .5rem;
  padding: .85rem 1rem;
  cursor: pointer;
}
.gw-rekey-check input[type=checkbox] { width:18px;height:18px;accent-color:#4ade80;flex-shrink:0;margin-top:.1rem;cursor:pointer; }
.gw-rekey-check label { font-size:.9rem;color:#cbd5e1;cursor:pointer;line-height:1.45; }
.gw-rekey-step-label { color:#4ade80;font-size:.8rem; }

/* Backup nudge */
.gw-backup-nudge {
  display: flex; flex-direction: column; gap: .85rem;
  background: linear-gradient(135deg,rgba(251,191,36,.1),rgba(251,146,60,.08));
  border: 1px solid rgba(251,191,36,.3); border-radius: .65rem;
  padding: 1rem 1.15rem; margin-bottom: 1.25rem;
}
.gw-backup-nudge-content { display:flex;gap:.85rem;align-items:flex-start; }
.gw-backup-nudge-icon    { font-size:1.6rem;flex-shrink:0;line-height:1;margin-top:.1rem; }
.gw-backup-nudge-content strong { display:block;color:#fbbf24;font-size:.95rem;margin-bottom:.25rem; }
.gw-backup-nudge-content p { color:#94a3b8;font-size:.82rem;line-height:1.5;margin:0; }
.gw-backup-nudge-actions { display:flex;gap:.5rem;flex-wrap:wrap; }

/* Progress */
.gw-progress-wrap  { margin: .75rem 0; }
.gw-progress-track { background:rgba(255,255,255,.08);border-radius:99px;height:8px;overflow:hidden; }
.gw-progress-bar   { background:linear-gradient(90deg,#4ade80,#22d3ee);height:100%;border-radius:99px;transition:width .3s ease;width:0%; }
