/* Estilos del portal BRAVOSAND (login, registro y panel). Sin dependencias externas. */
:root {
    color-scheme: light;
    --bg: #f6f8fc; --surface: #ffffff; --surface-2: #f1f4f9; --text: #0f172a; --muted: #5b6577; --faint: #8a94a6;
    --line: #e2e8f0; --brand: #1d4ed8; --brand-strong: #1e3a8a; --brand-soft: #e0e9ff;
    --ok: #047857; --ok-soft: #e7f6ef; --err: #b91c1c; --err-soft: #fdecec; --warn: #b45309; --warn-soft: #fff4e5;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06); --radius: 12px;
}
:root[data-theme="dark"] {
        color-scheme: dark;
        --bg: #0a0f1c; --surface: #111827; --surface-2: #172033; --text: #e6ecf7; --muted: #9aa8c0; --faint: #74809a;
        --line: #1f2a3f; --brand: #6b9bff; --brand-strong: #a9c4ff; --brand-soft: #16233f;
        --ok: #4ade80; --ok-soft: #10261b; --err: #f87171; --err-soft: #2a1414; --warn: #fbbf24; --warn-soft: #2a2010;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
code { font: .85em ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

/* Marca */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .08em; color: var(--text); text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }

/* Páginas de acceso (login, registro, verificación) */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 16px; }
.auth .logo { margin-bottom: 26px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 30px 28px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-foot { margin-top: 18px; color: var(--muted); font-size: .92rem; text-align: center; }
.auth-foot p { margin: 4px 0; }

/* Formularios */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input[type=email], .field input[type=password], .field input[type=text] {
    width: 100%; padding: 11px 12px; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field .hint { color: var(--faint); font-size: .82rem; margin-top: 5px; }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; margin-bottom: 16px; }
.code-input { text-align: center; font: 600 1.6rem/1 ui-monospace, Menlo, Consolas, monospace !important; letter-spacing: .4em; }
.btn { display: inline-block; padding: 11px 20px; border-radius: 10px; font: 600 .95rem/1.2 inherit; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { filter: brightness(1.08); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { padding: 7px 12px; font-size: .85rem; }
[data-theme="dark"] .btn:not(.ghost) { color: #0a0f1c; }

/* Mensajes */
.alert { border-radius: 10px; padding: 11px 14px; margin-bottom: 18px; font-size: .92rem; border: 1px solid transparent; }
.alert.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert ul { margin: 0; padding-left: 18px; }

/* Panel */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 62px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .93rem; white-space: nowrap; }
.top nav a:hover { color: var(--text); background: var(--surface-2); }
.top nav a.active { color: var(--brand-strong); background: var(--brand-soft); font-weight: 600; }
.user { display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--muted); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
main.panel { padding: 32px 0 60px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.soon { background: var(--brand-soft); color: var(--brand-strong); }
dl.datos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.datos dt { color: var(--muted); }
dl.datos dd { margin: 0; word-break: break-all; }
.menu-cuenta { display: none; }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.menu-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-toggle .cerrar, .menu-toggle[aria-expanded="true"] .abrir { display: none; }
.menu-toggle[aria-expanded="true"] .cerrar { display: inline; }
@media (max-width: 720px) {
    .top .wrap { height: auto; min-height: 62px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
    .top .user { display: none; }
    .menu-toggle { display: inline-flex; margin-left: auto; }
    /* El menú se oculta y se despliega en columna, a todo el ancho, al tocar el botón. */
    .top nav#menu-principal { display: none; order: 3; flex: 0 0 100%; flex-direction: column; gap: 2px; padding: 6px 0 4px; border-top: 1px solid var(--line); }
    .top nav#menu-principal.abierto { display: flex; }
    .top nav#menu-principal a { padding: 12px; font-size: 1rem; }
    .menu-cuenta { display: flex; flex-direction: column; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
    .menu-cuenta .email { padding: 0 12px 4px; font-size: .85rem; color: var(--muted); word-break: break-all; }
    .top nav#menu-principal .menu-cuenta a { color: var(--err); font-weight: 600; }
}
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Empresas */
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head p { margin: 0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.lista { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.lista th, table.lista td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.lista th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
table.lista tr:last-child td { border-bottom: 0; }
table.lista td.nombre { white-space: normal; min-width: 200px; }
table.lista a.fila { color: var(--text); font-weight: 600; text-decoration: none; }
table.lista a.fila:hover { color: var(--brand); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.vacio { text-align: center; padding: 40px 20px; }
.field input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2); font: inherit; color: var(--text); }
.pasos { padding-left: 20px; color: var(--muted); }
.pasos li { margin-bottom: 6px; }
.peligro { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.btn.danger { background: var(--err); border-color: var(--err); }
.volver { display: inline-block; margin-bottom: 14px; font-size: .9rem; text-decoration: none; }

/* API keys */
.clave { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.clave code { flex: 1; min-width: 0; word-break: break-all; background: none; border: 0; padding: 0; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Planes y pagos */
.field input[type=date], .field select, .field textarea, .field input[type=number] {
    width: 100%; padding: 11px 12px; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.planes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.plan { position: relative; display: block; border: 1px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; background: var(--surface); }
.plan input { position: absolute; opacity: 0; }
.plan .precio { display: block; font-size: 1.5rem; font-weight: 800; margin: 4px 0 2px; }
.plan .detalle { color: var(--muted); font-size: .86rem; }
.plan:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.cuentas { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 4px; }
.cuenta-pago { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.cuenta-pago b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cuenta-pago .mono { font-size: 1rem; word-break: break-all; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.kpi b { display: block; font-size: 1.8rem; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: .88rem; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filtros a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: .88rem; background: var(--surface); }
.filtros a.active { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); font-weight: 600; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.acciones form { margin: 0; }
.voucher-img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
.top.admin { border-bottom: 3px solid var(--warn); }

/* Páginas legales */
.legal { max-width: 780px; }
.legal h2 { font-size: 1.15rem; margin: 30px 0 10px; }
.legal p, .legal li { line-height: 1.7; }
.legal ul, .legal ol { padding-left: 22px; margin: 0 0 14px; }
.legal li { margin-bottom: 6px; }
.legal .actualizado { margin-top: 36px; font-size: .9rem; }
.check a { font-weight: 600; }
.legal-links { margin-top: 22px; font-size: .85rem; color: var(--faint); }
.legal-links a, .pie a { color: var(--muted); }
.pie { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: .85rem; color: var(--faint); }
.nota { border-top: 1px solid var(--line); padding: 10px 0; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.pagination a { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: .88rem; background: var(--surface); }
.pagination .active a { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); font-weight: 600; }

/* Botón de modo oscuro / claro (app/Views/_tema_boton.php) */
.tema-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.tema-toggle:hover { border-color: var(--brand); color: var(--brand); }
.tema-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tema-toggle .tema-luna, [data-theme="light"] .tema-toggle .tema-sol { display: none; }
[data-theme="light"] .tema-toggle .tema-luna { display: inline; }
.auth { position: relative; }
.auth > .tema-toggle { position: absolute; top: 16px; right: 16px; }
@media (max-width: 720px) { .top .tema-toggle { margin-left: auto; } .menu-toggle { margin-left: 0; } }

/* Contacto (WhatsApp) */
.contacto-acciones { align-items: center; margin-top: 4px; }
.btn.whatsapp { display: inline-flex; align-items: center; gap: 8px; background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.whatsapp svg { width: 18px; height: 18px; fill: currentColor; }
[data-theme="dark"] .btn.whatsapp { color: #fff; }
