:root {
  --bg-base: #0f141e;
  --bg-surface: #151a27;
  --bg-card: #1e2434;
  --border: #2c364c;
  --green: #10b981;
  --green-dark: #059669;
  --blue: #3b82f6;
  --red: #ef4444;
  --orange: #f59e0b;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --font: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg-base); color: var(--text-main); font-size: 14px; overflow-x: hidden; }
.hidden { display: none !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.block { display: block; }
.font-bold { font-weight: 800; }

.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-blue { color: var(--blue) !important; }
.text-orange { color: var(--orange) !important; }
.text-white { color: #fff !important; }
.text-muted { color: var(--text-muted) !important; }
.uppercase { text-transform: uppercase; }
.center-text { text-align: center; }

/* LOGIN */
.login-screen { position: fixed; inset: 0; background: #0f141e; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-card { background: var(--bg-surface); padding: 2.5rem; border-radius: 12px; width: 90%; max-width: 400px; border: 1px solid var(--border); text-align: center; }
.logo-icon { font-size: 3rem; color: var(--green); margin-bottom: 1rem; }
.login-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.form-group { text-align: left; margin-bottom: 1.5rem; }
.form-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.form-input { width: 100%; padding: 0.8rem; background: var(--bg-base); border: 1px solid var(--border); border-radius: 8px; color: #fff; font-family: var(--font); outline: none; }
.form-input:focus { border-color: var(--green); }
.login-error { background: rgba(239,68,68,0.1); color: var(--red); padding: 0.8rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; font-size: 0.85rem; }

/* LAYOUT CORE */
.app-shell { display: flex; height: 100vh; position: relative; }
.sidebar { width: 260px; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-icon { width: 35px; height: 35px; background: var(--green); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #000; font-weight: bold; }
.sidebar-brand { display: block; font-weight: 800; font-size: 1rem; }
.sidebar-tagline { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-nav { padding: 1rem; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; border-radius: 8px; color: var(--text-muted); font-weight: 600; transition: 0.2s; cursor: pointer; margin-bottom: 0.2rem; }
.nav-item i { width: 20px; text-align: center; }
.nav-item:hover { background: var(--bg-card); color: var(--text-main); }
.nav-item.active { background: var(--green); color: #000; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.btn-logout { width: 100%; background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 0.8rem; border-radius: 8px; font-weight: 600; transition: 0.2s; cursor: pointer;}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--bg-base); padding: 0 1.5rem 1.5rem 1.5rem; width: 100%; }
.topbar { padding: 1.5rem 0; display: flex; justify-content: space-between; align-items: center; background: var(--bg-base); position: sticky; top:0; z-index: 10;}
.page-title { font-size: 1.2rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.stake-badge { background: var(--bg-card); border: 1px solid var(--border); padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; font-size: 0.85rem;}
.stake-badge strong { color: var(--blue); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.panel-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; }
.panel-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.panel-body { padding: 1.5rem; }

/* TOGGLE DASHBOARD LAB */
.dash-toggle-container { display: flex; background: var(--bg-surface); border-radius: 8px; border: 1px solid var(--border); overflow: hidden; max-width: 500px; margin: 0 auto;}
.dash-toggle { flex: 1; padding: 1rem; text-align: center; border: none; background: transparent; color: var(--text-muted); font-weight: 800; cursor: pointer; transition: 0.3s; font-family: var(--font); font-size: 0.9rem;}
.dash-toggle.active { background: var(--blue); color: #fff; }

/* KPI GRID DASHBOARD */
.kpi-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi-card { background: var(--bg-surface); border: 1px solid var(--border); padding: 1.2rem 1rem; border-radius: 12px; border-top: 3px solid var(--green); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.kpi-label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; font-weight: 700;}
.kpi-value { font-size: 1.5rem; font-weight: 800; }

.charts-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.chart-full { width: 100%; }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.chart-header h3 { font-size: 0.9rem; margin-bottom: 1rem; color: var(--text-muted); text-transform: uppercase;}
.chart-wrapper { height: 260px; width: 100%; }

/* BILHETE E ODDS UI */
.bil-row { display: flex; gap: 1rem; align-items: flex-end; }
.bil-col { flex: 1; display: flex; flex-direction: column; }
.bil-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.4rem; color: var(--text-muted); }
.bil-input { background: #0b0f1a; border: 1px solid var(--border); color: #fff; padding: 0.6rem 0.8rem; border-radius: 8px; font-size: 0.9rem; font-family: var(--font); outline: none; width: 100%; transition: 0.2s; }
.bil-input:focus { border-color: var(--green); }
.bil-input:disabled { opacity: 0.4; cursor: not-allowed; background: #1e2434; }
.bil-input.input-blue { border-color: rgba(59,130,246,0.4); color: #93c5fd; }
.bil-input.input-red { border-color: rgba(239,68,68,0.4); color: #fca5a5; }
.bil-vs { padding-bottom: 0.6rem; font-weight: 800; color: var(--border); font-size: 1rem; }

.bil-section-title { font-size: 0.8rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.green-title { color: var(--green); border-bottom-color: rgba(16,185,129,0.2); }

.odds-1x2-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem; align-items: center; width: 100%; max-width: 600px; margin: 0 auto;}
.odd-item { display: flex; flex-direction: column; align-items: center; width: 100%; }
.odd-item label { font-size: 0.75rem; font-weight: 800; margin-bottom: 0.5rem; text-align: center; }
.odd-big { font-size: 1.3rem !important; font-weight: 800; padding: 0.8rem !important; }

/* CHECKBOX INTELIGENTE */
.cb-container { margin-top: 0.5rem; font-size: 0.75rem; color: var(--green); cursor: pointer; display: flex; align-items: center; gap: 5px; font-weight: 700; background: rgba(16,185,129,0.1); padding: 0.4rem 0.8rem; border-radius: 4px; border: 1px solid rgba(16,185,129,0.3);}
.cb-container input { cursor: pointer; transform: scale(1.2); }
.cb-container input:disabled { cursor: not-allowed; }

.odds-card-title { font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 1rem; text-align: center; }
.odds-dh-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.odds-2col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.cenario-result { display: flex; align-items: center; justify-content: center; gap: 0.8rem; font-size: 0.9rem; color: var(--text-muted); background: var(--bg-base); padding: 1rem; border-radius: 8px; border: 1px dashed var(--border);}
.cenario-badge { background: rgba(245,158,11,0.1); border: 1px solid var(--orange); color: var(--orange); padding: 0.4rem 1rem; border-radius: 20px; font-weight: 700; white-space: nowrap;}

/* BOTOES E TABELAS */
.btn-primary { background: var(--green); color: #000; border: none; padding: 0.8rem 1.5rem; border-radius: 8px; font-weight: 800; letter-spacing: 0.5px; transition: 0.2s; font-size: 0.85rem; cursor: pointer;}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; background: var(--border) !important; color: #000 !important; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.75rem; }
.btn-action { background: transparent; border: none; font-size: 1.1rem; margin: 0 0.3rem; transition: 0.2s; cursor: pointer;}
.btn-action:hover { transform: scale(1.1); }

.sugestao-item { background: rgba(16,185,129,0.1); border: 1px solid var(--green); padding: 1rem; border-radius: 8px; margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center;}

.table-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;}
.table-card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th { background: var(--bg-card); padding: 0.8rem 1rem; text-align: left; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.data-table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle;}
.data-table tr:hover { background: rgba(255,255,255,0.03); }

/* MODALS */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 450px; padding: 1.5rem; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor:pointer; }

/* ==========================================
   MÓDULO DE RESPONSIVIDADE TOTAL (MOBILE UX)
   ========================================== */
.btn-mobile { background: transparent; border: none; color: var(--text-main); font-size: 1.5rem; cursor: pointer; }
.hidden-desktop { display: none; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 998; display: none; }
.sidebar-overlay.active { display: block; }

@media (max-width: 900px) {
    .hidden-desktop { display: inline-block !important; }
    
    /* SIDEBAR RETRÁTIL MAGNÉTICA */
    .sidebar { position: fixed; left: -280px; top: 0; bottom: 0; z-index: 999; height: 100%; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 4px 0 15px rgba(0,0,0,0.5); }
    .sidebar.open { transform: translateX(280px); }
    
    /* REORGANIZAÇÃO DE GRID PARA TELA VERTICAL */
    .main-content { padding: 0 1rem 1rem 1rem; width: 100vw; }
    .topbar { padding: 1rem 0; flex-direction: column; align-items: flex-start; gap: 1rem; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .page-title { font-size: 1.1rem; }

    .kpi-row-4 { grid-template-columns: 1fr 1fr; gap: 0.8rem; }
    .charts-2col { grid-template-columns: 1fr; }
    
    .bil-row { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .bil-col { width: 100%; }
    .bil-vs { text-align: center; padding: 0.5rem 0; }
    
    .odds-1x2-grid { grid-template-columns: 1fr; gap: 1rem; }
    .odds-dh-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .odds-2col-grid { grid-template-columns: 1fr; gap: 1rem; }
    
    .dash-toggle-container { flex-direction: column; border-radius: 8px; }
    .dash-toggle { border-bottom: 1px solid var(--border); }
    .dash-toggle:last-child { border-bottom: none; }
}