/* Bet-Carl styles - dark theme apostable */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

/* Login */
#login-screen {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
#login-screen.active { display: flex; }

.login-card {
    background: #161b22;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #30363d;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.login-card h1 { font-size: 32px; margin-bottom: 8px; color: #58a6ff; }
.login-card p { color: #8b949e; margin-bottom: 24px; }

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 14px;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: #238636;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover { background: #2ea043; }

.error {
    color: #f85149;
    margin-top: 12px;
    font-size: 14px;
}

/* Dashboard */
header {
    background: #161b22;
    padding: 16px 24px;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

header h1 { color: #58a6ff; }

nav { display: flex; gap: 8px; flex-wrap: wrap; }

nav button {
    padding: 8px 16px;
    background: transparent;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

nav button.active {
    background: #1f6feb;
    color: white;
    border-color: #1f6feb;
}

nav button#logout {
    background: #da3633;
    color: white;
    border-color: #da3633;
    margin-left: auto;
}

.tab { padding: 24px; display: none; }
.tab.active { display: block; }

h2 { margin-bottom: 16px; color: #58a6ff; font-size: 24px; }

/* Parlays grid */
.parlays-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.parlay-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
}

.parlay-card.status-ganado { border-color: #238636; background: linear-gradient(180deg, #161b22, #0f2818); }
.parlay-card.status-ganado_reducido { border-color: #56af44; background: linear-gradient(180deg, #161b22, #0f2818); }
.parlay-card.status-perdido { border-color: #da3633; background: linear-gradient(180deg, #161b22, #2c1010); }
.parlay-card.status-pendiente { border-color: #d29922; }
.parlay-card.status-pendiente_evaluar { border-color: #6e7681; border-style: dashed; opacity: 0.85; }
.parlay-card.status-registrado { border-color: #1f6feb; box-shadow: 0 0 12px rgba(31,111,235,0.2); }
.parlay-card.status-cashout { border-color: #6e40c9; }
.parlay-card.status-certificado {
    border-color: #f0883e;
    background: linear-gradient(180deg, #161b22, #1f1810);
    box-shadow: 0 0 14px rgba(240,136,62,0.15);
}

.status-tag-CERTIFICADO {
    background: linear-gradient(135deg, #f0883e, #d29922);
    color: #0d1117;
    font-weight: 700;
}

.badge-certificado {
    background: linear-gradient(135deg, #f0883e, #d29922);
    color: #0d1117;
    font-weight: 700;
}

.parlay-updated {
    margin-top: 8px;
    color: #6e7681;
    font-size: 11px;
    text-align: right;
}

.section-divider {
    margin-top: 32px;
    margin-bottom: 12px;
    color: #8b949e;
    font-size: 16px;
    font-weight: 500;
    border-top: 1px solid #30363d;
    padding-top: 16px;
}

.set-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-evaluar { background: #21262d; color: #8b949e; border: 1px dashed #6e7681; }
.badge-registrado { background: #1f6feb; color: white; }
.badge-resuelto { background: #238636; color: white; }

.parlay-justificacion {
    background: rgba(31,111,235,0.1);
    border-left: 3px solid #1f6feb;
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 13px;
    color: #c9d1d9;
    line-height: 1.5;
}

.parlay-notas {
    margin-top: 12px;
    padding: 8px;
    background: #0d1117;
    border-radius: 4px;
    color: #8b949e;
    font-size: 12px;
    font-style: italic;
}

.parlay-resultado {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(35,134,54,0.15);
    border-radius: 6px;
    color: #3fb950;
    font-size: 14px;
}

.parlay-card.status-perdido .parlay-resultado {
    background: rgba(218,54,51,0.15);
    color: #f85149;
}

.pick-item {
    padding: 10px 0;
    border-bottom: 1px solid #21262d;
}

.pick-item:last-child { border-bottom: none; }

.pick-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.pick-mercado { color: #c9d1d9; font-weight: 500; }

.pick-justificacion {
    margin-top: 6px;
    padding-left: 12px;
    color: #8b949e;
    font-size: 12px;
    line-height: 1.4;
    font-style: italic;
}

.pick-meta {
    margin-top: 4px;
    padding-left: 12px;
    font-size: 11px;
    color: #58a6ff;
}

/* Parlay card hover */
.parlay-card { transition: transform 0.15s, box-shadow 0.15s; }
.parlay-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }

.parlay-picks-summary {
    margin-top: 12px;
    padding: 8px 12px;
    background: #0d1117;
    border-radius: 6px;
    color: #58a6ff;
    font-size: 13px;
    text-align: center;
}

/* Modal detalle */
.modal-detail {
    max-width: 800px;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #30363d;
}

.modal-header h3 { color: #58a6ff; margin: 0; }

.modal-close {
    background: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover { background: #21262d; }

.modal-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: #0d1117;
    border-radius: 8px;
}

.detail-status, .detail-cuota, .detail-stake, .detail-retorno {
    text-align: center;
}

.big-number {
    font-size: 28px;
    font-weight: 700;
    color: #58a6ff;
}

.small-label {
    color: #8b949e;
    font-size: 12px;
    margin-top: 4px;
}

.modal-justificacion {
    background: rgba(31,111,235,0.1);
    border-left: 3px solid #1f6feb;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 6px;
}

.modal-justificacion strong {
    color: #58a6ff;
    display: block;
    margin-bottom: 6px;
}

.modal-justificacion p { color: #c9d1d9; margin: 0; line-height: 1.5; }

.modal-section-title {
    color: #58a6ff;
    margin: 20px 0 12px 0;
    font-size: 16px;
}

.picks-detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.picks-detail-table th,
.picks-detail-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #30363d;
    font-size: 14px;
}

.picks-detail-table th {
    background: #0d1117;
    color: #8b949e;
    font-size: 12px;
    text-transform: uppercase;
}

.picks-detail-table tfoot td {
    background: #1f6feb;
    color: white;
    font-weight: 600;
}

.cuota-cell { text-align: right; font-size: 16px; color: #58a6ff; }
.pendiente-tag {
    color: #d29922;
    font-style: italic;
    font-size: 13px;
}

.pick-detail-mercado {
    color: #8b949e;
    font-size: 12px;
    font-style: italic;
}

.pick-detail-block {
    display: flex;
    gap: 12px;
    background: #0d1117;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid #58a6ff;
}

.pick-detail-num {
    background: #1f6feb;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    height: fit-content;
    white-space: nowrap;
}

.pick-detail-content { flex: 1; }
.pick-detail-title { color: #c9d1d9; font-size: 14px; margin-bottom: 4px; }
.pick-detail-mercado-line { color: #c9d1d9; font-size: 13px; margin-bottom: 6px; }
.pick-detail-meta { color: #58a6ff; font-size: 12px; margin-bottom: 6px; }
.pick-detail-justif {
    color: #8b949e;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 6px;
    padding: 8px;
    background: rgba(110,118,129,0.1);
    border-radius: 4px;
}

.modal-notas {
    margin-top: 16px;
    padding: 12px;
    background: rgba(218,162,21,0.1);
    border-left: 3px solid #d29922;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 13px;
}

/* === Metodología checklist === */
.metodologia-block {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid;
}

.metodologia-block.mc-pass {
    background: rgba(35,134,54,0.12);
    border-color: #238636;
}

.metodologia-block.mc-fail {
    background: rgba(218,54,51,0.12);
    border-color: #da3633;
}

.metodologia-header {
    margin-bottom: 12px;
    font-size: 15px;
}

.metodologia-block.mc-pass .metodologia-header { color: #3fb950; }
.metodologia-block.mc-fail .metodologia-header { color: #f85149; }

.check-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: rgba(13,17,23,0.5);
    border-radius: 4px;
    font-size: 13px;
}

.check-row.check-pass { color: #c9d1d9; }
.check-row.check-fail { color: #ffa198; }
.check-row.check-pending { color: #d29922; }
.check-row.check-flex {
    color: #f0883e;
    background: rgba(240,136,62,0.12);
    border-left: 2px solid #f0883e;
}

.flex-badge {
    display: inline-block;
    margin-left: 12px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #f0883e, #d29922);
    color: #0d1117;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.check-icon { font-size: 14px; }
.check-label { flex: 1; }
.check-detail { color: #8b949e; font-size: 12px; }

/* VETO detail dentro pick */
.pick-detail-veto {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(13,17,23,0.6);
    border-left: 2px solid #6e40c9;
    border-radius: 4px;
    font-size: 12px;
    color: #c9d1d9;
}

.pick-detail-veto strong {
    color: #b884f6;
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.veto-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.veto-detail .check-row {
    padding: 3px 6px;
    background: transparent;
    font-size: 11px;
}

.parlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.parlay-codigo { font-weight: 600; font-size: 18px; color: #58a6ff; }

.parlay-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.parlay-status.GANADO { background: #238636; color: white; }
.parlay-status.PERDIDO { background: #da3633; color: white; }
.parlay-status.PENDIENTE { background: #d29922; color: black; }
.parlay-status.CASHOUT { background: #6e40c9; color: white; }

.parlay-cuota { font-size: 28px; font-weight: 700; color: #58a6ff; }
.parlay-prob { color: #8b949e; font-size: 14px; }

.parlay-picks {
    margin-top: 12px;
    border-top: 1px solid #30363d;
    padding-top: 12px;
}

.pick-item {
    padding: 8px 0;
    font-size: 13px;
    color: #c9d1d9;
}

.pick-cuota { color: #58a6ff; font-weight: 600; }

.btn-primary {
    padding: 12px 24px;
    background: #238636;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.btn-primary:hover { background: #2ea043; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.active { display: flex; }

.modal-content {
    background: #161b22;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
}

.modal-content textarea { min-height: 80px; resize: vertical; }

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.modal-actions button[type="submit"] { background: #238636; color: white; }
.modal-actions button[type="button"] { background: #30363d; color: #c9d1d9; }

/* Docs */
#docs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.doc-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.doc-card:hover { border-color: #58a6ff; }

.doc-card h3 { color: #58a6ff; font-size: 16px; margin-bottom: 8px; }
.doc-card p { color: #8b949e; font-size: 13px; }

#doc-content {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    margin-top: 16px;
    white-space: pre-wrap;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    display: none;
}

#doc-content.active { display: block; }

/* Stats cards */
#stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.stat-value { font-size: 36px; font-weight: 700; color: #58a6ff; }
.stat-value.positive { color: #3fb950; }
.stat-value.negative { color: #f85149; }
.stat-label { color: #8b949e; font-size: 13px; margin-top: 8px; }
.stats-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stats-table { width: 100%; border-collapse: collapse; background: #161b22; border-radius: 8px; overflow: hidden; margin-top: 12px; }
.stats-table th, .stats-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #30363d; }
.stats-table th { background: #0d1117; color: #8b949e; font-size: 12px; text-transform: uppercase; }
.stats-table td.positive { color: #3fb950; font-weight: 600; }
.stats-table td.negative { color: #f85149; font-weight: 600; }

/* Historial table */
#historial-table table {
    width: 100%;
    border-collapse: collapse;
    background: #161b22;
    border-radius: 8px;
    overflow: hidden;
}

#historial-table th,
#historial-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #30363d;
}

#historial-table th {
    background: #0d1117;
    color: #8b949e;
    font-size: 12px;
    text-transform: uppercase;
}

#historial-table tr:hover { background: #1c2128; }

.row-ganado { color: #3fb950; }
.row-perdido { color: #f85149; }
.row-pendiente { color: #d29922; }

@media (max-width: 768px) {
    nav { width: 100%; }
    .tab { padding: 16px; }
    .login-card { padding: 24px; }
}
