:root {
    color-scheme: light;
    --ink: #202124;
    --muted: #687076;
    --line: #d8dee2;
    --paper: #fbfaf7;
    --panel: #ffffff;
    --accent: #245c73;
    --accent-strong: #163f50;
    --warm: #a45a2a;
    --green: #3d6b4f;
    --danger: #9f3030;
    --shadow: 0 14px 34px rgba(32, 33, 36, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px clamp(18px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    background: #fffdfa;
    position: sticky;
    top: 0;
    z-index: 5;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 3.6vw, 3.4rem);
    line-height: 1;
}

h2 {
    font-size: 1.45rem;
    margin-bottom: 14px;
}

h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.eyebrow,
.meta {
    color: var(--warm);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

nav a,
button,
.back-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 13px;
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
}

nav a.active,
button {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

button {
    cursor: pointer;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 56px;
}

.notice {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 6px;
    border: 1px solid;
    background: var(--panel);
}

.notice.success {
    color: var(--green);
    border-color: rgba(61, 107, 79, 0.35);
}

.notice.error {
    color: var(--danger);
    border-color: rgba(159, 48, 48, 0.35);
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stats div,
.panel,
.detail,
.work-card,
.route-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stats div {
    padding: 16px;
}

.stats strong {
    display: block;
    font-size: 1.7rem;
    line-height: 1;
}

.stats span,
.author,
.work-card p,
.route-item p,
label span {
    color: var(--muted);
}

.panel,
.detail {
    padding: clamp(16px, 3vw, 28px);
    margin-bottom: 18px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.work-card {
    padding: 18px;
    min-height: 224px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.work-card p {
    margin-bottom: 0;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.chips span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #edf4f2;
    color: #254b3a;
    font-size: 0.82rem;
    font-weight: 700;
}

.detail {
    border-left: 5px solid var(--accent);
}

.detail h2 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
    margin-bottom: 4px;
}

.hook {
    color: var(--accent-strong);
    font-weight: 800;
    font-size: 1.12rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.detail-grid ul {
    padding-left: 20px;
}

.detail-grid li + li {
    margin-top: 8px;
}

small {
    color: var(--muted);
    font-weight: 700;
}

.timeline {
    display: grid;
    gap: 12px;
}

.route-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.route-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.route-card > p {
    color: var(--muted);
}

.route-item {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    padding: 16px;
    box-shadow: none;
}

.timeline.compact .route-item {
    grid-template-columns: 38px 1fr;
    padding: 10px 0;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
}

.timeline.compact .route-item:first-child {
    border-top: 0;
}

.timeline.compact h4 {
    margin: 0 0 2px;
}

.step {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.timeline.compact .step {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
}

.action-bar,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.action-bar {
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f6f1e9;
}

.action-bar::before {
    content: "Acciones";
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    margin-right: 4px;
    text-transform: uppercase;
}

.edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.edit-form .wide {
    grid-column: 1 / -1;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    gap: 24px;
}

.help-box {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f6f1e9;
}

pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 12px;
    border-radius: 6px;
    background: #252525;
    color: #fff;
    font-size: 0.82rem;
}

code {
    background: #ece7df;
    padding: 2px 5px;
    border-radius: 4px;
}

@media (max-width: 980px) {
    .topbar,
    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats,
    .grid,
    .detail-grid,
    .split,
    .route-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .stats,
    .grid,
    .detail-grid,
    .split,
    .filters,
    .route-board,
    .edit-form {
        grid-template-columns: 1fr;
    }

    .topbar {
        position: static;
    }

    nav a,
    button {
        width: 100%;
    }
}

@media print {
    body {
        background: #fff;
        color: #111;
        font-size: 12pt;
    }

    .no-print,
    .topbar,
    .catalog,
    .filters,
    .action-bar,
    nav {
        display: none !important;
    }

    main {
        width: 100%;
        margin: 0;
    }

    .detail,
    .panel,
    .route-card {
        box-shadow: none;
        border: 0;
        padding: 0;
    }

    .detail {
        border-left: 0;
    }

    .detail h2 {
        font-size: 28pt;
    }

    .detail-grid,
    .route-board {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .chips span {
        border: 1px solid #bbb;
        background: #fff;
        color: #111;
    }

    a {
        color: #111;
        text-decoration: none;
    }
}
