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

:root {
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ===== Login ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 380px;
}

.login-box h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--primary);
  color: #fff;
  padding: 0 1.5rem;
  height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.navbar-links { display: flex; align-items: center; gap: 0.25rem; flex: 1; }

.navbar-links a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  font-size: 0.93rem;
  transition: background 0.12s, color 0.12s;
}

.navbar-links a:hover,
.navbar-links a.active { color: #fff; background: rgba(255, 255, 255, 0.13); }

/* Dropdown de navegação */
.nav-dropdown { position: relative; padding-bottom: 6px; }

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: rgba(255, 255, 255, 0.82);
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 0.93rem;
  transition: background 0.12s, color 0.12s;
}

.nav-dropdown:hover .nav-dropdown-toggle { color: #fff; background: rgba(255,255,255,0.13); }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  z-index: 200;
  padding-top: 6px;
  overflow: hidden;
}

.nav-dropdown:hover .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
  display: block;
  padding: 0.65rem 1.1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.93rem;
  transition: background 0.1s;
}

.nav-dropdown-menu a:hover { background: var(--bg); color: var(--primary); }

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.2);
  padding-left: 1.25rem;
  margin-left: auto;
  white-space: nowrap;
}

.navbar-user-name {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
}

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }

.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.15rem; }

.cards { display: flex; gap: 1.25rem; margin-top: 0.5rem; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  text-decoration: none;
  color: var(--text);
  min-width: 220px;
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}

.card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-hover);
  transform: translateY(-2px);
}

.card-icon { font-size: 1.6rem; margin-bottom: 0.6rem; }
.card h3 { color: var(--primary); margin-bottom: 0.3rem; font-size: 1rem; }
.card p { color: var(--muted); font-size: 0.88rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.form-check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }

.text-muted { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

.input-prefix { display: flex; align-items: center; }
.input-prefix span {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 0.6rem 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}
.input-prefix input {
  border-radius: 0 6px 6px 0 !important;
  flex: 1;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 520px;
  margin-top: 1rem;
}

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover { background: #b91c1c; }

.btn-block { width: 100%; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.btn-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-link:hover { color: #fff; text-decoration: underline; }

.inline-form { display: inline; }

/* ===== Table ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.table th, .table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #f8fafc;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.table tbody tr:hover { background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }

.table .empty { text-align: center; color: var(--muted); padding: 3rem; font-size: 0.95rem; }

.actions-col { width: 220px; }
.actions { display: flex; gap: 0.5rem; }

/* ===== Alias page ===== */
.alias-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.alias-tab {
  padding: 0.55rem 1.25rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -2px;
  border-radius: 4px 4px 0 0;
  transition: color 0.12s, border-color 0.12s;
}

.alias-tab:hover { color: var(--text); }
.alias-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.alias-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.alias-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem 1.1rem;
  margin-bottom: 1.25rem;
}

.alias-add-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.alias-add-field { display: flex; flex-direction: column; gap: 0.3rem; }
.alias-add-field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.alias-add-field select,
.alias-add-field input[type="text"] {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.93rem;
  min-width: 200px;
}
.alias-add-field--select { min-width: 260px; }
.alias-add-field--name { flex: 1; min-width: 220px; }
.alias-add-field--name input { width: 100%; }

/* Tom Select overrides */
.ts-wrapper { min-width: 260px; }
.ts-control {
  border-color: var(--border) !important;
  border-radius: 6px !important;
  font-size: 0.93rem !important;
  min-height: 36px !important;
  padding: 3px 8px !important;
  box-shadow: none !important;
}
.ts-wrapper.focus .ts-control {
  border-color: var(--primary-hover) !important;
  box-shadow: 0 0 0 2px rgba(29,78,216,0.1) !important;
}
.ts-dropdown { border-color: var(--border) !important; border-radius: 6px !important; font-size: 0.93rem !important; }
.ts-dropdown .option.selected, .ts-dropdown .option:hover { background: var(--bg) !important; color: var(--primary) !important; }
.alias-add-btn { align-self: flex-end; white-space: nowrap; }

.alias-table { margin-top: 0; }

.alias-edit-row { display: flex; gap: 0.4rem; align-items: center; }
.alias-input {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  flex: 1;
  min-width: 140px;
}
.alias-input:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 2px rgba(29,78,216,0.1);
}

.alias-inline-form { margin: 0; }

.alias-empty {
  color: var(--muted);
  font-size: 0.93rem;
  padding: 1.5rem 0;
}

.alias-search-wrap { margin-bottom: 0.75rem; }
.alias-search-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  width: 280px;
}

.btn-aliases {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
}
.btn-aliases:hover { background: #dbeafe; }

/* ===== Alerts / Badges ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert ul { margin-left: 1.25rem; }

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-muted   { background: #e2e8f0; color: #475569; }
.badge-live    { background: #fef9c3; color: #854d0e; }
.badge-ended   { background: #f1f5f9; color: #64748b; }
.badge-warn    { background: #ffedd5; color: #9a3412; }

/* ===== Matches page ===== */
.container-full {
  width: 100%;
  margin: 2rem 0;
  padding: 0 1.5rem;
}

.matches-filters {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}

.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group--search { flex: 1; min-width: 220px; }
.filter-group--search input { width: 100%; }
.filter-group label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 34px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.filter-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.filter-group input[type="date"],
.filter-group input[type="text"],
.filter-group select {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--surface);
}

.matches-count {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}

.matches-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.matches-table th,
.matches-table td { padding: 0.55rem 0.85rem; }

.team-cell { font-size: 0.92rem; }
.col-odds-count { text-align: center; width: 90px; }
.col-actions-sm { width: 90px; }

.btn-view-odds {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
  white-space: nowrap;
}
.btn-view-odds:hover { background: #dbeafe; }

.text-sm   { font-size: 0.82rem; }
.text-muted { color: var(--muted); }
.nowrap    { white-space: nowrap; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay[hidden] { display: none; }

body.modal-open { overflow: hidden; }

.modal-box {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: min(1500px, calc(100vw - 2rem));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title   { font-size: 1.1rem; font-weight: 700; }
.modal-subtitle { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.25rem;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); }

.modal-body {
  overflow: auto;
  padding: 1rem 1.5rem 1.5rem;
  flex: 1;
}

.modal-loading { color: var(--muted); text-align: center; padding: 2rem; }
.modal-error   { color: var(--danger); text-align: center; padding: 2rem; }

.modal-odds-table { margin: 0; }

.modal-odds-table th,
.modal-odds-table td { padding: 0.5rem 0.75rem; font-size: 0.88rem; white-space: nowrap; }

.modal-odds-table th { font-size: 0.75rem; }

.api-markets {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.api-markets h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.modal-api-markets-table { margin: 0; }

.modal-api-markets-table th,
.modal-api-markets-table td {
  padding: 0.5rem 0.75rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

.modal-api-markets-table th { font-size: 0.75rem; }

.api-market-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  min-width: 220px;
  white-space: normal;
}

.api-market-price {
  display: inline-flex;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.bm-name { font-weight: 600; min-width: 140px; }

.row-no-odds td { color: var(--muted); }
.no-odds-msg  { font-style: italic; }

.odd-super { color: #15803d; font-weight: 700; font-variant-numeric: tabular-nums; }

.badge-superodd {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* ===== Status dots ===== */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-green  { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.2); }
.dot-yellow { background: #ca8a04; box-shadow: 0 0 0 3px rgba(202,138,4,0.2); }
.dot-red    { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.2); }
.dot-gray   { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,0.2); }

/* Nav status link */
.nav-status-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  font-size: 0.93rem;
  transition: background 0.12s, color 0.12s;
}
.nav-status-link:hover { color: #fff; background: rgba(255,255,255,0.13); }
.nav-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

/* ===== Status page ===== */
.status-table-wrap { margin-bottom: 2rem; }

.status-table td {
  vertical-align: middle;
}

.status-bookmaker-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-bookmaker-name {
  font-weight: 600;
  white-space: nowrap;
}

.status-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.28rem 0.55rem;
}

.status-label.dot-green {
  background: #dcfce7;
  color: #166534;
}

.status-label.dot-yellow {
  background: #fef3c7;
  color: #92400e;
}

.status-label.dot-red {
  background: #fee2e2;
  color: #991b1b;
}

.status-label.dot-gray {
  background: #e2e8f0;
  color: #475569;
}

.btn-view-logs {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
  white-space: nowrap;
}

.btn-view-logs:hover { background: #dbeafe; }

.btn-view-logs:disabled {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.btn-resolve-log {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
  white-space: nowrap;
}

.btn-resolve-log:hover { background: #dcfce7; }

.status-modal-box {
  max-width: none;
  width: calc(100vw - 3rem);
}
.modal-table-wrap { margin-bottom: 0; }

#resolve-modal { z-index: 520; }

.resolve-modal-box {
  max-width: none;
  width: min(980px, calc(100vw - 3rem));
}

.resolve-log-summary {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.resolve-summary-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(150px, 0.8fr);
  gap: 0.85rem 1rem;
}

.resolve-summary-grid dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.resolve-summary-grid dd {
  font-size: 0.92rem;
  font-weight: 600;
}

.resolve-search-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.resolve-search-form input {
  flex: 1;
  min-width: 160px;
  padding: 0.52rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .resolve-summary-grid { grid-template-columns: 1fr; }
  .resolve-search-form { align-items: stretch; flex-direction: column; }
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-size: 1.1rem; font-weight: 700; }

.badge-count {
  display: inline-block;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: 99px;
}

.badge-bm {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* Generic table */
.table-wrap { overflow-x: auto; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); margin-bottom: 2rem; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th {
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }

.empty-state { color: var(--muted); font-size: 0.9rem; padding: 1.5rem 0; }
