/* SURKUNA Marketing — sistema visual base. Todo el color sale de estas variables. */
:root {
    --brand: #0b6b5f;
    --brand-strong: #08544a;
    --brand-soft: #e3f3f0;
    --ink: #13203a;
    --ink-soft: #3d4a63;
    --muted: #66728a;
    --line: #e2e7ef;
    --line-strong: #cdd5e1;
    --surface: #ffffff;
    --canvas: #f4f6f9;
    --side: #0f1b2d;
    --side-ink: #c8d2e2;
    --side-active: #1c2c45;
    --ok: #127a4b;
    --ok-soft: #e4f5ec;
    --warn: #9a5b00;
    --warn-soft: #fff3dc;
    --bad: #b42318;
    --bad-soft: #fde9e7;
    --info: #1d4ed8;
    --info-soft: #e7eefe;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; color: var(--ink); }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, kbd { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; background: var(--canvas); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
h1:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura con navegación lateral ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; font-weight: 700; letter-spacing: .2px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand small { display: block; font-weight: 500; color: var(--side-ink); font-size: .75rem; letter-spacing: 0; }
.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7d8aa3; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.nav a:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav svg, .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-user { border-top: 1px solid #22314b; padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who strong { display: block; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: .78rem; color: #8f9bb3; }
.side-actions { display: flex; gap: 6px; padding: 0 16px 16px; }
.side-actions a, .side-actions button { flex: 1; text-align: center; font: inherit; font-size: .82rem; padding: 7px 8px; border-radius: 8px; border: 1px solid #2b3c59; background: transparent; color: var(--side-ink); cursor: pointer; }
.side-actions a:hover, .side-actions button:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.side-actions form { flex: 1; display: flex; }
.side-actions form button { width: 100%; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }

/* Menú móvil sin JavaScript: una casilla controla el panel lateral. */
.nav-toggle { display: none; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; z-index: 30; }
    .nav-toggle:checked ~ .side { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 27, 45, .45); }
    .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 20; }
    .topbar label { cursor: pointer; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid #2b3c59; }
    .content { padding: 20px 16px 40px; }
    /* Con letra menor a 16px, el iPhone amplía la pantalla al tocar un campo. */
    input, select, textarea { font-size: 16px !important; }
    .page-head .btn, .form-actions .btn { flex: 1 1 auto; }
}

/* ---------- Superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.stack > * + * { margin-top: 16px; }
.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: .8rem; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 16px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfd; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 30px; height: 30px; font-size: .75rem; }
.cell-user small { display: block; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: min(180px, 100%); }

/* ---------- Etiquetas ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--canvas); color: var(--ink-soft); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: 5px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
    width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 12px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11, 107, 95, .25); border-color: var(--brand); }
input[readonly] { background: var(--canvas); color: var(--ink-soft); }
.validation-message, .validation-errors { color: var(--bad); font-size: .84rem; margin-top: 5px; }
.validation-errors { padding-left: 18px; }
.invalid { border-color: var(--bad) !important; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.choice-list { display: grid; gap: 10px; }
.choice-grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
/* Más específico que ".field label" para que la tarjeta conserve su diseño en fila. */
.field label.choice, .choice { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; background: #fff; font-weight: 400; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice:has(input:disabled) { cursor: default; opacity: .7; }
.choice input { margin: 3px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.choice-text { display: block; min-width: 0; }
.choice-text strong { display: block; color: var(--ink); font-size: .95rem; margin-bottom: 2px; }
.choice-desc { display: block; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.choice-example { display: block; color: var(--ink); font-size: .82rem; line-height: 1.4; margin-top: 6px; font-style: italic; opacity: .8; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.code-input { font-size: 1.3rem !important; letter-spacing: .3em; text-align: center; max-width: 220px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: .92rem; padding: 9px 16px; min-height: 40px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--canvas); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f1b8b2; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-link { background: none; border: 0; color: var(--brand); padding: 0; min-height: 0; font-weight: 600; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .84rem; }
.btn-block { width: 100%; }

/* ---------- Mensajes ---------- */
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: .92rem; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: #0c5a37; }
.alert.bad { background: var(--bad-soft); color: #8f1c13; }
.alert.warn { background: var(--warn-soft); color: #6f4300; }
.alert.info { background: var(--info-soft); color: #1e3a8a; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: Consolas, monospace; font-size: .82rem; }

/* ---------- Pantallas de cuenta (sin sesión) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-hero { background: linear-gradient(155deg, #0f1b2d 0%, #12324a 55%, #0b6b5f 120%); color: #dbe5f3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .brand { padding: 0; }
.auth-hero h2 { color: #fff; font-size: 2rem; max-width: 460px; margin-bottom: 14px; }
.auth-hero ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; max-width: 460px; }
.auth-hero li { display: flex; gap: 10px; align-items: flex-start; }
.auth-hero li svg { color: #5fd3bf; margin-top: 2px; }
.auth-hero footer { font-size: .8rem; color: #8ea0bb; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.auth-links { margin-top: 18px; font-size: .9rem; display: grid; gap: 8px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 16px 0; }
.recovery-codes code { text-align: center; padding: 6px; font-size: .95rem; }
.qr { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.enroll { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.enroll ol { margin: 0; padding-left: 20px; flex: 1; min-width: min(240px, 100%); }
.enroll li { margin-bottom: 8px; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .auth-hero { padding: 24px 16px; }
    .auth-hero h2 { font-size: 1.35rem; }
    .auth-hero ul, .auth-hero footer { display: none; }
    .card-body { padding: 16px; }
}

.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
