/* ============================================================
   Manual de Asamblea — Sistema de diseño v2
   Identidad editorial: azul profundo + champagne + crema
   Tipografías: Fraunces (display) · Archivo (texto)
   ============================================================ */

:root {
    /* Color */
    --ink: #1a2845;
    --ink-deep: #0e1a36;
    --paper: #faf7f0;
    --surface: #ffffff;
    --gold: #b8935a;
    --gold-dark: #9c7a44;
    --gold-soft: #f5eee0;
    --navy-soft: #e8ecf6;
    --text: #263042;
    --text-soft: #46536b;
    --muted: #6e7a8e;
    --rule: #d7dce6;
    --rule-soft: #ecf0f6;

    --ok-bg: #eef6ee;       --ok-tx: #2e6b3f;   --ok-bd: #c4dec9;
    --warn-bg: #fdf6e8;     --warn-tx: #8e5a0e; --warn-bd: #ecd9ae;
    --bad-bg: #fbeeec;      --bad-tx: #a23527;  --bad-bd: #ecc6bf;
    --info-bg: #edf2fb;     --info-tx: #2d4f9e; --info-bd: #c6d4ef;

    /* Forma */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 22px;

    /* Tipografía */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Archivo', system-ui, -apple-system, sans-serif;

    --shadow-card: 0 1px 2px rgba(14, 26, 54, .05), 0 10px 30px -12px rgba(14, 26, 54, .12);
    --shadow-pop: 0 18px 50px -16px rgba(14, 26, 54, .28);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-height: 100%; }

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    background: var(--paper);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Textura de papel sutil */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% -4%, rgba(184, 147, 90, .09), transparent 32%),
        radial-gradient(circle at 100% 108%, rgba(26, 40, 69, .07), transparent 38%);
    z-index: -1;
}

::selection { background: var(--ink); color: var(--gold-soft); }

img { max-width: 100%; display: block; }
a { color: inherit; }

.app-shell { width: min(1100px, calc(100% - 36px)); margin: 0 auto; }
.shell-narrow { width: min(860px, calc(100% - 36px)); margin: 0 auto; }

/* ---------- Header ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 247, 240, .9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--rule);
}

.topbar::after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), transparent 55%);
    opacity: .55;
}

.topbar-inner {
    width: min(1100px, calc(100% - 36px));
    margin: 0 auto;
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; text-decoration: none; }

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--ink);
    color: var(--gold-soft);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
}

.brand-title {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(18px, 2.6vw, 23px);
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--ink);
    line-height: 1.05;
}

.brand-subtitle {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--gold-dark);
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: all .18s ease;
}

.icon-btn:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-1px); }
.icon-btn.exit:hover { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-tx); }

/* ---------- Encabezado de página ---------- */
main { padding: 38px 0 80px; }

.page-head { margin-bottom: 30px; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--gold-dark);
    margin-bottom: 14px;
}

.eyebrow::before { content: ''; width: 26px; height: 1.5px; background: var(--gold); }

.page-head h1 {
    font-family: var(--font-display);
    font-size: clamp(34px, 6vw, 50px);
    font-weight: 560;
    letter-spacing: -.015em;
    line-height: 1.04;
    color: var(--ink);
    margin-bottom: 12px;
}

.page-head h1 em { font-style: italic; font-weight: 430; color: var(--gold-dark); }

.page-head p {
    font-size: clamp(15px, 2vw, 17px);
    line-height: 1.6;
    color: var(--text-soft);
    max-width: 640px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 34px 0 16px;
}

.section-label::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-card);
    margin-bottom: 22px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.card-sub { font-size: 15px; color: var(--text-soft); margin-bottom: 20px; }

/* ---------- Botones ---------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    text-decoration: none;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
}

.btn-primary { background: var(--ink); color: var(--gold-soft); }
.btn-primary:hover { background: var(--ink-deep); transform: translateY(-1px); box-shadow: var(--shadow-pop); }

.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { border-color: var(--ink); transform: translateY(-1px); }

.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }

.btn-danger { background: var(--bad-bg); color: var(--bad-tx); border-color: var(--bad-bd); }
.btn-danger:hover { background: #f6ded9; transform: translateY(-1px); }

.btn-block { width: 100%; }

button:disabled { opacity: .65; cursor: not-allowed; }

/* ---------- Formularios ---------- */
label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--ink);
    margin-bottom: 8px;
}

label .req { color: var(--gold-dark); }

label .helper {
    display: block;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    margin-top: 3px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 15px 17px;
    font-size: 16px;
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

input, select { min-height: 56px; }

input::placeholder, textarea::placeholder { color: #9aa5b6; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236e7a8e' stroke-width='2.4'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 48px;
}

textarea { min-height: 240px; resize: vertical; line-height: 1.65; }

input:focus, select:focus, textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(184, 147, 90, .16);
}

.form-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 760px) {
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid .full { grid-column: 1 / -1; }
}

/* ---------- Alertas ---------- */
.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-radius: var(--radius-sm);
    padding: 15px 18px;
    font-size: 15px;
    margin-bottom: 18px;
    border: 1px solid;
}

.alert svg { flex-shrink: 0; margin-top: 1px; }
.alert.ok   { background: var(--ok-bg);   color: var(--ok-tx);   border-color: var(--ok-bd); }
.alert.bad  { background: var(--bad-bg);  color: var(--bad-tx);  border-color: var(--bad-bd); }
.alert.warn { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-bd); }
.alert.info { background: var(--info-bg); color: var(--info-tx); border-color: var(--info-bd); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid;
}

.badge .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }

.badge-ok    { background: var(--ok-bg);   color: var(--ok-tx);   border-color: var(--ok-bd); }
.badge-warn  { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-bd); }
.badge-info  { background: var(--info-bg); color: var(--info-tx); border-color: var(--info-bd); }
.badge-bad   { background: var(--bad-bg);  color: var(--bad-tx);  border-color: var(--bad-bd); }
.badge-muted { background: var(--rule-soft); color: var(--muted); border-color: var(--rule); }
.badge-gold  { background: var(--gold-soft); color: var(--gold-dark); border-color: #e4d4b4; }

/* ---------- Estadísticas ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), transparent 70%);
}

.stat-card strong {
    display: block;
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 560;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 7px;
}

.stat-card span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Progreso ---------- */
.progress-track {
    height: 9px;
    background: var(--rule-soft);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--ink));
    border-radius: 999px;
    transition: width .4s ease;
}

/* ---------- Listas de archivos ---------- */
.file-link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--rule-soft);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: all .15s ease;
}

.file-link:hover { border-color: var(--gold); background: var(--gold-soft); }
.file-link svg:first-child { color: var(--gold-dark); flex-shrink: 0; }

/* ---------- Estado vacío ---------- */
.empty {
    background: var(--surface);
    border: 1.5px dashed var(--rule);
    border-radius: var(--radius-lg);
    padding: 52px 28px;
    text-align: center;
    color: var(--text-soft);
}

.empty-icon {
    width: 66px;
    height: 66px;
    border-radius: 18px;
    background: var(--gold-soft);
    color: var(--gold-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.empty strong {
    display: block;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

/* ---------- Pie de documento ---------- */
.doc-footer {
    text-align: center;
    margin-top: 56px;
    padding: 36px 20px 0;
    color: var(--muted);
    font-size: 13px;
}

.doc-footer .mark {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--gold);
    margin-bottom: 10px;
}

/* ---------- Animación de entrada ---------- */
@media (prefers-reduced-motion: no-preference) {
    .rise { animation: rise .5s cubic-bezier(.2, .7, .3, 1) both; }
    .rise-1 { animation-delay: .05s; }
    .rise-2 { animation-delay: .12s; }
    .rise-3 { animation-delay: .19s; }

    @keyframes rise {
        from { opacity: 0; transform: translateY(14px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
    .app-shell, .shell-narrow, .topbar-inner { width: calc(100% - 28px); }
    .topbar-inner { min-height: 68px; }
    .brand-mark, .icon-btn { width: 42px; height: 42px; border-radius: 12px; }
    main { padding: 26px 0 60px; }
    .card { padding: 22px 18px; border-radius: var(--radius); }
    .btn, .btn-primary, .btn-secondary, .btn-gold, .btn-danger { width: 100%; }
    .stats { grid-template-columns: 1fr 1fr; }
}

@media print {
    .topbar, .topbar-actions, .doc-footer { display: none; }
    body { background: #fff; }
    body::before { display: none; }
}
