*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #1D9E75;
  --green-dark: #0F6E56;
  --green-light: #E1F5EE;
  --red: #D85A30;
  --red-light: #FCEBEB;
  --amber: #BA7517;
  --blue: #185FA5;
  --bg: #0a0f1a;
  --surface: #111827;
  --surface2: #1a2235;
  --surface3: #222d42;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #eef0f4;
  --muted: #6b7a99;
  --radius: 12px;
  --felt: #0d3525;
}

/* POOL FELT BACKGROUND */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(13,53,37,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(24,95,165,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(29,158,117,0.06) 0%, transparent 50%);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* NAV */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(10,15,26,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-brand span { color: var(--text); }
.nav-brand::before {
  content: '🎱';
  font-size: 1.2rem;
}
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { font-size: 0.8rem; color: var(--muted); }
.btn-sync {
  background: var(--green);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-sync:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

/* SYNC MODAL */
.sync-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 999; backdrop-filter: blur(4px); }
.sync-box { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); padding: 2rem; width: 90%; max-width: 400px; text-align: center; }
.sync-title { font-family: 'Barlow Condensed', sans-serif; font-size: 1.3rem; font-weight: 700; margin-bottom: 0.75rem; }
.sync-msg { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; min-height: 1.2em; }
.sync-bar-track { background: var(--surface2); border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: 0.5rem; }
.sync-bar-fill { background: linear-gradient(90deg, var(--green-dark), var(--green)); height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.sync-pct { font-size: 0.8rem; color: var(--muted); }

/* MAIN */
.main { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* FILTERS */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; min-width: 110px; }
.filter-group label { font-size: 0.7rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.filter-group input, .filter-group select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  outline: none;
  transition: border-color 0.2s;
}
.filter-group input:focus, .filter-group select:focus { border-color: var(--green); }
.filter-group select option { background: var(--surface); }
.btn-filter {
  background: var(--green);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 7px;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  align-self: flex-end;
  transition: background 0.2s;
}
.btn-filter:hover { background: var(--green-dark); }
.btn-ghost-sm {
  background: transparent;
  color: var(--muted);
  font-family: 'Barlow', sans-serif;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  align-self: flex-end;
  transition: color 0.2s;
}
.btn-ghost-sm:hover { color: var(--text); }

/* COLLAPSIBLE CARDS */
.collapsible-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1.25rem; overflow: hidden; }
.collapsible-card.milestone-card { border-left: 3px solid var(--green); }
.collapsible-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1.25rem; cursor: pointer; user-select: none; transition: background 0.15s; }
.collapsible-header:hover { background: var(--surface2); }
.collapsible-title { font-family: 'Barlow Condensed', sans-serif; font-size: 0.88rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); }
.collapsible-summary { font-size: 0.78rem; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.collapsible-chevron { font-size: 0.65rem; color: var(--muted); transition: transform 0.3s; flex-shrink: 0; }
.collapsible-card.open .collapsible-chevron { transform: rotate(180deg); }
.collapsible-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.collapsible-card.open .collapsible-body { max-height: 600px; }
.collapsible-inner { padding: 0 1.25rem 1rem; }
.collapsible-inner .filters-bar { margin-bottom: 0; border: none; border-top: 1px solid var(--border); border-radius: 0; padding: 1rem 0 0.25rem; background: transparent; }
.collapsible-inner .antalya-bar { margin-bottom: 0; border: none; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.collapsible-inner .antalya-bar::after { right: 0; }

/* ANTALYA BAR */
.antalya-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.antalya-bar::after {
  content: '🏆';
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  opacity: 0.15;
}
.antalya-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 0.75rem; }
.antalya-cols { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.antalya-col { display: flex; flex-direction: column; gap: 2px; }
.antalya-period { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.antalya-wr { font-family: 'Barlow Condensed', sans-serif; font-size: 2.2rem; font-weight: 700; line-height: 1; }
.antalya-wr.good { color: var(--green); }
.antalya-wr.mid { color: var(--amber); }
.antalya-detail { font-size: 0.78rem; color: var(--muted); }
.antalya-divider { width: 1px; height: 52px; background: var(--border2); }
.antalya-arrow { font-family: 'Barlow Condensed', sans-serif; font-size: 1.1rem; font-weight: 600; }

/* METRICS */
.metrics-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 1.25rem; }
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.metric:hover { border-color: var(--border2); }
.metric-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.metric-val { font-family: 'Barlow Condensed', sans-serif; font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1; }
.metric-val.green { color: var(--green); }
.metric-val.red { color: var(--red); }

/* CHARTS GRID */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.2s;
}
.chart-card:hover { border-color: var(--border2); }
.chart-card.wide { grid-column: 1 / -1; }

/* CHART TITLE WITH TOOLTIP */
.chart-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.chart-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.info-btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
  position: relative;
}
.info-btn:hover .tooltip,
.info-btn:focus .tooltip,
.info-btn.active .tooltip { display: block; }
.tooltip {
  display: none;
  position: fixed;
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text);
  width: 220px;
  text-align: left;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
  z-index: 99999;
  white-space: normal;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  pointer-events: none;
}
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border2);
}

/* DISC TOGGLES */
.disc-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0.6rem;
}
.disc-toggle {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  cursor: pointer;
  font-family: 'Barlow', sans-serif;
  font-weight: 500;
  transition: opacity 0.2s, transform 0.1s;
  background: transparent;
}
.disc-toggle:hover { transform: translateY(-1px); }
.disc-toggle.inactive { opacity: 0.3; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; font-size: 0.78rem; color: var(--muted); }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.chart-wrap canvas {
  /* Prevent canvas from shrinking below a readable minimum on mobile */
  min-width: 320px;
}
.dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }

/* FORM STRIPS */
.form-strip { margin-bottom: 0.85rem; }
.form-strip-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.4rem; display: flex; justify-content: space-between; align-items: center; }
.form-strip-wr { font-family: 'Barlow Condensed', sans-serif; font-size: 1rem; font-weight: 600; }
.form-strip-dots-row { display: flex; align-items: flex-start; gap: 0; flex-wrap: wrap; }
.form-strip-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.form-dot {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  cursor: default;
  transition: transform 0.1s;
  position: relative;
}
.form-dot:hover,
.form-dot.active { transform: scale(1.2); z-index: 5; }
.form-dot:hover .form-dot-tooltip,
.form-dot.active .form-dot-tooltip { display: block; }
.form-dot.W { background: rgba(29,158,117,0.2); color: #5DDBB0; border: 1px solid rgba(29,158,117,0.3); }
.form-dot.L { background: rgba(216,90,48,0.2); color: #F0997B; border: 1px solid rgba(216,90,48,0.3); }

/* TABLES */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.td-win { color: var(--green); font-weight: 500; }
.td-loss { color: var(--red); font-weight: 500; }
.rating-badge { display: inline-block; background: rgba(216,90,48,0.12); color: #F0997B; font-size: 0.75rem; font-weight: 500; padding: 2px 7px; border-radius: 4px; }
.wr-badge { font-weight: 500; }
.wr-badge.good { color: var(--green); }
.wr-badge.bad { color: var(--red); }

/* POOL DECORATION */
.pool-accent {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  font-size: 20rem;
  line-height: 1;
  user-select: none;
}
.pool-accent.a1 { bottom: -2rem; right: -2rem; }
.pool-accent.a2 { top: 20%; left: -3rem; font-size: 12rem; opacity: 0.02; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .navbar { padding: 0.6rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .nav-user { display: none; }
  .nav-brand { font-size: 1.2rem; }
  .nav-right { gap: 0.5rem; }
  /* Show view-as selector on mobile — useful for scouting */
  #adminPlayerSelector { display: flex; }
  #viewAsSearch { width: 130px; font-size: 0.78rem; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: 1; }
  .antalya-cols { gap: 1rem; }
  /* Chart scrolling: contain scroll to chart area only */
  .chart-card { overflow: hidden; }
  .chart-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Snap scroll feel */
    scroll-snap-type: x proximity;
  }
  .chart-wrap canvas { min-width: 600px; }
  /* Tables scroll inside their card */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Filters wrap nicely */
  .filters-bar { gap: 0.5rem; }
  .filter-group { min-width: 90px; }
  /* View-as banner stacks on mobile */
  #viewAsBanner { flex-direction: column; gap: 0.4rem; text-align: center; padding: 0.6rem 1rem; }
  /* Milestone bar */
  .antalya-bar { padding: 0.85rem 1rem; }
  /* Feedback button sits higher on mobile so it doesn't cover nav */
  .feedback-btn { bottom: 1rem; right: 1rem; font-size: 0.85rem; padding: 0.5rem 0.9rem; }
}
@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-sync { font-size: 0.85rem; padding: 0.4rem 0.7rem; }
  /* Tabs scroll horizontally on small screens */
  .tabs-nav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
  /* Charts get a bit more room to breathe */
  .chart-wrap canvas { min-width: 520px; }
  /* Form dots slightly smaller on very small screens */
  .form-dot { width: 22px; height: 22px; font-size: 9px; }
  /* Main padding tighter */
  .main { padding: 0.75rem 0.75rem 4rem; }
  /* Metric values slightly smaller */
  .metric-val { font-size: 1.4rem; }
}

/* AI SUMMARY */
.ai-card {
  border-color: rgba(59,158,255,0.2);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(24,95,165,0.08) 100%);
  margin-bottom: 1rem;
}
.ai-summary {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}
.ai-summary p {
  margin-bottom: 0.75rem;
}
.ai-summary p:last-child { margin-bottom: 0; }
.ai-loading {
  color: var(--muted);
  font-style: italic;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* MILESTONE EDITOR INPUTS */
#milestoneEditor input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  outline: none;
  width: 100%;
}
#milestoneEditor input:focus { border-color: var(--green); }

/* NAV PLAYER */
.nav-player { display:flex; align-items:center; gap:0.6rem; }
.nav-player-info { display:flex; flex-direction:column; gap:1px; }
.nav-player-name { font-size:0.85rem; font-weight:500; color:var(--text); }
.nav-player-rating { font-size:0.72rem; color:var(--green); font-weight:500; }

/* AGENDA */
.agenda-section { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; margin-bottom:1.25rem; }
.agenda-header { margin-bottom:0.75rem; }
.agenda-strip { display:flex; gap:0.75rem; overflow-x:auto; padding-bottom:0.35rem; scrollbar-width:thin; scrollbar-color:var(--green) var(--surface2); }
.agenda-strip::-webkit-scrollbar { height:5px; }
.agenda-strip::-webkit-scrollbar-track { background:var(--surface2); border-radius:4px; }
.agenda-strip::-webkit-scrollbar-thumb { background:var(--green); border-radius:4px; }
.agenda-strip::-webkit-scrollbar-thumb:hover { background:#1D9E75; }
.agenda-empty { color:var(--muted); font-size:0.85rem; font-style:italic; padding:0.5rem 0; }

/* Tournament tab scrollbars */
#csTournSidebar { scrollbar-width:thin; scrollbar-color:var(--green) var(--surface); }
#csTournSidebar::-webkit-scrollbar { width:5px; }
#csTournSidebar::-webkit-scrollbar-track { background:var(--surface); }
#csTournSidebar::-webkit-scrollbar-thumb { background:var(--green); border-radius:4px; }
#csAchStrip::-webkit-scrollbar { height:4px; }
#csAchStrip::-webkit-scrollbar-track { background:var(--surface2); }
#csAchStrip::-webkit-scrollbar-thumb { background:var(--green); border-radius:4px; }
.cs-schedule-scroll, .et-scroll { scrollbar-width:thin; scrollbar-color:var(--green) var(--surface); }
.cs-schedule-scroll::-webkit-scrollbar, .et-scroll::-webkit-scrollbar { width:5px; }
.cs-schedule-scroll::-webkit-scrollbar-track, .et-scroll::-webkit-scrollbar-track { background:var(--surface); }
.cs-schedule-scroll::-webkit-scrollbar-thumb, .et-scroll::-webkit-scrollbar-thumb { background:var(--green); border-radius:4px; }
.agenda-card { flex-shrink:0; background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:0.75rem 1rem; min-width:200px; max-width:240px; cursor:default; transition:border-color 0.2s; }
.agenda-card:hover { border-color:var(--border2); }
.agenda-card.tournament { border-left:3px solid var(--green); }
.agenda-card.competition { border-left:3px solid var(--blue); }
.agenda-card-type { font-size:0.65rem; font-weight:600; text-transform:uppercase; letter-spacing:0.07em; margin-bottom:0.3rem; }
.agenda-card.tournament .agenda-card-type { color:var(--green); }
.agenda-card.competition .agenda-card-type { color:#3B9EFF; }
.agenda-card-name { font-size:0.85rem; font-weight:500; color:var(--text); margin-bottom:0.25rem; line-height:1.3; }
.agenda-card-date { font-size:0.75rem; color:var(--muted); }
.agenda-card-venue { font-size:0.72rem; color:var(--muted); margin-top:0.2rem; }

/* TABS */
/* LIVE PULSE ANIMATION */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* CUESCORE TOURNAMENTS SIDEBAR */
.cs-tourn-item:hover { background:var(--surface2) !important; }

/* TWO-ROW TAB STRUCTURE */
.tabs-wrapper { margin-bottom:1rem; }
.tabs-group-row { display:flex; gap:2px; border-bottom:2px solid var(--border); padding-bottom:0; }
.tab-group-btn { -webkit-appearance:none; appearance:none; background:var(--surface2); color:var(--muted); font-family:'Barlow', sans-serif; font-size:0.82rem; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; border:1px solid var(--border); border-bottom:none; border-radius:6px 6px 0 0; padding:0.35rem 1.1rem 0.45rem; cursor:pointer; transition:color 0.15s, background 0.15s; margin-bottom:-2px; }
.tab-group-btn:hover { color:var(--text); background:var(--surface3); }
.tab-group-btn.active { background:var(--surface); color:var(--text); border-color:var(--border); border-bottom-color:var(--surface); }
.tabs-nav { display:flex; gap:4px; border-bottom:1px solid var(--border); padding-bottom:0; margin-bottom:1rem; }
.tab-btn { -webkit-appearance:none; appearance:none; background:transparent; color:var(--muted); font-family:'Barlow', sans-serif; font-size:0.9rem; font-weight:500; border:none; border-bottom:2px solid transparent; padding:0.6rem 1.1rem; cursor:pointer; transition:color 0.2s, border-color 0.2s; margin-bottom:-1px; }
.tab-btn:hover { color:var(--text); }
.tab-btn.active { color:var(--text); border-bottom-color:var(--green); font-weight:600; }
.tab-content { display:none; }
.tab-content.active { display:block; }

/* PLACEHOLDER */
.placeholder-card { background:var(--surface); border:1px dashed var(--border2); border-radius:var(--radius); padding:3rem 2rem; text-align:center; margin-top:1rem; }
.placeholder-icon { font-size:3rem; margin-bottom:1rem; }
.placeholder-title { font-family:'Barlow Condensed', sans-serif; font-size:1.5rem; font-weight:700; color:var(--text); margin-bottom:0.5rem; }
.placeholder-text { font-size:0.9rem; color:var(--muted); max-width:400px; margin:0 auto; line-height:1.6; }

/* RESPONSIVE TABS */
@media (max-width:600px) {
  .tab-btn { font-size:0.78rem; padding:0.5rem 0.6rem; }
  .tabs-nav { gap:0; overflow-x:auto; flex-wrap:nowrap; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .tabs-nav::-webkit-scrollbar { display:none; }
  .tab-group-btn { font-size:0.72rem; padding:0.3rem 0.7rem 0.4rem; }
}

/* FEEDBACK BUTTON & MODAL */
.feedback-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.6rem 1.1rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(29,158,117,0.4);
  transition: transform 0.2s, background 0.2s;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.feedback-btn:hover { background: var(--green-dark); transform: translateY(-2px); }

.feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  backdrop-filter: blur(4px);
  padding: 1rem;
}
.feedback-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
}
.feedback-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.feedback-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.feedback-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.35rem;
  display: block;
}
.feedback-select, .feedback-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 0.8rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}
.feedback-select:focus, .feedback-textarea:focus { border-color: var(--green); }
.feedback-select option { background: var(--surface); }
.feedback-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
.feedback-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.feedback-msg { font-size: 0.82rem; margin-top: 0.5rem; min-height: 1.2em; }
.feedback-msg.success { color: var(--green); }
.feedback-msg.error { color: var(--red); }

/* ADMIN FEEDBACK VIEWER */
.feedback-viewer { margin-top: 1rem; }
.feedback-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.feedback-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; flex-wrap: wrap; gap: 0.4rem; }
.feedback-item-name { font-size: 0.82rem; font-weight: 500; color: var(--text); }
.feedback-item-date { font-size: 0.75rem; color: var(--muted); }
.feedback-item-cat { font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; background: rgba(29,158,117,0.15); color: var(--green); font-weight: 500; }
.feedback-item-msg { font-size: 0.85rem; color: var(--text); line-height: 1.5; }

/* ── STEP 6: Admin player selector ── */
#adminPlayerSelector {
  display: flex;
  align-items: center;
}
#viewAsWrapper { position: relative; }

#viewAsSearch {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.82rem;
  width: 180px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}
#viewAsSearch::placeholder { color: var(--muted); }
#viewAsSearch:focus { border-color: var(--green); background-color: rgba(255,255,255,0.11); }

#viewAsDropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  scrollbar-width: thin;
  scrollbar-color: var(--green) transparent;
}
#viewAsDropdown.open { display: block; }

.view-as-group {
  padding: 0.3rem 0.75rem 0.15rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.view-as-group:first-child { border-top: none; margin-top: 0; }

.view-as-option {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.view-as-option:hover,
.view-as-option.focused { background: var(--surface3); }
.view-as-option .opt-rating {
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 0.4rem;
}

/* Viewing-as banner */
#viewAsBanner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: linear-gradient(90deg, rgba(29,158,117,0.12), rgba(24,95,165,0.12));
  border-bottom: 1px solid rgba(29,158,117,0.3);
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
}
.view-as-label { color: var(--muted); }
.view-as-label strong { color: var(--green); font-weight: 600; }
.view-as-exit {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.25rem 0.75rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.view-as-exit:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }

/* ── Expandable opponent rows ── */
.opp-row:hover { background: rgba(255,255,255,0.03); }
.expand-arrow {
  font-size: 0.65rem;
  color: var(--muted);
  margin-left: 6px;
  transition: transform 0.15s;
  display: inline-block;
}
.opp-detail-row td { padding: 0; }
.opp-sub-row td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.opp-sub-row:last-child td { border-bottom: none; }
.opp-detail-row { background: rgba(0,0,0,0.15); }
/* Portrait mode — narrower charts */
@media (max-width: 768px) and (orientation: portrait) {
  .chart-wrap canvas { min-width: 340px; }
}
@media (max-width: 480px) and (orientation: portrait) {
  .chart-wrap canvas { min-width: 300px; }
}
/* ── Table search bar ── */
.table-search {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.82rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.table-search::placeholder { color: var(--muted); }
.table-search:focus { border-color: var(--green); }

/* ── Scrollable table wrapper ── */
.table-scroll {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green) transparent;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  z-index: 1;
}
/* ── Form dot tap tooltip ── */
.form-dot { position: relative; }
.form-dot-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.form-dot:hover .form-dot-tip,
.form-dot.active .form-dot-tip,
.form-dot:focus .form-dot-tip { display: block !important; }
.form-dot:focus { outline: none; }

/* ── Expandable opponent rows ── */
.opp-row:hover { background: rgba(255,255,255,0.03); }
.expand-arrow {
  font-size: 0.65rem;
  color: var(--muted);
  margin-left: 6px;
  display: inline-block;
}
.opp-detail-row td { padding: 0; }
.opp-sub-row td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.opp-sub-row:last-child td { border-bottom: none; }
.opp-detail-row { background: rgba(0,0,0,0.15); }

/* ── Portrait mode — narrower charts ── */
@media (max-width: 768px) and (orientation: portrait) {
  .chart-wrap canvas { min-width: 340px; }
}
@media (max-width: 480px) and (orientation: portrait) {
  .chart-wrap canvas { min-width: 300px; }
}

/* ── Table search bar ── */
.table-search {
  background: rgba(255,255,255,0.07);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-family: 'Barlow', sans-serif;
  font-size: 0.82rem;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.table-search::placeholder { color: var(--muted); }
.table-search:focus { border-color: var(--green); }

/* ── Scrollable table wrapper ── */
.table-scroll {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green) transparent;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  z-index: 1;
}
/* ── Costs Tab ── */
.cost-input {
  width: 100%;
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  display: block;
  transition: border-color 0.15s;
}
.cost-input:focus { border-color: var(--green); }
.cost-input option { background: var(--surface2); }

.cost-label {
  display: block;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.cost-btn-primary {
  -webkit-appearance: none;
  appearance: none;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cost-btn-primary:hover { opacity: 0.85; }
.cost-btn-primary:disabled { opacity: 0.5; cursor: default; }

.cost-btn-secondary {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}
.cost-btn-secondary:hover { border-color: var(--green); }

.cost-period-btn {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.cost-period-btn.active, .cost-period-btn:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.cost-tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  text-align: center;
}
.cost-tile-val {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.cost-tile-lbl {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cost-entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cost-entry-row:last-child { border-bottom: none; }
.cost-entry-row:hover { background: var(--surface3); }

.cost-del-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.4;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.cost-del-btn:hover { opacity: 1; }

.cost-info-btn {
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.cost-info-btn:hover { opacity: 1; }

/* ── Global green scrollbar pill (all scrollable areas) ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--green); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #17845f; }
/* Keep nav tabs scrollbar hidden on mobile */
.tabs-nav::-webkit-scrollbar { display: none; }

/* FLATPICKR — green accent override (dark theme loaded from CDN) */
.flatpickr-calendar { border-radius: 12px; font-family: 'Barlow', sans-serif; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange,
.flatpickr-day.endRange:hover { background: #1D9E75 !important; border-color: #1D9E75 !important; }
.flatpickr-day.today { border-color: #1D9E75 !important; color: #1D9E75 !important; }
.flatpickr-day.today.selected { color: #fff !important; }
.flatpickr-day:hover { background: #1a2235 !important; border-color: transparent !important; }
/* played-day dot */
.flatpickr-day.has-event { position: relative; font-weight: 600; }
.flatpickr-day.has-event::after { content:''; position:absolute; bottom:3px; left:50%; transform:translateX(-50%); width:4px; height:4px; border-radius:50%; background:#1D9E75; }
.flatpickr-day.has-event.selected::after,
.flatpickr-day.has-event.startRange::after,
.flatpickr-day.has-event.endRange::after { background:#fff; }
