/* ═══════════════════════════════════════════════════════════════════
   T-SHIRT TOOLS — SHARED STYLES
   Matches the existing /team/ aesthetic: navy/cream/lime, Fredoka +
   Nunito, offset-shadow buttons. Brand color overrides per workspace
   come from --ws-brand and --ws-accent (set by tshirt-core.js).
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ws-brand: #0B2A56;
  --ws-accent: #B6E33B;
  --bg: #FFFCF5;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --card: #FFFFFF;
  --warn: #DC2626;
  --good: #16A34A;
  --shadow: 4px 4px 0 var(--ws-brand);
  --shadow-lg: 6px 6px 0 var(--ws-brand);
  --shadow-sm: 2px 2px 0 var(--ws-brand);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ws-brand);
  margin: 0 0 8px;
}
h1 { font-size: clamp(26px, 4vw, 38px); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

a { color: var(--ws-brand); }

/* ── Top bar (workspace badge, voter, nav) ──────────────────────── */
.tsh-topbar {
  background: var(--ws-brand);
  color: #fff;
  padding: 14px 22px;
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--ws-accent);
}
.tsh-ws-badge {
  background: var(--ws-accent);
  color: var(--ink);
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tsh-ws-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  font-weight: 600;
}
.tsh-nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-left: auto;
}
.tsh-nav a {
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.tsh-nav a:hover { background: rgba(255,255,255,0.15); }
.tsh-nav a.active {
  background: var(--ws-accent);
  color: var(--ink);
  font-weight: 700;
}
.tsh-voter-pill {
  background: rgba(0,0,0,0.25);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.tsh-voter-pill select {
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
}

/* ── Page container ─────────────────────────────────────────────── */
.tsh-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 22px 80px;
}
.tsh-page > p.lede {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 760px;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.tsh-card {
  background: var(--card);
  border: 1.5px solid var(--ws-brand);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.tsh-card.compact { padding: 14px 16px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.tsh-btn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  border: 1.5px solid var(--ws-brand);
  background: var(--ws-accent);
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ws-brand);
  transition: transform 0.05s, box-shadow 0.05s;
  text-decoration: none;
  display: inline-block;
  line-height: 1.3;
}
.tsh-btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ws-brand); }
.tsh-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ws-brand); }
.tsh-btn.secondary { background: #fff; }
.tsh-btn.danger { background: #fee2e2; border-color: var(--warn); box-shadow: 3px 3px 0 var(--warn); color: var(--warn); }
.tsh-btn.big { font-size: 18px; padding: 14px 24px; }
.tsh-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Inputs ─────────────────────────────────────────────────────── */
.tsh-input, .tsh-select, .tsh-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  background: #fff;
}
.tsh-input:focus, .tsh-select:focus, .tsh-textarea:focus {
  outline: none;
  border-color: var(--ws-brand);
  box-shadow: 0 0 0 3px var(--ws-accent);
}
.tsh-textarea { min-height: 80px; resize: vertical; }
.tsh-label {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ws-brand);
  margin: 12px 0 6px;
  letter-spacing: 0.02em;
}

/* ── Stat tiles ─────────────────────────────────────────────────── */
.tsh-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.tsh-stat {
  background: var(--ws-brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1.5px solid var(--ws-brand);
  box-shadow: var(--shadow);
}
.tsh-stat .num {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 36px;
  font-weight: 600;
  color: var(--ws-accent);
  line-height: 1;
}
.tsh-stat .lbl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
  color: rgba(255,255,255,0.85);
}

/* ── Tables ─────────────────────────────────────────────────────── */
.tsh-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1.5px solid var(--ws-brand);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tsh-table th, .tsh-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.tsh-table th {
  background: var(--ws-brand);
  color: #fff;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Pills / tags ───────────────────────────────────────────────── */
.tsh-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--line);
  color: var(--ink);
}
.tsh-pill.brand { background: var(--ws-accent); }
.tsh-pill.good  { background: #dcfce7; color: var(--good); }
.tsh-pill.warn  { background: #fee2e2; color: var(--warn); }
.tsh-pill.muted { background: #f1f5f9; color: var(--muted); }

/* ── Live status indicator (Supabase realtime) ──────────────────── */
.tsh-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.tsh-live::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.tsh-live.connected::before {
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(22,163,74,0.4);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* ── Toast / notice ─────────────────────────────────────────────── */
.tsh-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: toastIn 0.2s ease-out;
}
.tsh-toast.good { background: var(--good); }
.tsh-toast.warn { background: var(--warn); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile */
@media (max-width: 720px) {
  .tsh-topbar { padding: 12px 16px; gap: 10px; }
  .tsh-nav { width: 100%; order: 99; }
  .tsh-page { padding: 24px 16px 60px; }
}
