:root {
  --bg-base: #080c14;
  --bg-surface: #0f1624;
  --bg-card: #131c2e;
  --bg-card-hover: #19243a;
  --bg-elevated: #1c2840;
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-emerald: #10b981;
  --accent-emerald-dim: rgba(16, 185, 129, 0.14);
  --accent-rose: #f43f5e;
  --accent-rose-dim: rgba(244, 63, 94, 0.14);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.14);
  --accent-sky: #38bdf8;
  --accent-sky-dim: rgba(56, 189, 248, 0.14);
  --accent-indigo: #6366f1;

  /* GTO Wizard Action Colors */
  --gto-raise: #e11d48;
  --gto-call: #10b981;
  --gto-fold: #283548;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html, body {
  height: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Toast Notification Banner */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-emerald);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast-item.toast-error {
  border-left-color: var(--accent-rose);
}

/* Auth Screen */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(16, 185, 129, 0.1), transparent 40%),
    radial-gradient(circle at 82% 80%, rgba(99, 102, 241, 0.1), transparent 40%),
    var(--bg-base);
}

.auth-container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  max-width: 980px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.auth-hero {
  padding: 40px;
  background: linear-gradient(155deg, #0f172a 0%, #090d16 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #04130d;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--accent-emerald);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.auth-hero h1 {
  font-size: 26px;
  line-height: 1.25;
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.auth-hero p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-feature-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.feature-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
}

.feature-pill strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.feature-pill span {
  color: var(--text-secondary);
  font-size: 11px;
}

.auth-card {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-tabs {
  display: flex;
  background: var(--bg-base);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.auth-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-emerald);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #04130d;
}

.btn-primary:hover {
  background: #34d399;
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-block {
  width: 100%;
}

.auth-divider {
  text-align: center;
  margin: 16px 0;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Main App Layout */
.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 24px;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 10px 10px 4px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-emerald-dim);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--accent-emerald);
  font-weight: 600;
}

.nav-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.nav-badge.badge-alert {
  background: var(--accent-rose-dim);
  color: var(--accent-rose);
}

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.user-pill-info {
  overflow: hidden;
}

.user-pill-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-pill-email {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Main Workspace */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: rgba(15, 22, 36, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.topbar-title-group h2 {
  font-size: 17px;
  font-weight: 700;
}

.topbar-title-group p {
  font-size: 12px;
  color: var(--text-secondary);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.date-range-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  min-height: 40px;
}

.date-range-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.date-range-sep {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.date-input {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 10px;
  min-width: 140px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  color-scheme: dark;
  cursor: pointer;
}

.date-input:focus {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.stakes-multiselect {
  position: relative;
  display: inline-flex;
}

.stakes-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  min-height: 40px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
}

.stakes-dropdown-btn:hover,
.stakes-dropdown-btn[aria-expanded="true"] {
  border-color: var(--accent-emerald);
}

.stakes-dropdown-summary {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.stakes-caret {
  font-size: 11px;
  color: var(--text-secondary);
}

.stakes-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stakes-dropdown-menu.hidden {
  display: none;
}

.stakes-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
}

.stakes-option-row:hover {
  background: var(--bg-elevated);
}

.stakes-option-row input[type="checkbox"],
.stakes-option-row input[type="radio"] {
  accent-color: var(--accent-emerald);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.stakes-option-count {
  margin-left: auto;
  padding-left: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stakes-menu-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.SegmentedControl {
  display: inline-flex;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.content-body {
  padding: 24px 28px 48px;
  max-width: 1440px;
  width: 100%;
}

/* Banner above the tabs while the hands load (app.js: setHandsBanner) */
.loading-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: var(--accent-sky-dim);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-sky);
  border-radius: var(--radius-md);
  font-size: 13px;
  animation: loading-banner-in 0.2s ease-out;
}

.loading-banner.loading-banner-error {
  background: var(--accent-rose-dim);
  border-left-color: var(--accent-rose);
  animation: none;
}

.loading-banner-text {
  flex: 1;
}

.loading-banner .loading-banner-btn {
  padding: 6px 12px;
}

.loading-spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-sky);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.loading-banner-error .loading-spinner {
  display: none;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loading-banner-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin: 6px 0 4px;
}

/* bb/100 under a card's dollar value */
.kpi-bb {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.text-pos {
  color: var(--accent-emerald);
}

.text-neg {
  color: var(--accent-rose);
}

.text-warn {
  color: var(--accent-amber);
}

.text-sky {
  color: var(--accent-sky);
}

/* Section Panels */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Tables */
.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.mono {
  font-family: var(--font-mono);
}

/* Uploads table file name: at most 30 characters wide (a "2026-09-01_to_2026-09-13.txt" name fits), longer names end in
   "…" so they never widen the table */
.upload-file-name {
  display: block;
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One date in the uploads table's Hand Dates: never split at its hyphens */
.upload-date {
  white-space: nowrap;
}

.hand-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  min-width: 42px;
}

.tag-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.tag-badge.tag-rose {
  background: var(--accent-rose-dim);
  color: var(--accent-rose);
}

.tag-badge.tag-emerald {
  background: var(--accent-emerald-dim);
  color: var(--accent-emerald);
}

.tag-badge.tag-amber {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
}

.tag-badge.tag-sky {
  background: var(--accent-sky-dim);
  color: var(--accent-sky);
}

/* Visual Poker Table (Positions Losing Most Money) */
.poker-table-arena {
  position: relative;
  height: 290px;
  background: radial-gradient(ellipse at center, #0e3a2f 0%, #07221b 65%, #0c1424 100%);
  border: 6px solid #1e293b;
  border-radius: 150px;
  margin: 14px auto 20px;
  max-width: 640px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.65);
}

.table-center-info {
  text-align: center;
  pointer-events: none;
}

.table-center-info .center-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
}

.table-center-info .center-sub {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.seat-node {
  position: absolute;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 11px;
  min-width: 108px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.seat-node:hover, .seat-node.selected {
  transform: scale(1.06);
  border-color: var(--accent-emerald);
}

.seat-node.seat-losing {
  border-color: rgba(244, 63, 94, 0.65);
}

.seat-node.seat-winning {
  border-color: rgba(16, 185, 129, 0.65);
}

.seat-pos-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.seat-pnl {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.seat-bb {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* GTO Wizard 13x13 Range Matrix */
.gto-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
/* GTO Wizard Top Navbar & Action Tree */
.gto-wizard-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  margin-bottom: 12px;
}


.gto-tree-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gto-format-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-sky);
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-family: var(--font-mono);
}

.gto-stack-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #090d16;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.gto-stack-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gto-stack-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.gto-stack-pill.active {
  background: #1e293b;
  color: #10b981;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.gto-action-tree-container {
  background: #0a0e17;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.gto-action-tree {
  display: flex;
  gap: 10px;
  min-width: max-content;
}

.gto-tree-card {
  flex: 0 0 135px;
  min-width: 135px;
  max-width: 165px;
  background: #111622;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  cursor: pointer;
}

.gto-tree-card:hover {
  border-color: #334155;
}

.gto-tree-card.active-study-pos {
  border: 2px solid #10b981 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
  background: #121a28;
}

.gto-tree-card.open-raiser-pos {
  border-color: rgba(16, 185, 129, 0.7);
}

.gto-tree-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.card-pos-name {
  font-weight: 700;
  font-size: 13px;
  color: #f8fafc;
}

.card-pos-stack {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}

.gto-tree-card.active-study-pos .card-pos-name,
.gto-tree-card.active-study-pos .card-pos-stack {
  color: #10b981;
}

.gto-tree-actions-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gto-tree-action-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.12s;
}

.gto-tree-action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.gto-tree-action-btn.selected-action {
  background: #2e384d;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.range-matrix {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
  background: var(--bg-base);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  user-select: none;
}

.matrix-cell {
  position: relative;
  aspect-ratio: 1 / 0.88;
  background: var(--gto-fold);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.08s, border-color 0.08s;
}

.matrix-cell:hover {
  border-color: #ffffff;
  z-index: 2;
  transform: scale(1.06);
}

.matrix-cell.active-cell {
  outline: 2px solid var(--accent-amber);
  z-index: 3;
}

.cell-hand-label {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.cell-bars {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 1;
}

.cell-bar-raise {
  background: var(--gto-raise);
  height: 100%;
}

.cell-bar-call {
  background: var(--gto-call);
  height: 100%;
}

.cell-bar-fold {
  background: var(--gto-fold);
  height: 100%;
}

.gto-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

/* Leak Detector Cards */
.leaks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.leak-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.leak-card.severity-high {
  border-left: 4px solid var(--accent-rose);
}

.leak-card.severity-medium {
  border-left: 4px solid var(--accent-amber);
}

.leak-meter-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leak-meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
}

.meter-track {
  height: 8px;
  background: var(--bg-base);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.meter-fill {
  height: 100%;
  border-radius: 99px;
}

/* Horizontal Bar Charts for Session Length & Days / Time */
.bar-chart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 110px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.bar-track {
  height: 12px;
  background: var(--bg-base);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.bar-fill-pos {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 4px;
}

.bar-fill-neg {
  height: 100%;
  background: linear-gradient(90deg, #be123c, #f43f5e);
  border-radius: 4px;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  background: rgba(15, 22, 36, 0.55);
  transition: border-color 0.15s, background 0.15s;
}

.upload-dropzone:hover {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.04);
}

/* Seat Coordinates on Visual Poker Table */
.seat-pos-utg { top: 14px; left: 22%; }
.seat-pos-hj  { top: 14px; right: 22%; }
.seat-pos-co  { top: 42%; right: 14px; transform: translateY(-50%); }
.seat-pos-btn { bottom: 14px; right: 22%; }
.seat-pos-sb  { bottom: 14px; left: 22%; }
.seat-pos-bb  { top: 42%; left: 14px; transform: translateY(-50%); }

/* SVG Mixed Strategy & Chart Bars (CSP-safe without inline styles) */
.cell-svg-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
}

.svg-bar-raise { fill: var(--gto-raise); }
.svg-bar-call  { fill: var(--gto-call); }
.svg-bar-fold  { fill: var(--gto-fold); }

.chart-svg-bar {
  width: 100%;
  height: 12px;
  display: block;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-base);
}

.svg-fill-pos   { fill: #10b981; }
.svg-fill-neg   { fill: #f43f5e; }
.svg-fill-amber { fill: #f59e0b; }
.svg-fill-sky   { fill: #38bdf8; }

.legend-dot-raise { background: var(--gto-raise); }
.legend-dot-call  { background: var(--gto-call); }
.legend-dot-fold  { background: var(--gto-fold); }

/* Google Sign-In Styles */
.btn-google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  font-weight: 600;
  padding: 11px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.btn-google:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.google-icon-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--accent-sky);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}


.user-provider-tag {
  font-size: 10px;
  color: var(--accent-amber);
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

@media (max-width: 1080px) {
  .gto-layout {
    grid-template-columns: 1fr;
  }
  .grid-2col, .grid-3col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .auth-container {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    display: none;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: relative;
  }
}

/* Empty states & leak verdicts (tabs filled from parsed hand histories) */
.empty-cell {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
}

.empty-block {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.leaks-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.leaks-empty h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.leak-verdict {
  font-size: 13px;
  font-weight: 600;
}

/* Clickable table rows (open the hand list for that row) */
.clickable-row {
  cursor: pointer;
}

.clickable-row:hover,
.clickable-row:focus {
  background: var(--bg-card-hover);
  outline: none;
}

/* Hand list dialog. margin: auto centres it (the global * reset removes the browser's default) */
.hand-list-dialog {
  width: min(1000px, 95vw);
  max-height: 85vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
}

.hand-list-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.hand-list-body {
  padding: 18px;
}

.hand-list-table-wrap {
  max-height: 65vh;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.hand-list-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-card);
}

.cards-cell {
  white-space: nowrap;
}

.cards-cell .second-run {
  margin-top: 4px;
  opacity: 0.85;
}

/* Playing cards: four-colour deck */
.playing-card {
  display: inline-block;
  min-width: 28px;
  margin-right: 3px;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: #ffffff;
}

.playing-card.suit-s {
  background: #374151;
  border: 1px solid #6b7280;
}

.playing-card.suit-h {
  background: #dc2626;
}

.playing-card.suit-d {
  background: #2563eb;
}

.playing-card.suit-c {
  background: #16a34a;
}

.playing-card.suit-x {
  background: var(--bg-elevated);
}

/* Sort buttons in the hand list header */
.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sort-btn {
  padding: 0 3px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.sort-btn:hover,
.sort-btn:focus-visible {
  color: var(--text-primary);
}

.sort-btn.active {
  color: var(--accent-sky);
}

/* Hand replayer */
.replay-dialog {
  width: min(940px, 96vw);
  max-height: 96vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
}

.replay-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.replay-body {
  padding: 18px;
}

.replay-table {
  position: relative;
  width: min(100%, calc((96vh - 230px) * 16 / 9)); /* short windows: shrink so the controls stay on screen */
  aspect-ratio: 16 / 9;
  margin: 8px auto 0;
}

.replay-felt {
  position: absolute;
  inset: 12% 10%;
  border: 10px solid #4a3220;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #1d7a4c 0%, #146240 55%, #0d4a2f 100%);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.55), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.replay-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.replay-pot {
  min-height: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #fde68a;
}

.replay-board {
  display: flex;
  gap: 4px;
  min-height: 56px;
}

.replay-table .playing-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 0;
  height: 46px;
  margin: 0;
  padding: 0;
  border-radius: 5px;
  font-size: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}

.replay-board .playing-card {
  width: 40px;
  height: 56px;
  font-size: 17px;
}

.replay-table .playing-card.card-back {
  border: 1px solid #93c5fd;
  background: repeating-linear-gradient(45deg, #1e3a8a 0 4px, #1d4ed8 4px 8px);
}

.replay-seat {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 124px;
  transform: translate(-50%, -50%);
}

.replay-seat-cards {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 3px;
  height: 46px;
  margin-bottom: -10px;
}

.replay-seat-info {
  width: 100%;
  padding: 12px 8px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(10, 15, 26, 0.95);
  text-align: center;
}

.replay-seat-name {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.replay-seat-stack {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #fbbf24;
}

.replay-seat.is-hero .replay-seat-info {
  border-color: var(--accent-sky);
}

.replay-seat.is-actor .replay-seat-info {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 2px var(--accent-amber);
}

.replay-seat.is-winner .replay-seat-info {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px var(--accent-emerald);
}

.replay-seat.is-folded {
  opacity: 0.45;
}

.replay-seat.is-sitting-out {
  opacity: 0.3;
}

.replay-bet {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.replay-verb {
  padding: 1px 7px;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
}

.replay-verb.verb-bet {
  background: #b45309;
  color: #ffffff;
}

.replay-verb.verb-call {
  background: #15803d;
  color: #ffffff;
}

.replay-verb.verb-check {
  background: #475569;
}

.replay-verb.verb-fold {
  background: #1f2937;
  color: #94a3b8;
}

.replay-verb.verb-allin {
  background: #e11d48;
  color: #ffffff;
}

.replay-verb.verb-win {
  background: var(--accent-emerald);
  color: #04130d;
}

.replay-amount {
  padding-right: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
}

.replay-dealer {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f8fafc;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}

.replay-caption {
  min-height: 22px;
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.replay-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.replay-controls .btn {
  padding: 8px 14px;
}

.replay-controls .btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.replay-step-counter {
  min-width: 64px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

@media (max-width: 640px) {
  .replay-table {
    aspect-ratio: 4 / 3;
  }

  .replay-seat {
    width: 80px;
  }

  .replay-table .playing-card {
    width: 22px;
    height: 30px;
    font-size: 10px;
  }

  .replay-board .playing-card {
    width: 26px;
    height: 36px;
    font-size: 12px;
  }

  .replay-seat-cards {
    height: 30px;
  }

  .replay-board {
    min-height: 36px;
  }
}
