/**
 * ============================================================================
 * DESIGN SYSTEM & APP STYLESHEET — TRIBUNAL DE CUENTAS DE LA PAMPA
 * Versión de Distribución Productiva Unificada y Completa
 * ============================================================================
 */

/* ── 1. TOKENS DE DISEÑO ─────────────────────────────────────────────────── */
:root {
    --tc-navy-900: #16294f;
    --tc-navy-800: #1f3b73;
    --tc-navy-700: #294c94;
    --tc-navy-600: #495678;
    --tc-navy-500: #576889;
    --tc-navy-400: #6f80a0;
    --tc-navy-300: #9aa7bf;
    --tc-navy-200: #c2cbda;
    --tc-navy-100: #e1e6ee;
    --tc-navy-50:  #f0f4fa;

    --tc-brand-900: #16294f;
    --tc-brand-800: #1f3b73;
    --tc-brand-700: #294c94;
    --tc-brand-600: #495678;
    --tc-brand-500: #576889;
    --tc-brand-400: #6f80a0;
    --tc-brand-300: #9aa7bf;
    --tc-brand-200: #c2cbda;
    --tc-brand-100: #e1e6ee;
    --tc-brand-50:  #f0f4fa;

    --tc-accent-900: #59421e;
    --tc-accent-800: #7d5e2d;
    --tc-accent-700: #977745;
    --tc-accent-600: #b08d57;
    --tc-accent-500: #c5a36e;
    --tc-accent-400: #d4b47d;
    --tc-accent-200: #ebd8b6;
    --tc-accent-100: #f5ecd9;
    --tc-accent-50:  #fbf8f3;

    --tc-canvas:        #f4f6fa;
    --tc-surface:       #ffffff;
    --tc-surface-alt:   #f8fafc;
    --tc-surface-hover: #f1f5f9;
    --tc-surface-glass: rgba(255, 255, 255, 0.88);
    --tc-border-glass:  rgba(255, 255, 255, 0.6);

    --tc-line-light:    #f1f5f9;
    --tc-line:          #dfe3ea;
    --tc-line-strong:   #cbd5e1;

    --tc-ink:           #1e2433;
    --tc-ink-soft:      #5b6472;
    --tc-ink-muted:     #64748b;
    --tc-ink-faint:     #94a3b8;

    --tc-ok:            #0d7d5d;
    --tc-ok-bg:         #eaf7f2;
    --tc-ok-border:     #b8e6d6;

    --tc-warn:          #8a6100;
    --tc-warn-bg:       #fdf6e3;
    --tc-warn-border:   #efd9a0;
    --tc-warn-br:       #efd9a0;

    --tc-error:         #b3261e;
    --tc-error-bg:      #fdeceb;
    --tc-error-border:  #f8c4c7;

    --tc-info:          #0369a1;
    --tc-info-bg:       #f0f9ff;
    --tc-info-border:   #bae6fd;

    --tc-shadow-xs:   0 1px 2px rgba(19, 28, 46, 0.04);
    --tc-shadow-sm:   0 2px 4px rgba(19, 28, 46, 0.04), 0 1px 2px rgba(19, 28, 46, 0.02);
    --tc-shadow-md:   0 4px 12px -2px rgba(19, 28, 46, 0.06), 0 2px 6px -1px rgba(19, 28, 46, 0.04);
    --tc-shadow-lg:   0 12px 28px -4px rgba(19, 28, 46, 0.08), 0 4px 12px -2px rgba(19, 28, 46, 0.03);
    --tc-shadow-card: 0 1px 3px rgba(19, 28, 46, 0.03), 0 10px 30px -4px rgba(19, 28, 46, 0.06);
    --tc-shadow-hover:0 14px 36px -6px rgba(31, 59, 115, 0.14), 0 4px 16px -2px rgba(19, 28, 46, 0.06);
    --tc-shadow-gold: 0 4px 16px 0 rgba(176, 141, 87, 0.22);

    --tc-focus:         0 0 0 3px rgba(73, 86, 120, 0.28);
    --tc-focus-accent:  0 0 0 3px rgba(176, 141, 87, 0.3);
    --tc-focus-error:   0 0 0 3px rgba(179, 38, 30, 0.18);

    --tc-radius-xs: 4px;
    --tc-radius-sm: 8px;
    --tc-radius:    10px;
    --tc-radius-lg: 16px;
    --tc-radius-full: 9999px;

    --tc-ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --tc-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --tc-ease-out:    cubic-bezier(0, 0, 0.2, 1);

    --tc-dur-fast:   140ms;
    --tc-dur-normal: 260ms;
    --tc-dur-slow:   420ms;

    --tc-font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --tc-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* ── 2. BASE & RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 32px 16px 64px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--tc-ink);
    background-color: var(--tc-canvas);
    font-family: var(--tc-font-sans);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--tc-line-strong); border-radius: var(--tc-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--tc-ink-faint); }

.tc-shell {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
}

/* ── 3. CARDS & HEADERS ──────────────────────────────────────────────────── */
.tc-card {
    position: relative;
    background: var(--tc-surface);
    border: 1px solid var(--tc-line);
    border-radius: var(--tc-radius);
    box-shadow: 0 1px 2px rgba(30, 36, 51, .04), 0 8px 24px rgba(30, 36, 51, .06);
    overflow: hidden;
    transition: box-shadow var(--tc-dur-normal) var(--tc-ease-smooth),
                border-color var(--tc-dur-normal) var(--tc-ease-smooth);
}
.tc-card:hover { box-shadow: var(--tc-shadow-hover); }

.tc-card__accent {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--tc-brand-800) 0%, var(--tc-brand-600) 50%, var(--tc-accent-600) 100%);
}

.tc-card__body { padding: 32px; }
@media (min-width: 768px) { .tc-card__body { padding: 44px 52px; } }

.tc-header { text-align: center; padding-bottom: 28px; border-bottom: 1px solid var(--tc-line); position: relative; }
.tc-header img { max-height: 96px; width: auto; object-fit: contain; }

.tc-header__titulo {
    margin: 22px 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .02em;
    color: var(--tc-brand-800);
    text-wrap: balance;
}
@media (min-width: 768px) { .tc-header__titulo { font-size: 1.32rem; } }

.tc-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 40px 0 6px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--tc-navy-100);
}
.tc-section::before {
    content: "";
    flex-shrink: 0;
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--tc-brand-700) 0%, var(--tc-accent-600) 100%);
}
.tc-section__txt { font-size: 1.02rem; font-weight: 700; color: var(--tc-brand-800); margin: 0; }
.tc-section-intro { font-size: 14px; color: var(--tc-ink-soft); margin: 14px 0 22px; }
.tc-pie { text-align: center; font-size: 12px; color: var(--tc-brand-400); margin-top: 22px; }

/* ── 4. STEPPER WIZARD ───────────────────────────────────────────────────── */
.tc-steps { display: flex; list-style: none; margin: 28px 0 0; padding: 0; counter-reset: paso; position: relative; }
.tc-steps__item { flex: 1; position: relative; text-align: center; padding-top: 32px; user-select: none; }
.tc-steps__item::before {
    content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px;
    background: var(--tc-navy-100); z-index: 1;
    transition: background-color var(--tc-dur-normal) var(--tc-ease-smooth);
}
.tc-steps__item:first-child::before { display: none; }
.tc-steps__item--hecho::before,
.tc-steps__item--actual::before { background: var(--tc-brand-600); }

.tc-steps__circle {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: var(--tc-surface); color: var(--tc-brand-300);
    border: 2px solid var(--tc-navy-100); z-index: 2;
    transition: all var(--tc-dur-normal) var(--tc-ease-spring);
}
.tc-steps__item--actual .tc-steps__circle {
    background: var(--tc-brand-600); color: #fff; border-color: var(--tc-brand-600);
    box-shadow: 0 0 0 3px rgba(73, 86, 120, 0.2); transform: translateX(-50%) scale(1.05);
}
.tc-steps__item--hecho .tc-steps__circle {
    background: var(--tc-brand-600); color: #fff; border-color: var(--tc-brand-600);
}

.tc-steps__label { font-size: 11.5px; font-weight: 600; color: var(--tc-brand-300); }
.tc-steps__item--actual .tc-steps__label { color: var(--tc-brand-700); }
.tc-steps__item--hecho  .tc-steps__label { color: var(--tc-brand-500); }
@media (max-width: 575px) { .tc-steps__label { display: none; } .tc-steps__item { padding-top: 26px; } }

/* ── 5. FORM CONTROLS ────────────────────────────────────────────────────── */
.tc-label { display: block; font-size: 13px; font-weight: 600; color: var(--tc-brand-800); margin-bottom: 6px; }
.tc-req { color: var(--tc-error); font-weight: 700; }
.tc-opcional { font-weight: 400; color: var(--tc-ink-soft); }
.tc-help { font-size: 12px; color: var(--tc-ink-soft); margin-top: 5px; line-height: 1.45; }
.tc-required-note { font-size: 12.5px; color: var(--tc-ink-soft); margin: 0 0 18px; }

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid var(--tc-navy-200);
    padding: .62rem .85rem;
    font-size: 15px;
    color: var(--tc-ink);
    background-color: #fff;
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: var(--tc-navy-300); }
.form-control:hover, .form-select:hover { border-color: var(--tc-navy-400); }
.form-control:focus, .form-select:focus {
    border-color: var(--tc-brand-600);
    box-shadow: var(--tc-focus);
    outline: none;
}
.form-control.is-invalid { border-color: var(--tc-error); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, .18); }
.form-control.is-valid   { border-color: var(--tc-ok); }
.form-control.is-valid:focus { box-shadow: 0 0 0 3px rgba(13, 125, 93, .18); }

/* ── 6. TARJETAS DE CARÁCTER (PUNTO 3) ────────────────────────────────────── */
.tc-opciones { display: grid; gap: 12px; grid-template-columns: 1fr; border: 0; padding: 0; margin: 0; }
@media (min-width: 768px) { .tc-opciones { grid-template-columns: 1fr 1fr; } }

.tc-opcion {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 16px; border: 2px solid var(--tc-navy-200); border-radius: 12px;
    background: #fff; cursor: pointer; user-select: none;
    transition: border-color .15s ease, background-color .15s ease, transform var(--tc-dur-fast) var(--tc-ease-spring);
}
.tc-opcion:hover { border-color: var(--tc-navy-400); transform: translateY(-1px); }
.tc-opcion:has(input:checked) { border-color: var(--tc-brand-600); background: var(--tc-navy-50); }
.tc-opcion:has(input:focus-visible) { box-shadow: var(--tc-focus); }
.tc-opcion input {
    appearance: none; -webkit-appearance: none;
    width: 19px; height: 19px; margin: 1px 0 0; flex-shrink: 0;
    border: 1.5px solid var(--tc-navy-400); border-radius: 4px; cursor: pointer;
    background-repeat: no-repeat; background-position: center; background-size: 12px;
    transition: all var(--tc-dur-fast) var(--tc-ease-spring);
}
.tc-opcion input:checked {
    background-color: var(--tc-brand-600); border-color: var(--tc-brand-600);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.tc-opcion__titulo { display: block; font-size: 14px; font-weight: 600; color: var(--tc-brand-800); line-height: 1.35; }
.tc-opcion__pie    { display: block; font-size: 12px; color: var(--tc-ink-soft); margin-top: 4px; }

/* ── 7. SECCIONES CONDICIONALES Y GRUPOS REPETIBLES ───────────────────────── */
.tc-bloque-cond { display: none; }
.tc-bloque-cond.visible { display: block; animation: tcAparecer .28s ease both; }
@keyframes tcAparecer { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.tc-grupo {
    position: relative; border: 1px solid var(--tc-navy-200); border-radius: 12px;
    padding: 20px; background: #fff; margin-bottom: 16px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.tc-grupo:hover { border-color: var(--tc-navy-400); box-shadow: var(--tc-shadow-xs); }
.tc-grupo > legend {
    float: none; width: auto; padding: 0 8px; margin: 0 0 4px -8px;
    font-size: 13px; font-weight: 700; color: var(--tc-navy-700);
}
.tc-quitar {
    position: absolute; top: 16px; right: 16px;
    background: none; border: 0; border-radius: 6px; padding: 4px 8px;
    font-size: 12px; font-weight: 600; color: var(--tc-ink-soft);
    transition: color .15s ease;
}
.tc-quitar:hover { color: var(--tc-error); }
.tc-quitar:focus-visible { outline: none; box-shadow: var(--tc-focus); }
.tc-quitar.oculto { display: none; }

/* ── 8. TOM SELECT (DESPLEGABLES BUSCABLES) ───────────────────────────────── */
.ts-wrapper { padding: 0 !important; }
.ts-wrapper.form-select.focus { border-color: var(--tc-brand-600) !important; }
.ts-wrapper.focus .ts-control { box-shadow: var(--tc-focus) !important; }
.ts-wrapper.disabled,
.ts-wrapper.disabled .ts-control { background-color: var(--tc-navy-50); opacity: 1; cursor: not-allowed; }

.ts-control {
    min-height: 44px;
    padding: .62rem .85rem !important;
    font-size: 15px;
    color: var(--tc-ink);
    background: transparent !important;
    border: 0 !important;
}
.ts-control input::placeholder { color: var(--tc-navy-300); }

.ts-dropdown {
    border: 1px solid var(--tc-navy-200);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(30, 36, 51, .12);
    margin-top: 4px;
    font-size: 14.5px;
    overflow: hidden;
}
.ts-dropdown .option { padding: 9px 14px; color: var(--tc-ink); }
.ts-dropdown .active { background: var(--tc-navy-50); color: var(--tc-brand-800); }
.ts-dropdown .selected,
.ts-dropdown .selected.active { background: var(--tc-brand-600); color: #fff; }
.ts-dropdown .no-results { padding: 12px 14px; color: var(--tc-ink-soft); font-style: italic; }

/* ── 9. BOTONES & ACCIONES ───────────────────────────────────────────────── */
.btn {
    border-radius: 8px; font-weight: 600; font-size: 15px;
    padding: .72rem 1.4rem; letter-spacing: 0;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform var(--tc-dur-fast) var(--tc-ease-spring);
}
.btn:focus-visible { box-shadow: var(--tc-focus); outline: none; }

.btn-tc { background: var(--tc-brand-600); border: 1px solid var(--tc-brand-600); color: #fff; }
.btn-tc:hover  { background: var(--tc-brand-700); border-color: var(--tc-brand-700); color: #fff; transform: translateY(-1px); }
.btn-tc:active { background: var(--tc-brand-800); border-color: var(--tc-brand-800); color: #fff; transform: translateY(1px); }
.btn-tc:disabled { background: var(--tc-navy-300); border-color: var(--tc-navy-300); opacity: 1; color: #fff; }

.btn-tc-secundario { background: #fff; border: 1px solid var(--tc-navy-200); color: var(--tc-navy-700); }
.btn-tc-secundario:hover { background: var(--tc-navy-50); border-color: var(--tc-navy-400); color: var(--tc-brand-800); }

.btn-tc-link {
    background: none; border: none; color: var(--tc-ink-soft);
    font-size: 13.5px; font-weight: 500; text-decoration: none; padding: .6rem;
}
.btn-tc-link:hover { color: var(--tc-brand-700); text-decoration: underline; }

/* ── 10. AVISOS & TOASTS ─────────────────────────────────────────────────── */
.tc-note {
    display: flex; gap: 12px; align-items: flex-start;
    border-radius: 8px; padding: 14px 16px; font-size: 13.5px; line-height: 1.55;
    margin-bottom: 20px;
}
.tc-note i { font-size: 17px; line-height: 1.4; flex-shrink: 0; }
.tc-note--info   { background: var(--tc-navy-50); border: 1px solid var(--tc-navy-100); color: var(--tc-brand-800); }
.tc-note--info i { color: var(--tc-brand-600); }
.tc-note--warn   { background: var(--tc-warn-bg); border: 1px solid var(--tc-warn-br); color: var(--tc-warn); }
.tc-note--warn i { color: #b98900; }
.tc-note--error  { background: var(--tc-error-bg); border: 1px solid #f3c2bf; color: var(--tc-error); font-weight: 500; }
.tc-note--error i{ color: var(--tc-error); }
.tc-note--ok     { background: var(--tc-ok-bg); border: 1px solid #bfe3d6; color: #0b5c47; }
.tc-note--ok i   { color: var(--tc-ok); }

.tc-tel-aviso {
    display: none; margin-top: 8px; padding: 8px 12px; border-radius: 8px;
    font-size: 12.5px; line-height: 1.45;
    background: var(--tc-warn-bg); border: 1px solid var(--tc-warn-br); color: var(--tc-warn);
}
.tc-tel-aviso.visible { display: block; }
.tc-tel-previo { margin-top: 6px; font-size: 12.5px; color: var(--tc-ok); font-weight: 600; }

/* ── 11. OTP ─────────────────────────────────────────────────────────────── */
.tc-otp { display: flex; gap: 10px; justify-content: center; margin: 24px 0 16px; }
.tc-otp__input {
    width: 52px; height: 62px;
    font-size: 24px; font-weight: 600; text-align: center;
    color: var(--tc-brand-800);
    border: 1.5px solid var(--tc-navy-200); border-radius: 10px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease, transform var(--tc-dur-fast) var(--tc-ease-spring);
}
.tc-otp__input:focus { border-color: var(--tc-brand-600); box-shadow: var(--tc-focus); outline: none; transform: scale(1.05); }
.tc-otp__input:not(:placeholder-shown) { border-color: var(--tc-navy-400); }
@media (max-width: 400px) { .tc-otp { gap: 6px; } .tc-otp__input { width: 44px; height: 54px; font-size: 20px; } }

/* ── 12. BLOQUE LEGAL & CHECKBOXES ───────────────────────────────────────── */
.tc-legal {
    border: 1px solid var(--tc-line); border-radius: var(--tc-radius);
    padding: 26px 28px; background: #fbfcfd;
    font-size: 13.5px; line-height: 1.7; color: var(--tc-ink);
}
.tc-legal p { text-align: justify; margin-bottom: 14px; }
.tc-legal__sub {
    font-size: 13px; font-weight: 700; letter-spacing: 0;
    color: var(--tc-brand-600); margin: 24px 0 8px;
}
.tc-legal hr { border-color: var(--tc-line); opacity: 1; margin: 22px 0; }

.tc-check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.tc-check input[type="checkbox"] {
    width: 19px; height: 19px; margin: 1px 0 0; flex-shrink: 0;
    appearance: none; -webkit-appearance: none;
    border: 1.5px solid var(--tc-navy-400); border-radius: 4px; cursor: pointer;
    background-repeat: no-repeat; background-position: center; background-size: 12px;
    transition: all var(--tc-dur-fast) var(--tc-ease-spring);
}
.tc-check input[type="checkbox"]:checked {
    background-color: var(--tc-brand-600); border-color: var(--tc-brand-600);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.tc-check input[type="checkbox"]:focus-visible { box-shadow: var(--tc-focus); outline: none; }
.tc-check label { font-size: 13.5px; line-height: 1.55; color: var(--tc-ink); cursor: pointer; }

/* ── 13. FINALIZACIÓN & CONSTANCIA ───────────────────────────────────────── */
.tc-final { text-align: center; padding: 32px 0 8px; }
.tc-final__icon {
    width: 76px; height: 76px; border-radius: 50%;
    background: var(--tc-ok-bg); color: var(--tc-ok);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 40px; margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(13, 125, 93, 0.15);
}
.tc-final h2 { font-size: 1.3rem; font-weight: 700; color: var(--tc-brand-800); margin-bottom: 10px; }

/* ── 14. IMPRESIÓN Y PREFERENCIAS ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@media print {
    body { background: #fff; padding: 0; }
    .tc-card { border: none; box-shadow: none; }
    .tc-steps, .btn, .tc-pie { display: none !important; }
}
