/* ============================================================
 * Classroom Rating — Design System v2
 * Mobile-first, semantic tokens, dark-mode + reduced-motion aware.
 * ============================================================ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  /* Color: foundation */
  --c-bg:           #F8FAFC;
  --c-surface:      #FFFFFF;
  --c-surface-2:    #F1F5F9;
  --c-border:       #E2E8F0;
  --c-border-strong:#CBD5E1;
  --c-text:         #0F172A;
  --c-text-muted:   #475569;
  --c-text-subtle:  #94A3B8;

  /* Color: brand & semantic */
  --c-primary:        #4F46E5;
  --c-primary-hover:  #4338CA;
  --c-primary-soft:   #EEF2FF;
  --c-primary-on:     #FFFFFF;
  --c-accent:         #8B5CF6;
  --c-success:        #059669;
  --c-success-soft:   #D1FAE5;
  --c-warning:        #D97706;
  --c-warning-soft:   #FEF3C7;
  --c-danger:         #DC2626;
  --c-danger-soft:    #FEE2E2;
  --c-info-soft:      #DBEAFE;

  /* Gradients */
  --grad-brand:   linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
  --grad-success: linear-gradient(135deg, #10B981 0%, #06B6D4 100%);

  /* Spacing (4pt rhythm) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 48px;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.06);
  --sh-2: 0 4px 6px -1px rgba(15,23,42,0.07), 0 2px 4px -2px rgba(15,23,42,0.04);
  --sh-3: 0 10px 25px -5px rgba(15,23,42,0.10), 0 8px 10px -6px rgba(15,23,42,0.04);
  --sh-brand: 0 10px 30px -8px rgba(79,70,229,0.35);

  /* Type */
  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ff-num: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono",
            "Menlo", "Cascadia Mono", "Courier New", monospace;

  /* Motion */
  --dur-fast: 120ms;
  --dur-med:  200ms;
  --dur-slow: 320ms;
  --ease:     cubic-bezier(0.22, 0.61, 0.36, 1);

  /* Layout */
  --header-h: 56px;
  --content-max: 640px;
}

/* Dark mode (auto-applied, can be forced with [data-theme="dark"]) */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg:           #0B1220;
    --c-surface:      #111A2C;
    --c-surface-2:    #1A2540;
    --c-border:       #1F2C44;
    --c-border-strong:#2C3B58;
    --c-text:         #E8EEF6;
    --c-text-muted:   #94A3B8;
    --c-text-subtle:  #64748B;
    --c-primary:      #818CF8;
    --c-primary-hover:#6366F1;
    --c-primary-soft: #1E1B4B;
    --c-primary-on:   #0B1220;
    --c-success-soft: #064E3B;
    --c-warning-soft: #78350F;
    --c-danger-soft:  #7F1D1D;
    --c-info-soft:    #1E3A8A;
    --sh-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4);
    --sh-2: 0 4px 8px rgba(0,0,0,0.4);
    --sh-3: 0 12px 24px rgba(0,0,0,0.5);
    --sh-brand: 0 10px 30px -8px rgba(99,102,241,0.5);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-med: 0ms; --dur-slow: 0ms; }
  *, *::before, *::after { animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important; transition-duration: 0.01ms !important;
    scroll-behavior: auto !important; }
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ff);
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1, "ss01" 1;
}

a {
  color: var(--c-primary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--c-primary-hover); }

/* ── Layout ─────────────────────────────────────────────── */
.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--s-4) var(--s-9);
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: var(--grad-brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 12px rgba(79,70,229,0.20);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  min-height: var(--header-h);
}
.header-title {
  font-size: 17px; font-weight: 600;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.header-right { display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0; }
.header-user { font-size: 13px; opacity: 0.92; }
.header-logout {
  color: rgba(255,255,255,0.88);
  font-size: 14px;
  min-height: 44px;
  display: inline-flex; align-items: center;
  padding: 0 var(--s-2);
  border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease);
}
.header-logout:hover {
  color: #fff; text-decoration: none;
  background: rgba(255,255,255,0.12);
}

/* ── Card ───────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--s-5);
  margin-top: var(--s-4);
  transition: box-shadow var(--dur-med) var(--ease);
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--c-text);
  letter-spacing: -0.005em;
  margin-bottom: var(--s-3);
}
.card-sub {
  font-size: 13px; color: var(--c-text-muted); margin-top: -8px; margin-bottom: var(--s-3);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.25);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  width: 100%;
  box-shadow: var(--sh-brand);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 14px 36px -10px rgba(79,70,229,0.45);
}
.btn-primary:disabled { background: var(--c-border-strong); box-shadow: none; }

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  width: 100%;
  border-color: var(--c-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--c-surface-2); border-color: var(--c-border-strong); }

.btn-success {
  background: var(--c-success);
  color: #fff; width: 100%;
}
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-success:disabled { background: #6EE7B7; }

.btn-danger { background: var(--c-danger); color: #fff; width: 100%; }
.btn-danger:hover:not(:disabled) { background: #B91C1C; }

.btn-ghost {
  background: transparent;
  color: var(--c-primary);
  border-color: var(--c-border);
  width: 100%;
}
.btn-ghost:hover:not(:disabled) { background: var(--c-primary-soft); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: var(--s-4); }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-muted);
  margin-bottom: var(--s-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input[type="text"], input[type="password"], input[type="number"], select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 16px;
  font-family: inherit;
  color: var(--c-text);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  appearance: none; -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.15);
}

input::placeholder { color: var(--c-text-subtle); }

.form-error {
  color: var(--c-danger);
  font-size: 14px;
  margin-top: var(--s-2);
  display: none;
  padding: var(--s-2) var(--s-3);
  background: var(--c-danger-soft);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--c-danger);
}

/* ── Slider ─────────────────────────────────────────────── */
.slider-group { margin-bottom: var(--s-6); }

.slider-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--s-2);
}
.slider-label { font-size: 15px; font-weight: 600; color: var(--c-text); }

.slider-value {
  font-family: var(--ff-num);
  font-size: 28px;
  font-weight: 700;
  color: var(--c-primary);
  min-width: 36px;
  text-align: right;
  line-height: 1;
  letter-spacing: -0.02em;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  outline: none;
  margin: 0;
  accent-color: var(--c-primary);
}

/* Webkit track + thumb */
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: var(--r-full);
  background: linear-gradient(
    to right,
    var(--c-primary) 0%,
    var(--c-primary) calc(var(--value, 50%) - 0px),
    var(--c-border) calc(var(--value, 50%) - 0px),
    var(--c-border) 100%
  );
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--c-primary);
  box-shadow: 0 2px 8px rgba(79,70,229,0.35);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(79,70,229,0.55);
}
/* Firefox track + thumb */
input[type="range"]::-moz-range-track {
  height: 8px; border-radius: var(--r-full); background: var(--c-border);
}
input[type="range"]::-moz-range-progress {
  height: 8px; border-radius: var(--r-full); background: var(--c-primary);
}
input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%; background: #fff;
  border: 3px solid var(--c-primary);
  box-shadow: 0 2px 8px rgba(79,70,229,0.35);
  cursor: pointer;
}

.slider-desc {
  font-size: 13px;
  color: var(--c-text-muted);
  min-height: 20px;
  margin-top: var(--s-2);
  line-height: 1.45;
}

.slider-ticks {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--c-text-subtle);
  padding: var(--s-1) 4px 0;
  font-family: var(--ff-num);
}

/* ── Group list ─────────────────────────────────────────── */
.group-list { list-style: none; margin-top: var(--s-2); }

.group-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  margin: 0 calc(var(--s-3) * -1);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  position: relative;
}
.group-item + .group-item { margin-top: var(--s-1); }
.group-item:hover { background: var(--c-surface-2); }
.group-item:active { transform: scale(0.99); }

.group-avatar {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-family: var(--ff-num); font-weight: 700;
  font-size: 16px;
  background: var(--grad-brand);
  color: #fff;
  letter-spacing: -0.02em;
}
.group-avatar--g2 { background: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%); }
.group-avatar--g3 { background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%); }
.group-avatar--g4 { background: linear-gradient(135deg, #10B981 0%, #06B6D4 100%); }
.group-avatar--g5 { background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%); }
.group-avatar--g6 { background: linear-gradient(135deg, #14B8A6 0%, #6366F1 100%); }

.group-body { flex: 1; min-width: 0; }
.group-name {
  font-size: 16px; font-weight: 600; color: var(--c-text);
  letter-spacing: -0.005em;
}
.group-sub {
  font-size: 13px; color: var(--c-text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.group-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-peer  { background: var(--c-info-soft);   color: #1D4ED8; }
.badge-self  { background: var(--c-success-soft);color: #047857; }
.badge-done  { background: var(--c-surface-2);   color: var(--c-text-subtle); }

/* ── Member card ────────────────────────────────────────── */
.member-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--s-5);
  margin-top: var(--s-4);
  transition: opacity var(--dur-med) var(--ease),
              transform var(--dur-med) var(--ease);
}
.member-card.is-rated { opacity: 0.55; }
.member-card-header {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.member-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.member-avatar--variant-1 { background: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%); }
.member-avatar--variant-2 { background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%); }
.member-avatar--variant-3 { background: linear-gradient(135deg, #10B981 0%, #06B6D4 100%); }
.member-avatar--variant-4 { background: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%); }
.member-name { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; }
.badge-rated {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--c-success-soft);
  color: #047857;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Score display ──────────────────────────────────────── */
.score-hero {
  text-align: center;
  padding: var(--s-7) var(--s-4) var(--s-4);
}
.score-number {
  font-family: var(--ff-num);
  font-size: 88px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  margin-bottom: var(--s-3);
}
.score-label { font-size: 14px; color: var(--c-text-muted); }

.score-bar-wrap { margin-top: var(--s-6); }
.score-bar-row {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.score-bar-label {
  font-size: 13px; color: var(--c-text-muted);
  width: 64px; text-align: right; flex-shrink: 0;
  font-weight: 500;
}
.score-bar-track {
  flex: 1; height: 16px;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.score-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width var(--dur-slow) var(--ease);
}
.score-bar-fill--you { background: var(--grad-brand); }
.score-bar-fill--avg { background: var(--c-border-strong); }
.score-bar-val {
  font-family: var(--ff-num);
  font-size: 14px; font-weight: 700;
  width: 48px; flex-shrink: 0; text-align: right;
  color: var(--c-text);
}
.score-pending {
  text-align: center; padding: var(--s-7) var(--s-4);
  color: var(--c-text-muted); font-size: 15px;
}

/* ── Page heading ───────────────────────────────────────── */
.page-heading {
  font-size: 22px;
  font-weight: 700;
  margin: var(--s-6) 0 var(--s-2);
  color: var(--c-text);
  letter-spacing: -0.02em;
}
.page-sub { font-size: 14px; color: var(--c-text-muted); margin-bottom: var(--s-2); }

/* ── Bottom action bar ──────────────────────────────────── */
.bottom-action {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: var(--s-3) var(--s-4);
  padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(15,23,42,0.06);
}
.bottom-action-inner { max-width: var(--content-max); margin: 0 auto; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--s-4) - 80px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  min-width: 200px;
  max-width: calc(100vw - var(--s-7));
  text-align: center;
  box-shadow: var(--sh-3);
  transition: top var(--dur-slow) var(--ease), opacity var(--dur-med) var(--ease);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.1);
}
.toast--visible {
  top: calc(env(safe-area-inset-top) + var(--s-4));
  opacity: 1;
}
.toast--success { background: linear-gradient(135deg, #059669 0%, #047857 100%); color: #fff; }
.toast--error   { background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%); color: #fff; }
.toast--info    { background: linear-gradient(135deg, #1E293B 0%, #334155 100%); color: #fff; }

/* ── Login page ─────────────────────────────────────────── */
.login-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) var(--s-4) var(--s-9);
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
}

.login-hero {
  text-align: center;
  padding: var(--s-7) 0 var(--s-5);
}
.login-icon {
  width: 72px; height: 72px;
  margin: 0 auto var(--s-4);
  background: var(--grad-brand);
  border-radius: var(--r-xl);
  display: grid; place-items: center;
  box-shadow: var(--sh-brand);
  position: relative;
  animation: floaty 4s var(--ease) infinite;
}
.login-icon svg { width: 40px; height: 40px; color: #fff; }
.login-icon-glyph {
  font-size: 36px; font-weight: 700; color: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: -0.02em;
  line-height: 1;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.login-title {
  font-size: 26px; font-weight: 700; color: var(--c-text);
  letter-spacing: -0.02em;
}
.login-sub {
  font-size: 14px; color: var(--c-text-muted);
  margin-top: var(--s-2);
}

.login-tab-bar {
  display: flex; gap: 0;
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: 4px;
  margin: var(--s-2) 0 var(--s-4);
}
.login-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.login-tab.active {
  background: var(--c-surface);
  color: var(--c-primary);
  box-shadow: var(--sh-1);
}

.login-panel { display: none; }
.login-panel.active { display: block; animation: fadeUp var(--dur-med) var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Admin ──────────────────────────────────────────────── */
.admin-section-title {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-subtle);
  font-weight: 700;
  margin: var(--s-6) 0 0;
}
.admin-section-title .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: var(--r-full);
  background: var(--c-primary-soft);
  color: var(--c-primary);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0;
}

.file-input-wrap { position: relative; margin-bottom: var(--s-3); }
.file-input-label {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 56px;
  padding: var(--s-3) var(--s-4);
  border: 1.5px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  background: var(--c-surface-2);
}
.file-input-label:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
}
.file-input-label .icon {
  flex-shrink: 0; width: 24px; height: 24px;
  color: var(--c-primary);
}
input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

/* ── Divider ────────────────────────────────────────────── */
.divider { height: 1px; background: var(--c-border); margin: var(--s-4) 0; }

/* ── Chips & badges ─────────────────────────────────────── */
.status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-chip--ok      { background: var(--c-success-soft); color: #047857; }
.status-chip--pending { background: var(--c-warning-soft); color: #B45309; }

/* ── Utility ────────────────────────────────────────────── */
.text-muted  { color: var(--c-text-muted); font-size: 14px; }
.text-subtle { color: var(--c-text-subtle); font-size: 13px; }
.text-center { text-align: center; }
.mt-8  { margin-top: var(--s-2); }
.mt-16 { margin-top: var(--s-4); }
.mt-24 { margin-top: var(--s-6); }

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: var(--s-2);
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Score breakdown (my-score) ─────────────────────────── */
.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.breakdown-cell {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-3);
  text-align: center;
}
.breakdown-pct {
  font-family: var(--ff-num);
  font-size: 11px; font-weight: 700;
  color: var(--c-text-subtle);
  letter-spacing: 0.04em;
}
.breakdown-name {
  font-size: 13px; font-weight: 600;
  color: var(--c-text);
  margin-top: 2px;
}

/* ── Entrance animation for cards ───────────────────────── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card, .member-card { animation: cardIn var(--dur-med) var(--ease); }

/* ── Container query helpers (for very narrow phones) ───── */
@media (max-width: 360px) {
  .score-number { font-size: 72px; }
  .login-title { font-size: 22px; }
  .page { padding-left: var(--s-3); padding-right: var(--s-3); }
}

/* ── Larger screens ─────────────────────────────────────── */
@media (min-width: 768px) {
  .page { padding: 0 var(--s-6) var(--s-9); }
  .login-wrap { padding-left: var(--s-6); padding-right: var(--s-6); }
}

/* ── Status banner (group select page) ─────────────────────── */
.status-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin: var(--s-4) 0;
  font-size: 14px;
  font-weight: 500;
}
.status-banner--none {
  background: var(--c-info-soft);
  color: #1D4ED8;
  border: 1px solid rgba(29,78,216,0.15);
}
.status-banner--tentative {
  background: var(--c-warning-soft);
  color: #92400E;
  border: 1px solid rgba(146,64,14,0.2);
}
.status-banner--confirmed {
  background: var(--c-success-soft);
  color: #047857;
  border: 1px solid rgba(4,120,87,0.2);
}

/* ── Group select card grid ───────────────────────────────── */
.gs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
@media (min-width: 720px) {
  .gs-grid { grid-template-columns: 1fr 1fr; gap: var(--s-4); }
}

.gs-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--s-4);
  display: flex; flex-direction: column; gap: var(--s-3);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.gs-card.is-mine { border-color: var(--c-primary); box-shadow: var(--sh-brand); }
.gs-card.is-full { opacity: 0.6; }
.gs-card-header {
  display: flex; align-items: center; gap: var(--s-3);
}
.gs-card-title { font-size: 17px; font-weight: 700; flex: 1; letter-spacing: -0.01em; }
.gs-card-count {
  font-family: var(--ff-num);
  font-size: 14px; font-weight: 700;
  color: var(--c-text-muted);
  padding: 2px 10px; border-radius: var(--r-full);
  background: var(--c-surface-2);
}
.gs-card-count--full { background: var(--c-danger-soft); color: var(--c-danger); }
.gs-card-leader {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 14px; color: var(--c-text);
}
.gs-leader-crown { color: var(--c-warning); font-size: 18px; }
.gs-card-members {
  display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-2);
  font-size: 13px; color: var(--c-text-muted);
  min-height: 20px;
}
.gs-member-dot { display: inline-flex; align-items: center; gap: 2px; }
.gs-member-dot::before {
  content: "\25CF"; color: var(--c-text-subtle); font-size: 10px;
}
.gs-member-dot.is-tentative::before { color: var(--c-warning); }
.gs-card-actions {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin-top: auto;
}
.gs-action-btn {
  min-height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.gs-action-btn:hover:not(:disabled) {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
}
.gs-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.gs-action-btn--primary {
  background: var(--grad-brand);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px -4px rgba(79,70,229,0.5);
}
.gs-action-btn--primary:hover:not(:disabled) { filter: brightness(1.05); }
.gs-action-btn--danger { color: var(--c-danger); }
.gs-action-btn--danger:hover:not(:disabled) {
  background: var(--c-danger-soft); border-color: var(--c-danger);
}

/* ── Admin registry overview card ─────────────────────────── */
.admin-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.admin-stat {
  background: var(--c-surface-2);
  border-radius: var(--r-md);
  padding: var(--s-2);
  text-align: center;
}
.admin-stat-num {
  font-family: var(--ff-num);
  font-size: 22px; font-weight: 700;
  color: var(--c-primary);
  line-height: 1;
}
.admin-stat-label {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 2px;
}
.admin-group-row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.admin-group-row:last-child { border-bottom: none; }
.admin-group-row .gid {
  font-family: var(--ff-num); font-weight: 700;
  min-width: 28px;
}
.admin-group-row .bar {
  flex: 1;
  height: 8px;
  background: var(--c-surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.admin-group-row .bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--grad-brand);
  border-radius: var(--r-full);
  transition: width var(--dur-med) var(--ease);
}
.admin-group-row .count {
  font-family: var(--ff-num); font-weight: 700;
  min-width: 36px; text-align: right;
}
.admin-group-row .leader-name {
  min-width: 80px;
  color: var(--c-text-muted);
}

/* ── Desktop refinements ──────────────────────────────────── */
@media (min-width: 1024px) {
  .page, .login-wrap {
    max-width: 880px;
  }
}
