:root {
  --bg: #14161a;
  --bg-panel: #1a1d24;
  --bg-card: #1f232c;
  --bg-card-hover: #252a34;
  --border: #2b303b;
  --text: #e9ebf1;
  --text-muted: #8b909c;
  --text-dim: #5c6270;

  --accent: #f2a73b;
  --accent-soft: rgba(242, 167, 59, 0.14);
  --positive: #38d787;
  --positive-soft: rgba(56, 215, 135, 0.14);
  --negative: #ff5c6c;
  --negative-soft: rgba(255, 92, 108, 0.14);

  --hard: #4c8dff;
  --clay: #d97a3d;
  --grass: #4caf6d;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 12px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f6;
  --border: #e1e4ea;
  --text: #1b1e25;
  --text-muted: #656b78;
  --text-dim: #9298a5;

  --accent: #b8720f;
  --accent-soft: rgba(184, 114, 15, 0.12);
  --positive: #1f9d5c;
  --positive-soft: rgba(31, 157, 92, 0.12);
  --negative: #d92d3c;
  --negative-soft: rgba(217, 45, 60, 0.12);

  --hard: #2f6fe0;
  --clay: #c1622d;
  --grass: #2f9153;

  color-scheme: light;
}

[data-theme="light"] .brand-mark {
  color: #241a06;
}

[data-theme="light"] .login-body {
  background: radial-gradient(circle at 50% 0%, #ffffff, var(--bg) 60%);
}

[data-theme="light"] .login-card,
[data-theme="light"] .card,
[data-theme="light"] .panel {
  box-shadow: 0 1px 2px rgba(20, 22, 30, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }

.muted { color: var(--text-muted); font-size: 0.9rem; }

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

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

.brand { display: flex; align-items: center; gap: 12px; }
.brand--center { justify-content: center; margin-bottom: 6px; }

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #c97f1f);
  color: #17140d;
  font-family: var(--font-display);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.brand-text strong { display: block; font-family: var(--font-display); letter-spacing: 0.06em; font-size: 1rem; }
.brand-text small { display: block; color: var(--text-muted); font-size: 0.65rem; letter-spacing: 0.12em; }

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

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.sidebar-footer { display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--bg-card); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600;
}
.user-name { font-size: 0.88rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

.main { padding: 32px 40px; max-width: 1400px; min-width: 0; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.topbar h1 { font-size: 1.6rem; }

.tour-toggle { display: flex; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.toggle-btn {
  border: none; background: transparent; color: var(--text-muted);
  padding: 8px 18px; border-radius: 7px; font-family: var(--font-mono); font-size: 0.8rem;
  cursor: pointer; letter-spacing: 0.05em;
}
.toggle-btn.is-active { background: var(--accent); color: #17140d; font-weight: 600; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
  background: transparent; border: none; color: var(--text-muted);
  padding: 10px 4px; margin-right: 22px; font-size: 0.92rem; cursor: pointer;
  border-bottom: 2px solid transparent; font-family: var(--font-body); font-weight: 500;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ---------- Filters ---------- */
.filters {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  background: var(--bg-panel); border: 1px solid var(--border);
  padding: 14px 18px; border-radius: var(--radius); margin-bottom: 22px;
}
.slider-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); min-width: 220px; }
.slider-field b { color: var(--text); font-family: var(--font-mono); }
.slider-field input[type=range] { accent-color: var(--accent); }

/* ---------- Cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius);
  padding: 18px;
  transition: background 0.15s, transform 0.15s;
}
.card:hover { background: var(--bg-card-hover); }
.card.surf-hard { border-left-color: var(--hard); }
.card.surf-clay { border-left-color: var(--clay); }
.card.surf-grass { border-left-color: var(--grass); }
.card-wide { max-width: 480px; }

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.surface-tag {
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); background: var(--bg-panel); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px;
}

.card h3 { font-size: 1.05rem; margin-bottom: 12px; }
.card h3 .vs { color: var(--text-dim); font-weight: 400; font-size: 0.85em; margin: 0 4px; }

.stat-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.stat-row b { color: var(--text); font-family: var(--font-mono); }

/* Signature element: split probability bar */
.prob-bar {
  height: 8px; border-radius: 5px; background: var(--negative-soft);
  overflow: hidden; margin-bottom: 6px;
}
.prob-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ffcf7a); }
.prob-labels { display: flex; justify-content: space-between; gap: 10px; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 14px; }
.prob-labels b { color: var(--text); font-family: var(--font-mono); flex: none; }
.pl { display: flex; gap: 5px; min-width: 0; max-width: 50%; }
.pl-right { justify-content: flex-end; }
.pl-name { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.metric { display: flex; flex-direction: column; gap: 3px; }
.metric span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.metric b { font-family: var(--font-mono); font-size: 0.92rem; }
.pair { display: inline-flex; gap: 5px; white-space: nowrap; align-items: baseline; }
.pair em { font-style: normal; color: var(--text-dim); }

.ev-pos { color: var(--positive); }
.ev-neg { color: var(--negative); }
.ev-zero { color: var(--text-muted); }

/* ---------- Quick filters (Favoritos / Top Values) ---------- */
.quick-filters { display: flex; gap: 8px; margin-bottom: 14px; }
.chip {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 16px; border-radius: 999px; font-size: 0.84rem; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }

.surface-filter { display: flex; align-items: center; gap: 12px; }
.surface-filter-label { font-size: 0.8rem; color: var(--text-muted); }
.chip-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
}
.chip-check input { accent-color: var(--accent); }

.empty-state { grid-column: 1/-1; padding: 40px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state.error { color: var(--negative); }

/* ---------- Manual calc ---------- */
.manual-form {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 22px;
}
.manual-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Forms / inputs ---------- */
input, select, button { font-family: var(--font-body); font-size: 0.9rem; }
button, a, input, select, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=text], input[type=password], input[type=date], input[type=number], select {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 8px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.btn-primary {
  background: var(--accent); color: #17140d; border: none;
  padding: 10px 18px; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }

.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 9px 14px; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-danger {
  background: transparent; border: 1px solid var(--negative); color: var(--negative);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.82rem;
}

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 16px; border: 1px solid transparent; }
.alert-ok { background: var(--positive-soft); color: var(--positive); border-color: rgba(56,215,135,0.3); }
.alert-error { background: var(--negative-soft); color: var(--negative); border-color: rgba(255,92,108,0.3); }
.alert-warn { background: var(--accent-soft); color: var(--accent); border-color: rgba(242,167,59,0.3); }

/* ---------- Admin panel ---------- */
.panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 16px; }

.inline-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }

.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th { text-align: left; color: var(--text-dim); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.badge { font-family: var(--font-mono); font-size: 0.72rem; padding: 3px 9px; border-radius: 20px; }
.badge-ok { background: var(--positive-soft); color: var(--positive); }
.badge-off { background: var(--negative-soft); color: var(--negative); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.row-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-form input, .row-form select { padding: 6px 8px; font-size: 0.78rem; }
.checkbox { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Login ---------- */
.login-body { padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(circle at 50% 0%, #1c2029, var(--bg) 60%); }
.login-scene { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.login-card {
  width: min(380px, 100%); background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 34px 30px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.login-tag { color: var(--text-muted); text-align: center; font-size: 0.85rem; margin: 14px 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.login-ticker {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.15em; color: var(--text-dim);
  max-width: 420px; text-align: center; opacity: 0.7;
}

/* ---------- Elementos exclusivos de celular (ocultos no desktop) ---------- */
.m-topbar, .bottom-nav, .filters-bar { display: none; }
.status-line { margin: -8px 0 14px; font-size: 0.82rem; }
.table-wrap { overflow-x: auto; }

/* ---------- Responsive ---------- */
/* Tablet: tabelas continuam tabelas, mas rolam dentro do próprio painel */
@media (max-width: 1100px) {
  .main { padding: 28px 24px; }
}

/* ===================== CELULAR ===================== */
@media (max-width: 860px) {
  body { overflow-x: hidden; }
  .app-shell { display: block; }
  .sidebar { display: none; }

  /* Barra superior */
  .m-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 40;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--bg-panel); border-bottom: 1px solid var(--border);
  }
  .m-topbar .brand { gap: 10px; min-width: 0; }
  .m-topbar .brand-mark { width: 32px; height: 32px; font-size: 1rem; flex: none; }
  .m-topbar .brand-text small { display: none; }
  .m-topbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .m-topbar-actions form { margin: 0; }
  .icon-btn {
    min-width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; padding: 0;
  }
  .icon-btn--text { padding: 0 14px; font-size: 0.85rem; color: var(--text-muted); }
  .m-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .m-user .user-avatar { width: 32px; height: 32px; flex: none; }
  .m-user-name { font-size: 0.85rem; font-weight: 600; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Navegação inferior (admin) */
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--bg-panel); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; text-decoration: none; color: var(--text-muted); font-size: 0.7rem; font-weight: 500;
  }
  .bn-item.is-active { color: var(--accent); }
  .bn-item.is-active svg { stroke-width: 2.2; }
  .bottom-nav ~ .main { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  .main { padding: 16px 16px 28px; max-width: none; }

  .topbar { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .topbar h1 { font-size: 1.35rem; }
  .topbar .muted { font-size: 0.82rem; margin: 4px 0 0; }
  .topbar--dash .muted { display: none; }
  .topbar form .btn-run { width: 100%; }

  .tour-toggle { width: 100%; }
  .toggle-btn { flex: 1; min-height: 44px; }

  /* Abas: controle segmentado em largura total */
  .tabs {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 4px; margin-bottom: 14px;
  }
  .tab {
    margin: 0; padding: 8px 4px; min-height: 44px; border-bottom: 0; border-radius: 8px;
    font-size: 0.8rem; line-height: 1.2; text-align: center;
  }
  .tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

  /* Atalhos rápidos: rolam na horizontal se não couberem */
  .quick-filters { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin: 0 -16px 12px; padding: 0 16px 2px; }
  .quick-filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 44px; padding: 0 16px; white-space: nowrap; }

  /* Filtros recolhíveis */
  .filters-bar { display: flex; gap: 8px; margin-bottom: 12px; }
  .filters-toggle {
    flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; border-radius: 10px; cursor: pointer;
    background: var(--bg-panel); border: 1px solid var(--border); color: var(--text); font-weight: 500;
  }
  .filters-toggle svg { transition: transform 0.2s; color: var(--text-muted); }
  .filters-toggle.is-open svg { transform: rotate(180deg); }
  .filters-toggle.is-open { border-color: var(--accent); }
  .btn-refresh { min-height: 44px; padding: 0 16px; white-space: nowrap; }
  .hide-m { display: none; }

  .filters { display: none; flex-direction: column; align-items: stretch; gap: 18px; padding: 16px; margin-bottom: 14px; }
  .filters.is-open { display: flex; }
  .slider-field { min-width: 0; width: 100%; font-size: 0.85rem; gap: 10px; }
  .slider-field input[type=range] { width: 100%; height: 32px; margin: 0; }
  .surface-filter { flex-wrap: wrap; gap: 8px; }
  .surface-filter-label { width: 100%; font-size: 0.85rem; }
  .chip-check {
    min-height: 44px; padding: 0 14px; font-size: 0.9rem;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card);
  }
  .chip-check input { width: 18px; height: 18px; }
  .status-line { margin: 0 0 12px; }

  /* Cartões de jogo */
  .cards-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  .card-wide { max-width: none; }
  .card h3 { font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
  .card-head .surface-tag { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card-head .muted { font-size: 0.8rem; white-space: nowrap; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 12px 10px; }
  .metric:last-child { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--border); }
  .metric:last-child b { font-size: 1.05rem; }
  .empty-state { padding: 28px 16px; }

  /* Formulários: campos grandes, sem zoom automático no iOS */
  input[type=text], input[type=password], input[type=date], input[type=number], select {
    width: 100%; min-height: 48px; font-size: 16px; padding: 10px 12px;
  }
  .btn-primary, .btn-ghost, .btn-danger { min-height: 48px; font-size: 0.95rem; }

  .manual-form { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .manual-form label { font-size: 0.85rem; }
  .btn-calc { width: 100%; }

  .panel { padding: 16px; margin-bottom: 16px; }
  .inline-form { flex-direction: column; align-items: stretch; gap: 14px; }
  .inline-form label { font-size: 0.85rem; }

  /* Tabelas viram cartões empilhados */
  .table-wrap { overflow: visible; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack thead { display: none; }
  .table.stack tr {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 12px;
  }
  .table.stack td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 7px 0; border: 0; text-align: right; font-size: 0.88rem; overflow-wrap: anywhere;
  }
  .table.stack td::before {
    content: attr(data-label); flex: none; text-align: left;
    color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  }
  .table.stack td.cell-title {
    display: block; text-align: left; font-size: 1rem; font-weight: 600;
    padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  }
  .table.stack td.cell-title::before { display: none; }
  .table.stack td.cell-msg { display: block; text-align: left; color: var(--text-muted); }
  .table.stack td.cell-msg::before { display: block; margin-bottom: 3px; }
  .table.stack td.actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; text-align: left; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
  .table.stack td.actions::before { display: none; }

  .row-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .row-form input[type=password], .row-form .btn-ghost { grid-column: 1 / -1; }
  .row-form input, .row-form select { font-size: 16px; padding: 10px 12px; }
  .row-form .checkbox { min-height: 48px; font-size: 0.9rem; }
  .row-form .checkbox input { width: 20px; height: 20px; }
  .actions .btn-danger { width: 100%; }

  .login-card { padding: 28px 22px; }
  .login-ticker { display: none; }
  .theme-toggle-floating { top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; }
}

/* Telas muito estreitas (iPhone SE e semelhantes) */
@media (max-width: 360px) {
  .m-user-name { display: none; }
  .tab { font-size: 0.74rem; }
  .metric-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Theme toggle ---------- */
.theme-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px; border-radius: 10px; background: var(--bg-card);
  font-size: 0.82rem; color: var(--text-muted); margin-bottom: 10px;
}
.theme-toggle-btn {
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.theme-toggle-btn:hover { border-color: var(--accent); }

.theme-toggle-floating {
  position: fixed; top: 18px; right: 18px;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.theme-toggle-floating:hover { border-color: var(--accent); }

/* Aviso de recomendação dentro do cartão do cálculo manual */
.card .alert { margin: 14px 0 0; }


/* ================= Painel Top Entradas e filtros por jogador ================= */
.lbl-short { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.field-label { font-size: 0.8rem; color: var(--text-muted); }
.field--odd { min-width: 150px; }
.filters input[type=number] { width: 100%; min-width: 0; }
.filters--grid { display: none; }
.hint { flex-basis: 100%; margin: 0; font-size: 0.78rem; color: var(--text-dim); line-height: 1.4; }
.hint b { color: var(--text-muted); font-weight: 600; }

.seg { display: inline-flex; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  padding: 7px 14px; border-radius: 7px; font-size: 0.82rem; font-weight: 500; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.stat-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat span { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 4px; }
.stat b { font-family: var(--font-mono); font-size: 1.3rem; }

.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; }
.pick {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--text-dim);
  border-radius: var(--radius); padding: 16px;
}
.pick.surf-hard { border-left-color: var(--hard); }
.pick.surf-clay { border-left-color: var(--clay); }
.pick.surf-grass { border-left-color: var(--grass); }
.pick-head { display: flex; align-items: center; gap: 10px; }
.rank {
  min-width: 36px; height: 30px; padding: 0 8px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); font-weight: 600; font-size: 0.85rem;
}
.pick-when { margin-left: auto; font-size: 0.8rem; white-space: nowrap; }
.pick-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.pick-vs { margin-top: 2px; font-size: 0.85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.metric-grid.pick-metrics { grid-template-columns: repeat(3, 1fr); }
.metric-grid.pick-metrics .metric:last-child { grid-column: auto; padding-top: 0; border-top: 0; }
.metric-grid.pick-metrics .metric:last-child b { font-size: 0.92rem; }
.metric-grid.pick-metrics .metric b { font-size: 1.05rem; }

.hit {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 0.85rem;
  background: var(--positive-soft); border: 1px solid rgba(56, 215, 135, 0.3);
}
.hit-tag { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--positive); font-weight: 600; }
.hit-name { overflow-wrap: anywhere; }
.hit-nums { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

.card-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.copy-btn {
  align-self: flex-start; cursor: pointer; min-height: 36px; padding: 0 14px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted); font-size: 0.82rem; font-weight: 500;
}
.copy-btn:hover { color: var(--text); border-color: var(--accent); }
.copy-btn.is-done { color: var(--positive); border-color: var(--positive); }

@media (max-width: 860px) {
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
  .tabs { grid-template-columns: repeat(4, 1fr); }
  .tab { font-size: 0.82rem; }

  .field--odd { min-width: 0; width: 100%; }
  .filters.filters--grid.is-open { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
  .filters--grid .field--wide, .filters--grid .surface-filter, .filters--grid .hint { grid-column: 1 / -1; }
  .seg { display: flex; width: 100%; }
  .seg-btn { flex: 1; min-height: 44px; padding: 0 6px; font-size: 0.82rem; white-space: normal; line-height: 1.2; }

  .stat { padding: 10px 12px; }
  .stat b { font-size: 1.1rem; }
  .picks { grid-template-columns: 1fr; gap: 12px; }
  .pick { padding: 14px; }
  .copy-btn { align-self: stretch; min-height: 44px; }
  .card-actions .copy-btn { width: 100%; }
}
@media (min-width: 861px) {
  .filters--grid { display: flex; }
  .filters--grid .field--wide { min-width: 0; }
}

/* ---------- Anti-estouro: nomes/eventos longos não podem alargar o card ---------- */
.cards-grid > *, .picks > * { min-width: 0; }
.card { min-width: 0; max-width: 100%; }
.card h3, .pick-name, .hit { overflow-wrap: anywhere; }
.card-head { gap: 8px; min-width: 0; }
.card-head .surface-tag { min-width: 0; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head .muted { flex: none; }
.hit { flex-wrap: wrap; min-width: 0; }
.metric { min-width: 0; }
.metric b { overflow-wrap: anywhere; }

/* ======================================================================
   Controle de resultados (aba Banca) + modal de registro
   ====================================================================== */
.card-actions { gap: 8px; flex-wrap: wrap; }
.reg-btn {
  cursor: pointer; min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent);
}
.reg-btn:hover { filter: brightness(1.1); }
.reg-btn.is-done { background: transparent; border-color: var(--border); color: var(--positive); cursor: default; }
.hit .reg-btn { margin-left: auto; min-height: 30px; padding: 0 10px; font-size: 0.76rem; }

.stat small { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-dim); }
.stat small.ev-pos { color: var(--positive); } .stat small.ev-neg { color: var(--negative); }
.stat-strip--4 { grid-template-columns: repeat(4, 1fr); }

.bets-actions { display: flex; justify-content: flex-end; margin: 0 0 14px; }
.btn-export { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 0.88rem; }

.bets-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; margin-bottom: 22px; }
.bets-list > * { min-width: 0; }
.bet {
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--text-dim);
  border-radius: var(--radius); padding: 14px 16px;
}
.bet.is-green { border-left-color: var(--positive); }
.bet.is-red { border-left-color: var(--negative); }
.bet.is-void { border-left-color: var(--text-muted); opacity: 0.85; }
.bet.is-pending { border-left-color: var(--accent); }
.bet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-width: 0; }
.bet-head .surface-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-when { margin-left: auto; font-size: 0.78rem; white-space: nowrap; }
.bet-del { flex: none; width: 30px; height: 30px; border-radius: 8px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; }
.bet-del:hover { color: var(--negative); border-color: var(--negative); }
.bet-main { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.bet-player { font-size: 1.05rem; overflow-wrap: anywhere; }
.bet-vs { font-size: 0.85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.bet-nums { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.bet-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bet-field > span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.bet-field input { width: 100%; min-width: 0; padding: 6px 8px; font-family: var(--font-mono); font-size: 0.92rem; }
.bet-field b { font-family: var(--font-mono); font-size: 0.98rem; padding-top: 5px; }
.bet-field small { font-family: var(--font-mono); font-size: 0.72rem; }

.res-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.res-btn {
  min-height: 38px; border-radius: 8px; border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.78rem; font-weight: 600; cursor: pointer; letter-spacing: 0.02em;
}
.res-btn:hover { color: var(--text); }
.res-btn.res-green.is-active { background: var(--positive-soft); border-color: var(--positive); color: var(--positive); }
.res-btn.res-red.is-active { background: var(--negative-soft); border-color: var(--negative); color: var(--negative); }
.res-btn.res-void.is-active { background: var(--bg-panel); border-color: var(--text-muted); color: var(--text); }
.res-btn.res-pending.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.bd-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.bd-block h4 { margin: 0 0 8px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.bd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--border); font-size: 0.86rem; }
.bd-row:first-of-type { border-top: 0; }
.bd-key { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-n { font-family: var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.bd-n small { color: var(--text-dim); }
.bd-profit { font-family: var(--font-mono); min-width: 64px; text-align: right; }
.bd-roi { font-family: var(--font-mono); min-width: 54px; text-align: right; font-size: 0.8rem; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 7, 10, 0.62); }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 380px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.modal-box h3 { margin: 0; font-size: 1.1rem; }
.modal-sub { margin: 0; font-size: 0.92rem; line-height: 1.4; overflow-wrap: anywhere; }
.modal-err { margin: 0; color: var(--negative); font-size: 0.84rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-actions button { min-height: 44px; padding: 0 18px; }
body.modal-open { overflow: hidden; }

@media (max-width: 860px) {
  .tabs { grid-template-columns: repeat(5, 1fr); }
  .tab { font-size: 0.74rem; padding: 8px 2px; }
  .stat-strip--4 { grid-template-columns: 1fr 1fr; }
  .bets-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bets-actions .btn-export { width: 100%; min-height: 46px; }
  .reg-btn { min-height: 44px; flex: 1; }
  .card-actions .copy-btn { flex: 1; width: auto; }
  .hit .reg-btn { flex: none; min-height: 36px; margin-left: 0; }
  .res-btn { min-height: 44px; }
  .bd-profit { min-width: 56px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
}

/* ======================================================================
   Alertas Telegram + exportar Top
   ====================================================================== */
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.top-actions > * { min-height: 42px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 0.88rem; cursor: pointer; }
.top-actions .btn-ghost[disabled] { opacity: 0.5; cursor: not-allowed; }

.section-title { margin: 22px 0 6px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.tg-hint { margin: 0 0 12px; font-size: 0.86rem; line-height: 1.45; }
.tg-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.tg-row { display: flex; gap: 12px; align-items: flex-start; }
.tg-row b { display: block; margin-bottom: 2px; }
.tg-row p { margin: 0; font-size: 0.86rem; line-height: 1.4; }
.tg-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--text-dim); }
.tg-dot.is-on { background: var(--positive); box-shadow: 0 0 0 4px var(--positive-soft); }
.tg-dot.is-warn { background: var(--accent); }
.tg-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tg-actions .btn-primary, .tg-actions .btn-ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 600; text-decoration: none; cursor: pointer; }
.tg-small { margin: 0; font-size: 0.8rem; }

.filters-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.filters-list > * { min-width: 0; }
.fl { background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--positive); border-radius: var(--radius); padding: 14px 16px; }
.fl.is-off { border-left-color: var(--text-dim); opacity: 0.7; }
.fl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fl-name { overflow-wrap: anywhere; font-size: 1rem; }
.fl-sum { margin: 6px 0 12px; font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; font-family: var(--font-mono); overflow-wrap: anywhere; }
.fl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fl-actions .btn-ghost { min-height: 38px; padding: 0 12px; font-size: 0.8rem; border-radius: 8px; cursor: pointer; }
.fl-actions .btn-ghost.danger:hover { color: var(--negative); border-color: var(--negative); }

.switch { position: relative; flex: none; width: 46px; height: 26px; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--border); transition: background 0.15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + span { background: var(--positive); }
.switch input:checked + span::after { transform: translateX(20px); }

.modal-box input[type=text] { width: 100%; }

@media (max-width: 860px) {
  /* 6 abas: faixa que rola na horizontal em vez de espremer */
  .tabs { display: flex; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; padding: 8px 14px; font-size: 0.82rem; white-space: nowrap; }
  .top-actions > * { flex: 1 1 100%; min-height: 46px; }
  .tg-actions .btn-primary, .tg-actions .btn-ghost { width: 100%; }
  .filters-list { grid-template-columns: minmax(0, 1fr); }
  .fl-actions .btn-ghost { flex: 1; min-height: 44px; }
}

/* ===== Histórico público ===== */
.pub-body { background: var(--bg); color: var(--text); min-height: 100vh; }
.pub-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--bg-panel); }
.pub-top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.pub-top-r { display: flex; align-items: center; gap: 10px; }
.pub-main { max-width: 980px; margin: 0 auto; padding: 22px 16px 60px; }
.pub-main h1 { margin: 0 0 6px; }
.pub-range { display: flex; gap: 6px; margin: 16px 0; }
.pub-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.pub-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pub-kpi span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.pub-kpi strong { font-family: var(--font-mono); font-size: 1.5rem; }
.pub-kpi small { color: var(--text-dim); font-size: 0.72rem; }
.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.pub-grid .panel, .pub-main .panel { margin-bottom: 14px; min-width: 0; }
.pub-curve svg { width: 100%; height: auto; display: block; }
.pub-curve text { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.pub-curve .grid { stroke: var(--border); stroke-width: 1; }
.pub-curve .zero { stroke: var(--text-dim); stroke-dasharray: 4 4; }
.pub-curve .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.pub-curve .line.up { stroke: var(--positive); }
.pub-curve .line.down { stroke: var(--negative); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.pub-notes ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--text-muted); font-size: 0.88rem; }

/* ===== Contexto do jogo (forma, descanso, linha) ===== */
.ctx-box { margin: 8px 0 4px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; font-size: 0.78rem; display: grid; gap: 3px; }
.ctx-box > div { display: flex; justify-content: space-between; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ctx-box span { color: var(--text-muted); }
.ctx-box b { font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
.ctx-warn { color: var(--accent); }

/* ===== Backtest e resultados dos picks ===== */
.bt-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: end; margin-bottom: 14px; }
.pr-list { display: grid; gap: 8px; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1.6fr) auto auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; background: var(--bg-card); }
.pr-row.pr-green { border-left-color: var(--positive); }
.pr-row.pr-red { border-left-color: var(--negative); }
.pr-main { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.pr-main small, .pr-res small { color: var(--text-dim); font-size: 0.72rem; }
.pr-nums { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.pr-res { display: grid; gap: 2px; justify-items: end; }
@media (max-width: 640px) { .pr-row { grid-template-columns: 1fr auto; } .pr-nums { grid-column: 1 / -1; white-space: normal; } }
.table-wrap.scroll-x { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

/* ===== Detalhes do jogo (janela) ===== */
.card.is-clickable, .pick.is-clickable { cursor: pointer; }
.card.is-clickable:hover, .pick.is-clickable:hover { border-color: var(--accent); }
.card.is-clickable:focus-visible, .pick.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-btn { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; }
.detail-btn:hover { background: var(--accent-soft); }
.md-box { max-width: 860px; max-height: 92vh; padding: 0; gap: 0; overflow: hidden; }
.md-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.md-top h3 { overflow-wrap: anywhere; }
.md-body { overflow-y: auto; padding: 14px 18px 22px; display: grid; gap: 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.md-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.md-sec h4 { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.md-sec h5 { margin: 0 0 6px; font-size: 0.9rem; overflow-wrap: anywhere; }
.md-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.md-table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.74rem; padding: 6px 8px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.md-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); overflow-wrap: anywhere; }
.md-table td:first-child { font-family: inherit; color: var(--text-muted); }
.md-table tr.is-surf td { background: var(--accent-soft); color: var(--text); }
.md-table tr.md-tot td { font-weight: 600; }
.md-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md-note { margin: 6px 0 0; font-size: 0.74rem; color: var(--text-dim); }
.md-bar { height: 10px; border-radius: 6px; background: var(--negative-soft); overflow: hidden; margin-bottom: 6px; }
.md-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #f5c978); }
.md-split { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; margin-bottom: 10px; }
.md-split span { min-width: 0; overflow-wrap: anywhere; }
.md-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.md-last { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.md-last li { display: grid; grid-template-columns: 22px 44px minmax(0, 1fr) auto; column-gap: 6px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.md-last li small { grid-column: 3 / -1; color: var(--text-dim); font-size: 0.7rem; overflow-wrap: anywhere; }
.md-last .md-d { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.78rem; }
.md-last .md-o { overflow-wrap: anywhere; }
.md-last .md-s { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); text-align: right; }
.md-h2h { font-size: 1.3rem; margin: 0; }
@media (max-width: 720px) {
  .modal--detail { align-items: flex-end; }
  .md-box { max-width: none; width: 100%; max-height: 94vh; height: 94vh; border-radius: 16px 16px 0 0; }
  .md-box .md-body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .md-cols { grid-template-columns: 1fr; }
}

/* ---------- Barra de pesquisa ---------- */
.gsearch { position: relative; margin: -6px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.gs-box { display: flex; align-items: center; gap: 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; color: var(--text-muted); }
.gs-box:focus-within { border-color: var(--accent); }
.gs-box input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--text); font: inherit; font-size: 0.95rem; padding: 11px 0; -webkit-appearance: none; appearance: none; }
.gs-box input::-webkit-search-cancel-button { display: none; }
.gs-clear { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; font-size: 0.9rem; min-width: 36px; min-height: 36px; }
.gs-menu { position: absolute; top: 46px; left: 0; right: 0; z-index: 30; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); overflow: hidden; }
.gs-item { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--border); color: var(--text); padding: 12px 14px; font: inherit; cursor: pointer; min-height: 44px; }
.gs-item:last-child { border-bottom: none; }
.gs-item:hover, .gs-item.is-active { background: rgba(255,255,255,.06); }
.gs-item small { font-family: var(--font-mono); color: var(--accent); }
.gs-count { font-size: 0.8rem; min-height: 1em; }
.gs-hide { display: none !important; }
.gs-game { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; flex-wrap: wrap; }
.gs-game:last-of-type { border-bottom: none; }
.gs-nums { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 0.85rem; flex-wrap: wrap; }
@media (min-width: 900px) { .gsearch { max-width: 520px; } }

.md-mk { margin: 6px 0 10px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; }
.md-mk summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 0.9rem; }
.md-mk[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.md-mk .md-table td:not(:first-child), .md-mk .md-table th:not(:first-child) { white-space: nowrap; }
.md-mk .md-table td:first-child { min-width: 120px; }
.md-mk .md-table th, .md-mk .md-table td { padding: 7px 8px; }

.mk-chip { padding: 0 10px; font-size: 13px; background: var(--accent-soft); }
.md-mk-top { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 12px; }
.md-mk-top h5 { margin: 0 0 6px; }
.md-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; font-size: 11px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.md-tag-warn { background: transparent; border: 1px solid var(--border); color: var(--muted, inherit); }
.md-mk-top td:not(:first-child), .md-mk-top th:not(:first-child) { white-space: nowrap; }
.md-mk-top .md-scroll { overflow-x: auto; }
.md-mk-top { min-width: 0; max-width: 100%; box-sizing: border-box; overflow: hidden; }
.md-mk-top .md-scroll { max-width: 100%; }
.md-body > .md-sec, .md-sec { min-width: 0; max-width: 100%; }
.md-tag { white-space: normal; }
.md-mk-top .md-table th, .md-mk-top .md-table td { padding-left: 5px; padding-right: 5px; }
.md-mk .md-table th, .md-mk .md-table td { padding-left: 5px; padding-right: 5px; }
@media (max-width: 520px) { .md-mk .md-table { font-size: 0.8rem; } }
@media (max-width: 520px) { .md-mk .md-table td small { display: none; } }
@media (max-width: 520px) { .md-mk .md-table th:nth-child(3), .md-mk .md-table td:nth-child(3) { display: none; } }
.mkr-new { margin-top: 14px; }
.mkr-new > summary { display: inline-block; cursor: pointer; list-style: none; }
.mkr-new .bt-form { margin-top: 12px; }
.mkr-picks { margin-top: 10px; }
.mkr-stats { line-height: 1.5; }
.fl:has(.mkr-picks:not([hidden])) { grid-column: 1 / -1; }
.mkr-picks td:first-child { white-space: nowrap; }

.mkr-edit { margin-top: 12px; }
.btn-xs { padding: 2px 8px; font-size: 12px; min-height: 0; }
.mkr-close { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
