:root {
  --primary: #17B9D6;
  --primary-dark: #0D9DB8;
  --navy: #1A3566;
  --gold: #F5A800;
  --success: #1e8e3e;
  --error: #d93025;
  --warning: #e8930a;
  --info: #17B9D6;
  --surface: #ffffff;
  --background: #eef6f9;
  --text: #1a2c4a;
  --text-secondary: #506070;
  --border: #c8dde5;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.07);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.13);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100dvh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Header ── */
.app-header {
  background: var(--navy);
  color: white;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(26,53,102,.35);
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  flex-wrap: wrap;
}

/* Club logo mark */
.club-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.club-logo-icon { flex-shrink: 0; }
.club-logo-text { min-width: 0; }
.app-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-subtitle {
  font-size: .7rem;
  color: rgba(255,255,255,.65);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ── Mode toggle ── */
.mode-toggle {
  display: flex;
  background: rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.8);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mode-btn.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

/* ── User info ── */
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: .875rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-ghost {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.3);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: rgba(255,255,255,.22); }

/* ── Main layout ── */
.app-main {
  max-width: 480px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}

/* ── Auth panel ── */
.auth-subtitle { color: var(--text-secondary); margin-top: 6px; margin-bottom: 20px; font-size: .9rem; }
.auth-buttons { display: flex; flex-direction: column; gap: 12px; }
.btn-provider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  font-size: 1rem;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
  font-weight: 500;
  color: var(--text);
}
.btn-provider:hover { box-shadow: var(--shadow-lg); background: #f4fafc; }

/* ── Scan area ── */
.scan-card { text-align: center; }

.scan-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  border-radius: 8px;
  transition: background .3s;
}
.scan-idle    { background: transparent; }
.scan-scanning{ background: #ddf3f8; }
.scan-success { background: #e6f4ea; }
.scan-duplicate{ background: #fff3e0; }
.scan-error   { background: #fce8e6; }

.scan-icon { font-size: 3.5rem; line-height: 1; }
.scan-message { font-size: 1.1rem; font-weight: 500; color: var(--text-secondary); }
.scan-success  .scan-message { color: var(--success); }
.scan-error    .scan-message { color: var(--error); }
.scan-duplicate .scan-message { color: var(--warning); }

/* Hidden USB input — rendered but not visible */
.nfc-hidden-input {
  position: fixed;
  opacity: 0;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ── Manual entry ── */
.manual-entry { text-align: left; margin-top: 20px; }
.manual-entry summary {
  cursor: pointer;
  font-size: .875rem;
  color: var(--primary);
  user-select: none;
  padding: 4px 0;
}
.manual-form { display: flex; gap: 8px; margin-top: 12px; }
.manual-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: monospace;
}
.manual-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(23,185,214,.2);
}
.btn-primary {
  padding: 8px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-dark); }

/* ── Count display ── */
.count-display { margin-top: 24px; display: flex; align-items: baseline; gap: 6px; justify-content: center; }
.count-number { font-size: 3rem; font-weight: 700; color: var(--navy); line-height: 1; }
.count-label { font-size: .875rem; color: var(--text-secondary); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity .25s, transform .25s;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
  z-index: 100;
}
.toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-success  { background: var(--success); }
.toast-error    { background: var(--error); }
.toast-warning  { background: #b06000; }
.toast-info     { background: var(--primary); }

.build-version {
  text-align: center;
  font-size: .7rem;
  color: var(--text-secondary);
  padding: 8px 0 16px;
  opacity: .5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1a2436;
    --background: #111a28;
    --text: #e0eaf4;
    --text-secondary: #7a9ab0;
    --border: #2a3d55;
  }
  .card { border-top-color: var(--primary); }
  .btn-provider { background: #1e2e45; color: var(--text); }
  .btn-provider:hover { background: #243550; }
  .manual-form input { background: #1e2e45; color: var(--text); }
  .scan-scanning  { background: #0e2535; }
  .scan-success   { background: #0d2318; }
  .scan-duplicate { background: #2a1e05; }
  .scan-error     { background: #2a1010; }
  .count-number   { color: var(--gold); }
}
