/* =====================================================================
   Cadmo Emprende — hoja de estilos (paleta verde)
   Tokens → base → layout → componentes → utilidades
   ===================================================================== */

:root {
    --c-ink: #10291f;
    --c-ink-2: #3a5048;
    --c-muted: #5d6f66;
    --c-line: #e1e8e4;
    --c-bg: #ffffff;
    --c-bg-soft: #f5f8f6;
    --c-bg-tint: #e9f4ee;

    --c-brand: #0f7a55;
    --c-brand-dark: #0b5f42;
    --c-brand-soft: #e3f3ea;
    --c-accent: #f2a541;

    --c-success: #3d7a1f;
    --c-success-soft: #eef6e4;
    --c-warning: #9a5b00;
    --c-warning-soft: #fff3dc;
    --c-danger: #b42318;
    --c-danger-soft: #fdecea;
    --c-info: #2c6b6b;
    --c-info-soft: #e5f0ef;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(16, 41, 31, .06), 0 4px 16px rgba(16, 41, 31, .06);
    --shadow-lg: 0 8px 32px rgba(16, 41, 31, .12);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: ui-serif, Georgia, "Times New Roman", serif;

    --container: 1160px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--c-ink);
    background: var(--c-bg);
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; color: var(--c-ink); }
h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 3.5vw, 2.6rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1:focus { outline: none; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 1.5rem 0; }
code { font-size: .9em; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }
.container.mid { max-width: 960px; }
.section { padding: 48px 0; }
.section.tight { padding: 28px 0; }
.section.soft { background: var(--c-bg-soft); }
.page { min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex: 1; }

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.sticky { position: sticky; top: 88px; }

@media (max-width: 900px) {
    .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: 1fr; }
    .sticky { position: static; }
}
@media (max-width: 620px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    .section { padding: 32px 0; }
}

/* ---------- Cabecera y pie ---------- */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--c-line);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: baseline; gap: 6px; font-weight: 700; color: var(--c-ink); font-size: 1.4rem; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 500; color: var(--c-muted); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--c-ink-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--c-bg-soft); color: var(--c-ink); text-decoration: none; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-menu form { margin: 0; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
    .site-header .container { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 12px; }
    .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
    .nav a { white-space: nowrap; }
    .user-menu { margin-left: auto; }
}
@media (max-width: 480px) {
    .site-header .container { gap: 8px 12px; }
    .brand { font-size: 1.2rem; }
    .user-menu { gap: 4px; }
    .user-menu .btn.sm { padding: 6px 8px; }
}

.site-footer { background: var(--c-ink); color: #c6d6cd; padding: 40px 0 28px; margin-top: 48px; font-size: .92rem; }
.site-footer a { color: #fff; }
.site-footer .grid { margin-bottom: 24px; }
.site-footer h4 { color: #fff; font-size: .95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.site-footer .fine { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 16px; color: #8fa59a; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, var(--c-bg-tint), #fff); padding: 72px 0 56px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); max-width: 15ch; }
.hero .lead { font-size: 1.2rem; color: var(--c-ink-2); max-width: 56ch; }
.hero .row { margin-top: 24px; }
.trust { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 32px; color: var(--c-ink-2); font-size: .95rem; }
.trust strong { display: block; font-size: 1.4rem; color: var(--c-ink); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--c-brand); margin-bottom: 8px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer;
    background: var(--c-brand); color: #fff; transition: background .15s, box-shadow .15s;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--c-brand-dark); text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--c-brand-soft); outline-offset: 1px; }
.btn[disabled], .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn.lg { padding: 14px 24px; font-size: 1.05rem; }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.secondary { background: #fff; color: var(--c-ink); border-color: var(--c-line); }
.btn.secondary:hover { background: var(--c-bg-soft); }
.btn.ghost { background: transparent; color: var(--c-brand); }
.btn.ghost:hover { background: var(--c-brand-soft); }
.btn.danger { background: #fff; color: var(--c-danger); border-color: #f3c5c0; }
.btn.danger:hover { background: var(--c-danger-soft); }
.btn.success { background: var(--c-success); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--c-brand); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--c-danger); }

/* ---------- Tarjetas ---------- */
.card {
    background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius-lg);
    padding: 24px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.soft { background: var(--c-bg-soft); box-shadow: none; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-link { display: block; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c2d7cb; }
.card .meta { color: var(--c-muted); font-size: .9rem; }

.form-card h3 { display: flex; justify-content: space-between; align-items: baseline; }
.form-card .price-from { color: var(--c-muted); font-size: .9rem; font-weight: 500; }
.form-card .price-from strong { color: var(--c-ink); font-size: 1.15rem; }

.stat { padding: 20px; }
.stat .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--c-muted); font-size: .9rem; }
.stat.attention .value { color: var(--c-warning); }

/* ---------- Paquetes ---------- */
.packages { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: stretch; }
.package { display: flex; flex-direction: column; position: relative; }
.package.featured { border: 2px solid var(--c-brand); }
.package .ribbon {
    position: absolute; top: -12px; left: 24px; background: var(--c-brand); color: #fff;
    font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em;
}
.package .price { font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin: 8px 0 2px; }
.package .price small { font-size: .9rem; font-weight: 500; color: var(--c-muted); }
.package .compare { text-decoration: line-through; color: var(--c-muted); margin-right: 6px; font-size: 1.1rem; }
.package .vat { color: var(--c-muted); font-size: .85rem; margin-bottom: 16px; }
.package ul { flex: 1; }
.package .btn { margin-top: 16px; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding-left: 28px; margin: 8px 0; }
.checklist li::before {
    content: ""; position: absolute; left: 0; top: .3em; width: 18px; height: 18px; border-radius: 50%;
    background: var(--c-success-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%233d7a1f'%3E%3Cpath d='M8.1 13.3 4.8 10l-1.1 1.1 4.4 4.4 8.6-8.6-1.1-1.1z'/%3E%3C/svg%3E") center/14px no-repeat;
}

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 24px 0; }
.fact { background: var(--c-bg-soft); border-radius: var(--radius); padding: 14px 16px; }
.fact .k { color: var(--c-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-weight: 600; }

.steps-how { counter-reset: how; }
.steps-how .card { position: relative; padding-top: 44px; }
.steps-how .card::before {
    counter-increment: how; content: counter(how);
    position: absolute; top: 16px; left: 24px; width: 28px; height: 28px; border-radius: 50%;
    background: var(--c-brand-soft); color: var(--c-brand); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: .92rem; }
.field .hint { color: var(--c-muted); font-size: .85rem; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cad7cf; border-radius: 8px;
    font: inherit; color: var(--c-ink); background: #fff; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 110px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-brand-soft);
}
.field input.invalid, .field select.invalid, .field textarea.invalid { border-color: var(--c-danger); }
.validation-message, .field-error { color: var(--c-danger); font-size: .85rem; }
.validation-errors { color: var(--c-danger); padding-left: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { margin-top: .3em; width: 18px; height: 18px; flex: none; accent-color: var(--c-brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.input-group { display: flex; gap: 8px; }
.input-group > :first-child { flex: 1; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: 8px; }

.option {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--c-line);
    border-radius: var(--radius); cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover { border-color: #c0d4c9; }
.option.selected { border-color: var(--c-brand); background: var(--c-brand-soft); }
.option input { margin-top: .3em; width: 18px; height: 18px; accent-color: var(--c-brand); flex: none; }
.option .body { flex: 1; }
.option .title { font-weight: 600; }
.option .desc { color: var(--c-ink-2); font-size: .9rem; }
.option .price { font-weight: 600; white-space: nowrap; }

/* ---------- Avisos ---------- */
.alert { border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert strong { display: block; }
.alert.error { background: var(--c-danger-soft); color: var(--c-danger); border-color: #f6cfca; }
.alert.success { background: var(--c-success-soft); color: var(--c-success); border-color: #cfe5b8; }
.alert.warning { background: var(--c-warning-soft); color: var(--c-warning); border-color: #f5dcab; }
.alert.info { background: var(--c-info-soft); color: var(--c-info); border-color: #c2dedb; }

/* ---------- Distintivos ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
    font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--c-bg-soft); color: var(--c-ink-2);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.success { background: var(--c-success-soft); color: var(--c-success); }
.badge.warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge.attention { background: #ffe9d6; color: #a0410d; }
.badge.info { background: var(--c-info-soft); color: var(--c-info); }
.badge.progress { background: var(--c-brand-soft); color: var(--c-brand); }
.badge.neutral { background: #eef1ef; color: var(--c-muted); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--c-bg-soft); font-size: .8rem; font-weight: 600; color: var(--c-ink-2); }

.progress-bar { height: 8px; background: var(--c-line); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--c-brand); border-radius: 999px; transition: width .3s; }

/* ---------- Asistente por pasos ---------- */
.stepper { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0 0 24px; overflow-x: auto; }
.stepper li { flex: 1; min-width: 110px; }
.stepper button {
    width: 100%; text-align: left; background: none; border: 0; border-top: 3px solid var(--c-line);
    padding: 10px 4px 4px; font: inherit; font-size: .85rem; color: var(--c-muted); cursor: pointer;
}
.stepper button .n { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.stepper li.done button { border-color: var(--c-success); color: var(--c-ink-2); }
.stepper li.current button { border-color: var(--c-brand); color: var(--c-ink); font-weight: 600; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--c-line); flex-wrap: wrap; }

.partner { border: 1px solid var(--c-line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; background: #fff; }
.partner header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; }
.partner header h4 { margin: 0; }
.totals { display: flex; gap: 16px; flex-wrap: wrap; font-size: .92rem; }
.totals .ok { color: var(--c-success); }
.totals .ko { color: var(--c-danger); }

/* ---------- Resumen y presupuesto ---------- */
.summary { width: 100%; border-collapse: collapse; }
.summary td { padding: 8px 0; vertical-align: top; }
.summary td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.summary tr.total td { border-top: 1px solid var(--c-line); font-weight: 700; font-size: 1.15rem; padding-top: 12px; }
.summary .sub { color: var(--c-muted); font-size: .85rem; }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.props dt { color: var(--c-muted); }
dl.props dd { margin: 0; font-weight: 500; }
@media (max-width: 620px) { dl.props { grid-template-columns: 1fr; gap: 2px; } dl.props dd { margin-bottom: 8px; } }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); background: var(--c-bg-soft); }
table.data th, table.data td { padding: 12px 14px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--c-bg-soft); }
table.data .num { text-align: right; white-space: nowrap; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--c-muted); font-size: .9rem; }

/* ---------- Historial ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -8px; width: 2px; background: var(--c-line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--c-brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c-brand); }
.timeline .when { color: var(--c-muted); font-size: .82rem; }
.timeline .what { font-weight: 600; }
.timeline .note { color: var(--c-ink-2); font-size: .93rem; white-space: pre-line; }
.timeline li.internal::after { background: var(--c-muted); box-shadow: 0 0 0 1px var(--c-muted); }

/* ---------- Documentos ---------- */
.doc-list { list-style: none; padding: 0; margin: 0 0 16px; }
.doc-list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--c-line); }
.doc-list li:last-child { border-bottom: 0; }
.doc-list .icon { width: 36px; height: 36px; border-radius: 8px; background: var(--c-bg-soft); display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--c-ink-2); flex: none; }
.doc-list .info { flex: 1; min-width: 0; }
.doc-list .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.doc-list .meta { color: var(--c-muted); font-size: .82rem; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-line); margin-bottom: 24px; overflow-x: auto; }
.tabs button, .tabs a {
    background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit;
    font-weight: 600; color: var(--c-muted); cursor: pointer; white-space: nowrap;
}
.tabs button.active, .tabs a.active { color: var(--c-ink); border-color: var(--c-brand); }
.tabs a:hover { text-decoration: none; color: var(--c-ink); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 460px; margin: 48px auto; padding: 0 20px; }
.auth-wrap .card { padding: 32px; }

/* ---------- Utilidades ---------- */
.muted { color: var(--c-muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Error de Blazor */
#blazor-error-ui {
    background: #fff8e1; bottom: 0; box-shadow: 0 -1px 4px rgba(0,0,0,.15); display: none;
    left: 0; padding: .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.d-block { display: block; }
.name-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.name-row .n { color: var(--c-muted); font-weight: 600; text-align: center; }
.name-check { grid-column: 2 / -1; font-size: .85rem; margin-top: -4px; }
.name-check.ok { color: var(--c-success); }
.name-check.ko { color: var(--c-warning); }
.review-section { padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.review-section:last-child { border-bottom: 0; }
.review-section h4 { display: flex; justify-content: space-between; margin-bottom: 6px; }
