:root {
    --ink: #1c1915;
    --muted: #5e584f;
    --line: #e4dccf;
    --paper: #f6f1e8;
    --card: #fffdf8;
    --navy: #142033;
    --navy-2: #1d3148;
    --copper: #a86432;
    --copper-2: #8a4e24;
    --good: #1f6b45;
    --bad: #8d2f2f;
    --warn: #8a5a12;
    --info: #1d4e89;
    --shadow: 0 16px 40px rgba(20, 32, 51, .06);
    --sans: "Source Sans 3", "Segoe UI", sans-serif;
    --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font: 16px/1.5 var(--sans);
}
a { color: var(--copper-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -.02em; margin: 0 0 .4rem; }
h1 { font-size: 2rem; }
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
    background: var(--navy);
    color: #efe7db;
    padding: 1.4rem 1rem 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { padding: 0 .5rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 1rem; }
.brand strong { display: block; font-family: var(--serif); font-size: 1.35rem; color: white; }
.brand span { color: #c9b8a2; font-size: .82rem; }
.side a {
    display: block;
    color: #efe7db;
    text-decoration: none;
    padding: .55rem .7rem;
    border-radius: 8px;
    margin-bottom: .15rem;
}
.side a.active, .side a:hover { background: var(--navy-2); color: white; }
.main { min-width: 0; }
.top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: .9rem 1.6rem;
    background: rgba(255,253,248,.9);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 2;
}
.who { color: var(--muted); font-size: .92rem; }
.content { padding: 1.5rem 1.7rem 3rem; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.2fr .8fr; }
.stat .k { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-family: var(--serif); font-size: 1.7rem; }
label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d9d0c3;
    background: white;
    border-radius: 8px;
    padding: .55rem .7rem;
    font: inherit;
    color: var(--ink);
}
textarea { min-height: 110px; }
.fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem 1rem; }
.fields .full { grid-column: 1 / -1; }
.row-actions, .inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
button, .btn {
    border: 0;
    background: var(--navy);
    color: white;
    border-radius: 999px;
    padding: .55rem 1rem;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
button.secondary, .btn.secondary { background: transparent; color: var(--navy); border: 1px solid #cfc4b4; }
button.copper, .btn.copper { background: var(--copper); }
button.warn, .btn.warn { background: var(--bad); }
.flash { background: #e7f4ec; border: 1px solid #b7dfc6; color: var(--good); padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.errors { background: #fdecec; border: 1px solid #f0c2c2; color: var(--bad); padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; background: #eee6da; }
.badge.nueva, .badge.abierta { background: #e5f0e4; color: var(--good); }
.badge.modificada, .badge.preparacion, .badge.aceptada { background: #f8efd8; color: var(--warn); }
.badge.eliminada, .badge.rechazada { background: #f8e4e4; color: var(--bad); }
.badge.requiere_revision, .badge.acuerdo_parcial { background: #e7eef8; color: var(--info); }
.badge.sin_modificacion, .badge.borrador, .badge.historico { background: #eeeae4; color: var(--muted); }
.badge.presentada, .badge.vigente, .badge.acordada, .badge.firmada, .badge.cerrada { background: #e5f0e4; color: var(--good); }
.muted { color: var(--muted); }
.timeline { border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline .node { position: relative; padding: 0 0 1rem 1.1rem; }
.timeline .node::before {
    content: "";
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--copper); position: absolute; left: -6px; top: .35rem;
}
.diff del { background: #f8d6d6; text-decoration: line-through; }
.diff ins { background: #d9f0df; text-decoration: none; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: .8rem; }
.help { font-size: .88rem; color: var(--muted); }
.check { display: flex; gap: .45rem; align-items: center; }
.check input { width: auto; }
.scale { overflow-x: auto; }
@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: relative; height: auto; }
    .grid-3, .grid-2, .fields { grid-template-columns: 1fr; }
}
@media print {
    .side, .top, .no-print { display: none !important; }
    .shell { display: block; }
    body { background: white; }
}
