/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:      #2d6a4f;
  --green-dark: #1b4332;
  --green-mid:  #40916c;
  --green-light:#d8f3dc;
  --gold:       #f4a300;
  --red:        #e63946;
  --yellow:     #f9c74f;
  --orange:     #f3722c;
  --white:      #ffffff;
  --off-white:  #f8f9fa;
  --gray-light: #e9ecef;
  --gray:       #adb5bd;
  --gray-dark:  #495057;
  --text:       #212529;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 4px 24px rgba(0,0,0,0.16);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--off-white);
  color: var(--text);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Layout shell ──────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  position: relative;
}

.screen { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.screen.active { display: flex; }

/* ── Top bar ───────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--green-dark);
  color: var(--white);
  padding: 14px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.topbar h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.5px; }
.topbar .topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.icon-btn:active { background: rgba(255,255,255,0.15); }

/* ── Scrollable content area ───────────────────────────────────────────────── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* ── Bottom nav ────────────────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--gray-light);
  flex-shrink: 0;
}
.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 4px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bottom-nav button .nav-icon { font-size: 1.5rem; line-height: 1; }
.bottom-nav button.active { color: var(--green); }
.bottom-nav button:active { background: var(--gray-light); }

/* ── Auth screen ───────────────────────────────────────────────────────────── */
#screen-auth {
  justify-content: center;
  background: var(--green-dark);
}
.auth-card {
  margin: 24px 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 8px;
}
.auth-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 24px;
}
.tab-bar {
  display: flex;
  background: var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
}
.tab-bar button {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--gray-dark);
}
.tab-bar button.active {
  background: var(--white);
  color: var(--green-dark);
  box-shadow: var(--shadow);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-dark);
  margin-bottom: 5px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--white);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green-mid);
}
.form-group.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-group.toggle-group label { margin: 0; }

/* ── Toggle switch ─────────────────────────────────────────────────────────── */
.toggle { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--green-mid); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:active { background: var(--green-dark); }
.btn-secondary {
  background: var(--gray-light);
  color: var(--gray-dark);
}
.btn-secondary:active { background: var(--gray); }
.btn-danger { background: #fee2e2; color: var(--red); }
.btn-danger:active { background: #fca5a5; }
.btn-sm {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
}
.btn + .btn { margin-top: 10px; }

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 20px;
}

/* ── Home screen ───────────────────────────────────────────────────────────── */
.start-btn-wrap { margin-bottom: 20px; }
.start-btn-wrap .btn { padding: 18px; font-size: 1.1rem; }

.section-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-light);
  margin-bottom: 16px;
}
.section-tabs button {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.section-tabs button.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Round cards ───────────────────────────────────────────────────────────── */
.round-card {
  background: var(--white);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.round-card:active { border-color: var(--green-mid); }
.round-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.round-card-course { font-weight: 700; font-size: 1rem; }
.round-card-date { font-size: 0.8rem; color: var(--gray); }
.round-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--gray-dark);
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-active   { background: #dcfce7; color: var(--green); }
.badge-done     { background: var(--gray-light); color: var(--gray-dark); }
.badge-private  { background: #fef9c3; color: #92400e; }
.badge-community { background: #e0f2fe; color: #0369a1; }

.empty-state {
  text-align: center;
  color: var(--gray);
  padding: 40px 16px;
  font-size: 0.95rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 8px; }

/* ── New round screen ──────────────────────────────────────────────────────── */
.players-list { margin-bottom: 8px; }
.player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.player-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.player-row input:focus { outline: none; border-color: var(--green-mid); }
.remove-player-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--gray);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.add-player-btn {
  background: none;
  border: 1.5px dashed var(--gray);
  border-radius: var(--radius-sm);
  width: 100%;
  padding: 10px;
  color: var(--gray-dark);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 16px;
}
.add-player-btn:active { background: var(--gray-light); }

/* ── Scoring screen ────────────────────────────────────────────────────────── */
.score-header {
  background: var(--green-dark);
  color: var(--white);
  padding: 0 16px 16px;
  flex-shrink: 0;
}
.hole-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}
.hole-nav-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  font-size: 1.8rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hole-nav-btn:active { background: rgba(255,255,255,0.30); }
.hole-nav-btn:disabled { opacity: 0.3; cursor: default; }
.hole-info { text-align: center; }
.hole-label { font-size: 0.8rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.hole-number { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.hole-par { font-size: 0.85rem; opacity: 0.8; }

.hole-pips {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.hole-pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
}
.hole-pip.current { background: var(--white); }
.hole-pip.has-score { background: rgba(255,255,255,0.7); }

.score-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
}

.player-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-light);
}
.player-score-row:last-child { border-bottom: none; }
.player-score-info { flex: 1; min-width: 0; }
.player-name {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-running {
  font-size: 0.8rem;
  color: var(--gray-dark);
  margin-top: 2px;
}
.score-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.stepper-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 1.6rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: var(--gray-light);
  color: var(--text);
}
.stepper-btn:active { background: var(--gray); }
.stepper-btn:disabled { opacity: 0.3; cursor: default; }
.score-display {
  width: 56px;
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  cursor: pointer;
}

/* Score color coding */
.score-display.score-1   { color: var(--gold); }        /* hole-in-one */
.score-display.score-eagle  { color: var(--gold); }
.score-display.score-birdie { color: var(--red); }
.score-display.score-par    { color: var(--text); }
.score-display.score-bogey  { color: #2563eb; }
.score-display.score-double { color: var(--orange); }
.score-display.score-worse  { color: var(--red); }
.score-display.score-none   { color: var(--gray); }

.score-photo {
  flex-shrink: 0;
  padding: 0 16px 10px;
  background: var(--white);
}
.score-photo-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--gray-dark);
  font-size: 0.9rem;
  font-weight: 600;
}
.score-photo-strip:active { background: var(--gray-light); }
.score-photo-strip img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.score-photo-strip .strip-icon { font-size: 1.4rem; flex-shrink: 0; }
.score-photo-strip .strip-label { flex: 1; }
.score-photo-strip .strip-change { font-size: 0.75rem; color: var(--gray); }

.score-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-light);
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}
.score-footer .btn { flex: 1; margin: 0; }

/* ── Round detail / scorecard ──────────────────────────────────────────────── */
.scorecard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}
.scorecard-table {
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 100%;
}
.scorecard-table th,
.scorecard-table td {
  padding: 6px 8px;
  text-align: center;
  border: 1px solid var(--gray-light);
  white-space: nowrap;
}
.scorecard-table th {
  background: var(--green-dark);
  color: var(--white);
  font-weight: 700;
}
.scorecard-table .row-label {
  text-align: left;
  font-weight: 600;
  background: var(--green-light);
  color: var(--green-dark);
  position: sticky;
  left: 0;
}
.scorecard-table tr:nth-child(even) td { background: var(--off-white); }
.scorecard-table .total-col { font-weight: 700; background: var(--gray-light); }
.scorecard-table .vs-par-pos { color: var(--red); font-weight: 700; }
.scorecard-table .vs-par-neg { color: var(--green); font-weight: 700; }
.scorecard-table .vs-par-e   { color: var(--gray-dark); font-weight: 700; }

/* Score colors in table */
.sc-eagle  { color: var(--gold);   font-weight: 700; }
.sc-birdie { color: var(--red);    font-weight: 700; }
.sc-bogey  { color: #2563eb; }
.sc-double { color: var(--orange); }
.sc-worse  { color: var(--red);    font-weight: 700; }

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 0.88rem;
  color: var(--gray-dark);
}

/* ── Profile screen ────────────────────────────────────────────────────────── */
.profile-section {
  background: var(--white);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.profile-section h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray);
  margin-bottom: 14px;
}

/* ── Courses screen & cards ────────────────────────────────────────────────── */
.course-card {
  background: var(--white);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.course-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 4px;
}
.course-card-name { font-weight: 700; font-size: 1rem; }
.course-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.course-card-sub      { font-size: 0.82rem; color: var(--gray-dark); padding: 0 14px; }
.course-card-location { font-size: 0.82rem; color: var(--gray-dark); padding: 2px 14px; }
.course-card-desc     { font-size: 0.85rem; color: var(--gray-dark); padding: 6px 14px 4px;
                        line-height: 1.5; white-space: pre-wrap; }
.course-card .par-grid { margin: 8px 14px 0; }
.course-card .par-grid:last-child { margin-bottom: 14px; }

/* Course photo strip */
.course-photos {
  display: flex;
  gap: 0;
}
.course-photo-slot {
  flex: 1;
  position: relative;
  background: var(--gray-light);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.course-photo-slot + .course-photo-slot {
  border-left: 2px solid var(--white);
}
.course-photo-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.course-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.course-photo-upload {
  background: none;
  border: 1.5px dashed var(--gray);
  color: var(--gray);
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  min-height: 120px;
  text-align: center;
}
.course-photo-upload:hover { border-color: var(--green-mid); color: var(--green); }
.course-photo-status {
  position: absolute;
  bottom: 4px;
  left: 0; right: 0;
  font-size: 0.72rem;
  color: var(--red);
  text-align: center;
  background: rgba(255,255,255,0.85);
  padding: 2px 4px;
}

/* Textarea in forms */
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  resize: vertical;
  line-height: 1.4;
}
textarea:focus { outline: none; border-color: var(--green-mid); }

.par-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-top: 10px;
}
.par-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.par-cell-label { font-size: 0.6rem; color: var(--gray); }
.par-cell input {
  width: 100%;
  padding: 6px 2px;
  text-align: center;
  border: 1.5px solid var(--gray-light);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}
.par-cell input:focus { outline: none; border-color: var(--green-mid); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 16px; }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; color: var(--gray-dark); }
.hidden { display: none !important; }

/* ── Round photo ───────────────────────────────────────────────────────────── */
.round-photo {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
  max-height: 320px;
  background: var(--gray-light);
}

.photo-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed var(--gray);
  border-radius: var(--radius);
  padding: 28px 16px;
  cursor: pointer;
  color: var(--gray-dark);
  font-size: 1rem;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.photo-upload-label:active { background: var(--gray-light); border-color: var(--green-mid); }
.photo-upload-sub { font-size: 0.78rem; font-weight: 400; color: var(--gray); }
.photo-upload-status { font-size: 0.85rem; color: var(--gray-dark); margin-top: 8px; text-align: center; }

/* ── Recent players chips ──────────────────────────────────────────────────── */
.recent-players-label {
  font-size: 0.75rem;
  color: var(--gray);
  font-weight: 600;
  margin-right: 6px;
  flex-shrink: 0;
}
.recent-player-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1.5px solid var(--green-mid);
  border-radius: 20px;
  background: var(--white);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.recent-player-chip:active { background: var(--green-light); }

/* ── Rounds filter bar ─────────────────────────────────────────────────────── */
.rounds-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rounds-filter-bar select {
  padding: 5px 8px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--white);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.rounds-filter-bar select:focus { outline: none; border-color: var(--green-mid); }

/* ── Round card score line ─────────────────────────────────────────────────── */
.round-card-score {
  font-size: 0.88rem;
  color: var(--gray-dark);
  margin-top: 5px;
  font-weight: 600;
}
.round-card-score .score-vs-par-pos { color: var(--red); }
.round-card-score .score-vs-par-neg { color: var(--green); }
.round-card-score .score-vs-par-e   { color: var(--gray-dark); }

/* ── Profile avatar ────────────────────────────────────────────────────────── */
.profile-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 20px;
}
.avatar-circle,
.avatar-placeholder {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--green-light);
  display: block;
}
.avatar-circle {
  object-fit: cover;
  cursor: pointer;
  background: var(--gray-light);
}
.avatar-placeholder {
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 2.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.avatar-change-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}
.avatar-remove-btn {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 2px 8px;
  margin-top: 2px;
}

/* ── Admin: user cards ─────────────────────────────────────────────────────── */
.user-card {
  background: var(--white);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}
.user-card-name { font-weight: 700; font-size: 1rem; }
.user-card-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.user-card-email { font-size: 0.8rem; color: var(--gray); margin: 4px 0 10px; }
.user-card-actions { display: flex; gap: 8px; }

.badge-admin   { background: #fef3c7; color: #92400e; }
.badge-user    { background: var(--gray-light); color: var(--gray-dark); }
.badge-locked  { background: #fee2e2; color: var(--red); }
.badge-pending { background: #fff7ed; color: #c2410c; }
.badge-self    { background: var(--green-light); color: var(--green-dark); }

/* ── Audit log ─────────────────────────────────────────────────────────────── */
.audit-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 10px;
}
.audit-filter-select {
  padding: 5px 8px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  flex: 1;
  min-width: 160px;
}
.audit-filter-select:focus { outline: none; border-color: var(--green-mid); }
.audit-count {
  font-size: 0.78rem;
  color: var(--gray);
  margin-left: auto;
  white-space: nowrap;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}
.audit-table thead th {
  text-align: left;
  padding: 6px 8px;
  background: var(--gray-light);
  color: var(--gray-dark);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.audit-table tbody tr { border-bottom: 1px solid var(--gray-light); }
.audit-table tbody tr:hover { background: #f8fdf8; }
.audit-table td { padding: 6px 8px; vertical-align: top; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.audit-ts     { width: 160px; font-family: monospace; color: var(--gray); }
.audit-user   { width: 90px;  font-weight: 600; }
.audit-ip     { width: 110px; font-family: monospace; color: var(--gray-dark); }
.audit-event  { width: 170px; }
.audit-detail { color: var(--gray-dark); white-space: nowrap; }

.audit-ev {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.audit-ev-success { background: #dcfce7; color: #166534; }
.audit-ev-danger  { background: #fee2e2; color: #991b1b; }
.audit-ev-warning { background: #fef9c3; color: #854d0e; }
.audit-ev-info    { background: #e0f2fe; color: #0c4a6e; }
.audit-ev-admin   { background: #f3e8ff; color: #6b21a8; }
.audit-ev-neutral { background: var(--gray-light); color: var(--gray-dark); }

/* ── Handicap display ──────────────────────────────────────────────────────── */
.handicap-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-dark);
  line-height: 1.2;
}
.handicap-sub {
  font-size: 0.78rem;
  color: var(--gray);
  margin-top: 4px;
}
