:root {
    --ink: #161b24;
    --steel: #4f5768;
    --steel-light: #737b8c;
    --gold: #cba654;
    --gold-light: #dfc27d;
    --paper: #f4f5f7;
    --white: #fff;
    --danger: #b44040;
    --shadow: 0 24px 70px rgba(8, 12, 19, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
}
button, input { font: inherit; }

.login-page {
    min-height: 100vh;
    background: #e8ebef;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.04fr .96fr;
}
.brand-panel {
    position: relative;
    overflow: hidden;
    padding: 64px clamp(38px, 7vw, 110px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    color: var(--white);
    isolation: isolate;
    background:
        radial-gradient(circle at 15% 14%, rgba(151,161,179,.48), transparent 31%),
        linear-gradient(145deg, #606a7b 0%, #46505f 39%, #252d39 100%);
}
.brand-panel::after {
    content: "";
    position: absolute;
    right: 0;
    top: 10%;
    width: 1px;
    height: 80%;
    background: linear-gradient(transparent, var(--gold), transparent);
}
.brand-glow {
    position: absolute;
    width: 480px;
    height: 480px;
    left: -220px;
    bottom: -220px;
    border: 1px solid rgba(203,166,84,.28);
    border-radius: 50%;
    box-shadow: 0 0 90px rgba(203,166,84,.12);
    z-index: -1;
}
.intelligence-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    opacity: .78;
}
.network-vignette {
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(28,34,44,.06), rgba(28,34,44,.28)),
        linear-gradient(180deg, transparent 55%, rgba(25,31,40,.32));
}
.brand-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    z-index: 2;
}
.login-logo {
    display: block;
    width: min(350px, 72%);
    height: auto;
    position: relative;
}
.brand-copy {
    position: relative;
    align-self: center;
    max-width: 620px;
    padding: 40px 0;
    z-index: 2;
}
.eyebrow {
    color: var(--gold);
    font-size: .74rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    font-weight: 800;
}
.brand-copy h1 {
    margin: 15px 0;
    font-size: clamp(3rem, 6vw, 6rem);
    line-height: .92;
    font-weight: 300;
}
.brand-copy h1 strong { color: var(--gold-light); font-weight: 700; }
.brand-copy p { font-size: 1.12rem; color: #d6dae2; }
.security-note {
    position: relative;
    align-self: end;
    color: #c5cad3;
    font-size: .82rem;
    letter-spacing: .08em;
    z-index: 2;
}
.form-panel {
    display: grid;
    place-items: center;
    padding: clamp(26px, 5vw, 64px);
    background:
        radial-gradient(circle at 70% 22%, rgba(255,255,255,.92), transparent 30%),
        linear-gradient(145deg, #f0f2f4, #dfe3e8);
}
.login-card {
    width: min(440px, 100%);
    padding: 48px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(255,255,255,.86);
    border-top: 3px solid var(--gold);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(31,39,50,.18);
    backdrop-filter: blur(16px);
}
.login-card h2 { margin: 11px 0 7px; font-size: 2.15rem; letter-spacing: -.025em; }
.muted, .privacy { color: #6a7180; }
.login-card label { display: block; margin: 22px 0 8px; font-size: .82rem; font-weight: 700; }
.login-card input {
    width: 100%;
    border: 1px solid #cfd4dc;
    border-radius: 9px;
    padding: 15px 16px;
    outline: none;
    background: #f8f9fa;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.login-card input:hover { background: #fff; border-color: #b9c0ca; }
.login-card input:focus { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 4px rgba(203,166,84,.13); }
.password-field { display: flex; border: 1px solid #cfd4dc; border-radius: 9px; background: #f8f9fa; overflow: hidden; }
.password-field input { border: 0; }
.password-field:focus-within { border-color: var(--gold); background: #fff; box-shadow: 0 0 0 4px rgba(203,166,84,.13); }
.password-field:focus-within input { box-shadow: none; }
.password-field button { border: 0; background: transparent; color: #715d2f; font-weight: 700; padding: 0 16px; cursor: pointer; }
.primary-button {
    width: 100%;
    margin-top: 28px;
    padding: 15px 20px;
    border: 0;
    background: linear-gradient(135deg, #b88e38, var(--gold));
    color: var(--white);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(184,142,56,.25);
}
.primary-button.compact { width: auto; margin: 0; padding: 13px 20px; }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 9px;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.login-submit span:last-child { font-size: 1.15rem; transition: transform .2s ease; }
.login-submit:hover span:last-child { transform: translateX(4px); }
.privacy { margin: 18px 0 0; font-size: .72rem; line-height: 1.55; }
.alert { margin-top: 18px; padding: 12px; background: #fff1f1; color: #8c2f2f; border-left: 3px solid var(--danger); font-size: .85rem; }
.setup-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px; }

.app-page { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    padding: 28px 22px;
    background: linear-gradient(180deg, #252c38, #141922);
    display: flex;
    flex-direction: column;
}
.sidebar-logo { width: 210px; margin-bottom: 38px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar a { color: #cfd3db; text-decoration: none; padding: 12px 14px; border-left: 2px solid transparent; }
.sidebar a:hover, .sidebar a.active { color: white; background: rgba(255,255,255,.05); border-left-color: var(--gold); }
.sidebar .logout { margin-top: auto; color: var(--gold-light); }
.content { grid-column: 2; padding: 38px 44px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.topbar h1 { margin: 7px 0 0; font-size: 2rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .secondary-button { text-decoration: none; }
.user-chip { display: grid; text-align: right; }
.user-chip span { color: #737987; font-size: .8rem; margin-top: 4px; }
.welcome-card {
    margin-top: 34px;
    padding: 36px;
    color: white;
    background: linear-gradient(120deg, #252c38, #4e5768);
    border-bottom: 4px solid var(--gold);
    box-shadow: var(--shadow);
}
.welcome-card h2 { margin: 10px 0; font-size: 1.8rem; }
.welcome-card p { margin: 0; color: #d9dde4; }
.kpi-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.kpi-grid article { background: white; padding: 24px; border-top: 3px solid var(--gold); box-shadow: 0 10px 30px rgba(15,20,29,.07); }
.kpi-grid span { display: block; color: #737987; font-size: .82rem; }
.kpi-grid strong { display: block; margin-top: 12px; font-size: 2rem; }
.clients-kpis { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.success-message {
    margin-top: 24px;
    padding: 14px 16px;
    color: #236440;
    background: #ecf8f1;
    border-left: 3px solid #3f9b67;
}
.data-panel {
    margin-top: 24px;
    padding: 24px;
    background: white;
    box-shadow: 0 12px 35px rgba(15,20,29,.07);
}
.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 220px auto;
    gap: 12px;
    margin-bottom: 22px;
}
.filters.case-filters { grid-template-columns: minmax(220px, 1fr) 180px 180px auto; }
.filters input, .filters select, .client-form input, .client-form select,
.client-form textarea, .convert-form select {
    width: 100%;
    border: 1px solid #d8dbe1;
    padding: 12px 13px;
    background: #fbfbfc;
    outline: none;
}
.filters input:focus, .filters select:focus, .client-form input:focus,
.client-form select:focus, .client-form textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(203,166,84,.13);
}
.secondary-button, .table-button {
    border: 1px solid #c7cbd3;
    padding: 11px 16px;
    background: white;
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
}
.table-button { padding: 8px 11px; background: var(--ink); color: white; border: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th {
    padding: 13px 12px;
    text-align: left;
    color: #717887;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid #dfe2e7;
}
td { padding: 15px 12px; border-bottom: 1px solid #eceef1; font-size: .88rem; }
td small { display: block; margin-top: 5px; color: #7b8290; }
.empty-state { text-align: center; color: #7b8290; padding: 42px; }
.status {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 800;
}
.status.prospecto { color: #865f12; background: #fff4d7; }
.status.cliente { color: #24613e; background: #e7f6ed; }
.status.inactivo { color: #606673; background: #eceef1; }
.status.nuevo { color: #315b86; background: #e8f2fb; }
.status.activo { color: #236440; background: #e7f6ed; }
.status.en_espera { color: #865f12; background: #fff4d7; }
.status.concluido { color: #535b69; background: #eceef1; }
.status.archivado { color: #535b69; background: #e1e3e7; }
.status.bloqueado { color: #8d2727; background: #ffe7e7; }
.status.inactivo { color: #535b69; background: #e1e3e7; }
.priority {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 800;
}
.priority.critico { color: #8d2727; background: #ffe7e7; }
.priority.urgente { color: #8b4c11; background: #ffeddc; }
.priority.importante { color: #725c18; background: #fff6d7; }
.date-overdue { color: #a52d2d; font-weight: 800; }
.date-overdue small { color: #a52d2d; }
.convert-form { display: flex; gap: 7px; min-width: 280px; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    place-items: center;
    padding: 24px;
}
.modal.open { display: grid; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,14,21,.72); backdrop-filter: blur(3px); }
.modal-card {
    position: relative;
    width: min(850px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    padding: 30px;
    background: white;
    border-top: 4px solid var(--gold);
    box-shadow: var(--shadow);
}
.modal-card > header { display: flex; align-items: flex-start; justify-content: space-between; }
.modal-card h2 { margin: 8px 0 20px; }
.modal-close { border: 0; background: transparent; font-size: 2rem; cursor: pointer; }
.modal-lock { overflow: hidden; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid label { display: block; margin-bottom: 7px; font-size: .77rem; font-weight: 800; }
.form-grid textarea { min-height: 88px; resize: vertical; }
.span-2 { grid-column: span 2; }
.check-row { display: flex; gap: 10px; align-items: center; margin-top: 20px; font-size: .82rem; }
.check-row input { width: auto; }
.client-form footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.module-coming { max-width: 900px; }
.coming-label {
    display: inline-flex;
    margin-top: 24px;
    padding: 8px 12px;
    border: 1px solid rgba(203,166,84,.55);
    color: var(--gold-light);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.document-summary {
    margin-top: 30px;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: white;
    background: linear-gradient(120deg, #252c38, #4e5768);
    border-bottom: 3px solid var(--gold);
}
.document-summary h2 { margin: 7px 0; }
.document-summary p { margin: 0; color: #d9dde4; }
.security-badge {
    flex: 0 0 auto;
    padding: 9px 13px;
    color: var(--gold-light);
    border: 1px solid rgba(223,194,125,.55);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.filters.document-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; }
.document-grid { display: grid; gap: 12px; }
.document-card {
    display: grid;
    grid-template-columns: 62px minmax(220px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    background: #fff;
}
.file-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    color: white;
    background: linear-gradient(145deg, #303846, #596273);
    border-bottom: 3px solid var(--gold);
    font-size: .68rem;
    font-weight: 900;
}
.document-category {
    color: #9a782d;
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.document-info h3 { margin: 5px 0; font-size: 1rem; }
.document-info p, .document-info small { margin: 0; color: #646b79; }
.document-info small { display: block; }
.file-meta { margin-top: 8px; color: #8a909c; font-size: .72rem; }
.document-actions { display: grid; justify-items: end; gap: 10px; }
.document-actions a { text-decoration: none; }
.visible-badge {
    color: #236440;
    background: #e7f6ed;
    padding: 6px 9px;
    font-size: .67rem;
    font-weight: 800;
}
.field-help { display: block; margin-top: 6px; color: #727987; }
.capture-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 14px;
    border: 1px solid #d8dbe1;
}
.capture-tab {
    padding: 11px;
    border: 0;
    border-right: 1px solid #d8dbe1;
    color: #5f6674;
    background: #f5f6f8;
    font-weight: 800;
    cursor: pointer;
}
.capture-tab:last-child { border-right: 0; }
.capture-tab.active { color: white; background: var(--ink); box-shadow: inset 0 -3px var(--gold); }
.capture-panel { display: none; }
.capture-panel.active { display: block; }
.recorder-box {
    padding: 18px;
    border: 1px solid #dfe2e7;
    background: #f8f9fa;
}
.recorder-status {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 9px;
    color: #5f6674;
}
.record-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #aeb3bc;
}
.recorder-status.recording .record-dot {
    background: #c73535;
    box-shadow: 0 0 0 5px rgba(199,53,53,.14);
    animation: recordPulse 1.2s infinite;
}
.recorder-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.stop-button {
    padding: 11px 16px;
    border: 0;
    color: white;
    background: #a83232;
    font-weight: 800;
    cursor: pointer;
}
.stop-button:disabled { cursor: not-allowed; opacity: .45; }
.text-button { border: 0; color: #665225; background: transparent; font-weight: 800; cursor: pointer; }
.camera-preview, .record-preview {
    width: 100%;
    max-height: 320px;
    margin-top: 14px;
    background: #10141b;
}
audio.record-preview { background: transparent; }
@keyframes recordPulse {
    50% { box-shadow: 0 0 0 9px rgba(199,53,53,.04); }
}
.credential-card {
    margin-top: 24px;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: #18202a;
    background: #fff8e7;
    border: 1px solid #ead18e;
    border-left: 5px solid var(--gold);
}
.credential-card h2 { margin: 6px 0 12px; }
.credential-card p { margin: 6px 0; }
.credential-card code {
    padding: 3px 7px;
    color: #17202b;
    background: white;
    border: 1px solid #ded6c3;
    font-size: .9rem;
}
.credential-card small { display: block; margin-top: 10px; color: #6f6550; }
.row-actions { display: flex; gap: 7px; align-items: center; }
.secondary-button.small { padding: 8px 11px; }
.logout-link {
    display: block;
    margin-top: 18px;
    color: #6a7180;
    text-align: center;
    font-size: .82rem;
}
.kpi-grid article.kpi-danger { border-top-color: #b63838; background: #fff8f8; }
.filters.activity-filters { grid-template-columns: repeat(3, minmax(160px, 1fr)) auto; }
.activity-list { display: grid; gap: 12px; }
.activity-card {
    display: grid;
    grid-template-columns: 72px minmax(260px, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px;
    border: 1px solid #e4e7eb;
    border-left: 4px solid var(--gold);
    background: white;
}
.activity-card.overdue { border-left-color: #b63838; background: #fffafa; }
.activity-date {
    min-height: 70px;
    display: grid;
    place-items: center;
    align-content: center;
    color: white;
    background: #28303d;
}
.activity-date strong { font-size: 1.45rem; line-height: 1; }
.activity-date span { margin-top: 4px; color: var(--gold-light); font-size: .68rem; font-weight: 900; }
.activity-date small { margin-top: 3px; color: #d8dce3; }
.activity-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.activity-content h3 { margin: 8px 0 5px; }
.activity-content p { margin: 0 0 5px; color: #5f6674; }
.activity-content small { color: #7a818e; }
.overdue-label {
    padding: 6px 10px;
    color: white;
    background: #a52d2d;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 900;
}
.evidence-link {
    display: block;
    margin-top: 8px;
    color: #7a6028;
    font-size: .76rem;
    font-weight: 800;
}
.activity-action { justify-self: end; }
.filters.finance-filters { grid-template-columns: 180px minmax(180px, 1fr) 180px auto; }
.movement {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 900;
}
.movement.ingreso { color: #236440; background: #e7f6ed; }
.movement.egreso { color: #8d2727; background: #ffe7e7; }
.money { font-weight: 900; white-space: nowrap; }
.money.ingreso { color: #246d45; }
.money.egreso { color: #a33131; }
.status.pendiente { color: #865f12; background: #fff4d7; }
.status.aprobado { color: #236440; background: #e7f6ed; }
.status.rechazado { color: #8d2727; background: #ffe7e7; }
.dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}
.dashboard-action {
    flex: 0 0 auto;
    padding: 12px 17px;
    color: white;
    border: 1px solid rgba(223,194,125,.6);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 800;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-top: 24px;
}
.dashboard-panel {
    min-width: 0;
    padding: 24px;
    background: white;
    box-shadow: 0 12px 35px rgba(15,20,29,.07);
}
.dashboard-panel > header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding-bottom: 17px;
    border-bottom: 1px solid #e5e7eb;
}
.dashboard-panel h2 { margin: 6px 0 0; font-size: 1.15rem; }
.dashboard-panel > header > a {
    color: #785f2b;
    font-size: .77rem;
    font-weight: 800;
    text-decoration: none;
}
.dashboard-list { display: grid; }
.dashboard-list-row {
    display: grid;
    grid-template-columns: 44px minmax(150px, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #eceef1;
}
.dashboard-list-row:last-child { border-bottom: 0; }
.dashboard-list-row.danger { background: #fff8f8; }
.dashboard-list-row small { display: block; margin-top: 4px; color: #747b89; }
.mini-date, .case-mark {
    width: 42px;
    min-height: 42px;
    display: grid;
    place-items: center;
    align-content: center;
    color: white;
    background: #29313e;
}
.mini-date strong { line-height: 1; }
.mini-date span { color: var(--gold-light); font-size: .58rem; font-weight: 900; }
.case-mark { color: var(--gold-light); font-size: .62rem; font-weight: 900; }
.finance-bars { display: grid; gap: 12px; margin-top: 19px; }
.finance-bars > div {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    border-left: 4px solid #4c8b65;
    background: #f5faf7;
}
.finance-bars > div:nth-child(2) { border-left-color: #b84a4a; background: #fff7f7; }
.finance-bars > div.balance { border-left-color: var(--gold); background: #fffaf0; }
.performance-list { display: grid; }
.performance-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) repeat(3, 74px);
    gap: 10px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid #eceef1;
}
.performance-row:last-child { border-bottom: 0; }
.performance-row small, .performance-row span {
    display: block;
    margin-top: 3px;
    color: #777e8c;
    font-size: .68rem;
}
.performance-row > div:not(:first-child) { text-align: center; }
.danger-text { color: #a42e2e; }
.download-link { display: inline-flex; text-decoration: none; }
.report-filter-panel { margin-top: 28px; }
.filters.report-filters { grid-template-columns: repeat(4, minmax(150px,1fr)) auto; align-items: end; margin: 0; }
.report-filters label { display: block; margin-bottom: 6px; color: #626978; font-size: .72rem; font-weight: 800; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 24px; }
.metric-bars { display: grid; gap: 15px; margin-top: 20px; }
.metric-bars > div > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .82rem; }
.metric-track { height: 8px; overflow: hidden; background: #eceef1; }
.metric-track i { display: block; height: 100%; background: linear-gradient(90deg,#a47e31,var(--gold)); }
.report-numbers { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-top: 20px; }
.report-numbers div { padding: 13px 8px; text-align: center; background: #f5f6f8; }
.report-numbers strong { display: block; font-size: 1.35rem; }
.report-numbers span { display: block; margin-top: 4px; color: #767d8a; font-size: .68rem; }
.panel-title { margin-bottom: 18px; }
.panel-title h2 { margin: 6px 0 0; }
.filters.library-filters { grid-template-columns: minmax(240px,1fr) repeat(3,180px) auto; }
.library-grid { display: grid; grid-template-columns: repeat(3,minmax(230px,1fr)); gap: 18px; }
.library-card { display: flex; flex-direction: column; padding: 21px; border: 1px solid #e2e5e9; border-top: 3px solid var(--gold); background: white; }
.library-type { color: #8c6b27; font-size: .68rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.library-card h3 { margin: 9px 0; font-size: 1.05rem; line-height: 1.35; }
.library-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.library-meta span { padding: 5px 8px; color: #5e6674; background: #f0f2f4; font-size: .67rem; }
.library-card p { color: #646c79; font-size: .82rem; line-height: 1.55; }
.library-labels { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.status.vigente { color: #236440; background: #e7f6ed; }
.status.derogado { color: #8d2727; background: #ffe7e7; }
.status.borrador { color: #625725; background: #fff4d7; }
.library-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #eceef1; }
.library-card footer small { color: #7b8290; }
.library-card footer a { text-decoration: none; }
.assistant-page { max-width: 1500px; }
.local-ai-badge { padding: 8px 12px; color: #276443; background: #e7f6ed; border: 1px solid #b8dfc8; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.assistant-hero { margin-top: 30px; padding: 30px; display: flex; align-items: center; gap: 22px; color: white; background: linear-gradient(120deg,#202733,#4c5668); border-bottom: 4px solid var(--gold); }
.assistant-symbol { width: 76px; height: 76px; display: grid; place-items: center; flex: 0 0 auto; color: var(--gold-light); border: 1px solid rgba(223,194,125,.55); font-size: 1.25rem; font-weight: 900; }
.assistant-hero h2 { margin: 7px 0; }
.assistant-hero p { margin: 0; color: #dce0e7; }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.quick-prompts button { padding: 9px 12px; color: #5d512f; border: 1px solid #d9c694; background: #fffaf0; cursor: pointer; font-weight: 700; }
.assistant-form { margin-top: 20px; padding: 22px; background: white; box-shadow: 0 12px 35px rgba(15,20,29,.07); }
.assistant-form label { display: block; margin-bottom: 8px; font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.assistant-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.assistant-form input { min-width: 0; padding: 14px; border: 1px solid #d8dbe1; outline: none; }
.assistant-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(203,166,84,.13); }
.assistant-answer { margin-top: 22px; padding: 26px; border-left: 4px solid #4c7a9b; background: white; box-shadow: 0 12px 35px rgba(15,20,29,.07); }
.assistant-answer.warning { border-left-color: #c69231; }
.assistant-answer.danger { border-left-color: #b63838; }
.assistant-answer.success { border-left-color: #3e8b60; }
.assistant-answer > header { display: flex; align-items: center; gap: 12px; }
.assistant-answer h2 { margin: 5px 0 0; }
.answer-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 6px rgba(203,166,84,.13); }
.assistant-results { display: grid; grid-template-columns: repeat(2,minmax(240px,1fr)); gap: 12px; margin-top: 18px; }
.assistant-results article { padding: 17px; border: 1px solid #e3e6ea; background: #fafbfc; }
.assistant-results article > div { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 6px 0; border-bottom: 1px solid #eceef1; }
.assistant-results article > div:last-child { border-bottom: 0; }
.assistant-results span { color: #777e8b; font-size: .7rem; text-transform: capitalize; }
.assistant-results strong { max-width: 68%; text-align: right; font-size: .8rem; }
.assistant-answer > footer { margin-top: 18px; padding-top: 13px; color: #777e8b; border-top: 1px solid #eceef1; font-size: .7rem; }
.case-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.case-actions .table-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 66px;
    padding: 9px 12px;
    border: 1px solid var(--ink);
    text-decoration: none;
    font-size: .7rem;
    font-weight: 900;
    line-height: 1;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.case-actions .table-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 16px rgba(20,27,38,.16);
}
.case-actions .table-button-gold {
    color: #151a22;
    border-color: var(--gold);
    background: var(--gold);
}
.case-actions .table-button-outline {
    color: #27303d;
    border-color: #9ca3ae;
    background: white;
}
.case-actions .table-button-outline:hover {
    color: white;
    border-color: #384150;
    background: #384150;
}
.case-actions .table-button-report {
    color: #2d4f68;
    border-color: #88a9bf;
    background: #eef6fb;
}
.case-actions .table-button-receipt {
    color: #4f633c;
    border-color: #a8b99b;
    background: #f1f7ed;
}
.table-link { color: #765d2a; font-size: .72rem; font-weight: 800; }
.page-subtitle { margin: 5px 0 0; color: #707785; }
.stage-page { max-width: 1600px; }
.case-progress-summary {
    display: grid;
    grid-template-columns: 180px minmax(260px,1fr) minmax(220px,auto);
    align-items: center;
    gap: 24px;
    margin: 26px 0;
    padding: 24px 28px;
    color: white;
    background: linear-gradient(120deg,#202733,#495466);
    border-bottom: 4px solid var(--gold);
}
.case-progress-summary span { display: block; color: #cfd4dd; font-size: .72rem; }
.case-progress-summary strong { display: block; margin-top: 6px; font-size: 1.35rem; }
.progress-track, .stage-progress-bar {
    height: 10px;
    overflow: hidden;
    background: rgba(255,255,255,.17);
}
.progress-track i, .stage-progress-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg,#a47e31,#e0bd68);
}
.stage-timeline { display: grid; gap: 18px; }
.stage-card {
    display: grid;
    grid-template-columns: 64px minmax(0,1fr);
    border: 1px solid #e0e3e8;
    border-left: 4px solid #aeb4be;
    background: white;
    box-shadow: 0 10px 28px rgba(15,20,29,.06);
}
.stage-card.en_curso { border-left-color: var(--gold); }
.stage-card.completada { border-left-color: #43805a; }
.stage-card.overdue { border-left-color: #b63838; }
.stage-index {
    min-height: 100%;
    display: grid;
    place-items: center;
    color: var(--gold-light);
    background: #28303d;
    font-size: 1.4rem;
    font-weight: 900;
}
.stage-body { padding: 23px; min-width: 0; }
.stage-body > header { display: flex; justify-content: space-between; gap: 16px; }
.stage-body h2 { margin: 5px 0 0; font-size: 1.15rem; }
.stage-body > p { margin: 11px 0 16px; color: #676e7b; }
.stage-range { color: #8a6827; font-size: .67rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.stage-progress-bar { background: #eceef1; }
.stage-metrics {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 10px;
    margin-top: 15px;
}
.stage-metrics div { padding: 11px 13px; background: #f5f6f8; }
.stage-metrics span { display: block; color: #777e8b; font-size: .65rem; }
.stage-metrics strong { display: block; margin-top: 4px; font-size: .8rem; }
.status.en_curso { color: #805f19; background: #fff2cf; }
.status.completada { color: #236440; background: #e7f6ed; }
.stage-update-form { margin-top: 18px; border-top: 1px solid #e5e7eb; }
.stage-update-form summary { padding: 15px 0 4px; color: #765d2a; cursor: pointer; font-size: .78rem; font-weight: 900; }
.stage-update-form form { padding-top: 15px; }
.stage-update-form button { margin-top: 13px; }
.stage-history { margin-top: 25px; }
.stage-history > article {
    display: grid;
    grid-template-columns: 58px minmax(0,1fr);
    gap: 16px;
    padding: 17px 0;
    border-top: 1px solid #e8eaed;
}
.history-date {
    width: 54px;
    min-height: 54px;
    display: grid;
    place-items: center;
    align-content: center;
    color: white;
    background: #2b3340;
}
.history-date strong { font-size: 1.1rem; line-height: 1; }
.history-date span { margin-top: 3px; color: var(--gold-light); font-size: .56rem; font-weight: 900; }
.stage-history h3 { margin: 5px 0; font-size: .95rem; }
.stage-history p { margin: 5px 0; color: #666d79; line-height: 1.5; }
.stage-history small { color: #7b8290; }
.edit-case-page { max-width: 1650px; }
.locked-case-data {
    display: grid;
    grid-template-columns: minmax(220px,1fr) minmax(220px,1fr) minmax(260px,1.2fr);
    gap: 1px;
    margin: 25px 0;
    border-bottom: 4px solid var(--gold);
    background: #4b5563;
}
.locked-case-data > div {
    min-width: 0;
    padding: 20px 22px;
    color: white;
    background: #28303d;
}
.locked-case-data span {
    display: block;
    color: #c9ced7;
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.locked-case-data strong {
    display: block;
    margin-top: 7px;
    overflow-wrap: anywhere;
    font-size: .9rem;
}
.edit-case-layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) 340px;
    gap: 24px;
    align-items: start;
}
.assignment-editor {
    margin-top: 28px;
    padding-top: 25px;
    border-top: 1px solid #e1e4e8;
}
.assignment-editor h2 { margin: 7px 0 18px; }
.collaborator-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(210px,1fr));
    gap: 10px;
    margin-top: 17px;
}
.collaborator-grid > label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid #dde1e6;
    background: #f8f9fa;
    cursor: pointer;
}
.collaborator-grid > label:has(input:checked) {
    border-color: #c8a250;
    background: #fff9eb;
}
.collaborator-grid input { width: 17px; height: 17px; accent-color: #a57e2f; }
.collaborator-grid strong, .collaborator-grid small { display: block; }
.collaborator-grid strong { font-size: .8rem; }
.collaborator-grid small { margin-top: 3px; color: #757d89; font-size: .67rem; }
.edit-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e4e6ea;
}
.edit-form-footer span { color: #707784; font-size: .72rem; }
.change-log-panel {
    padding: 24px;
    background: #28303d;
    box-shadow: 0 12px 35px rgba(15,20,29,.1);
}
.change-log-panel h2 { margin: 7px 0 18px; color: white; }
.change-log-panel > article {
    padding: 15px 0;
    color: white;
    border-top: 1px solid rgba(255,255,255,.12);
}
.change-log-panel > article strong { display: block; font-size: .78rem; }
.change-log-panel > article small { display: block; margin-top: 4px; color: #c2c8d1; }
.change-log-panel > article p {
    margin: 9px 0 0;
    color: #e1e4e9;
    font-size: .72rem;
    line-height: 1.55;
}
.change-log-panel .empty-state { color: #c6cbd3; }
.master-folio-field {
    padding: 15px;
    border-left: 4px solid var(--gold);
    background: #fff9eb;
}
.master-folio-field small {
    display: block;
    margin-top: 6px;
    color: #75643e;
    font-size: .68rem;
}

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; }
    .brand-panel { min-height: 360px; padding: 38px; }
    .brand-panel::after { display: none; }
    .brand-copy h1 { font-size: 3.2rem; }
    .brand-copy { padding: 52px 0 34px; }
    .form-panel { padding: 30px 18px; }
    .app-page { display: block; }
    .sidebar { position: static; width: 100%; }
    .content { padding: 28px 20px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .clients-kpis { grid-template-columns: repeat(3, 1fr); }
    .filters { grid-template-columns: 1fr; }
    .filters.case-filters { grid-template-columns: 1fr; }
    .filters.document-filters { grid-template-columns: 1fr; }
    .document-card { grid-template-columns: 58px 1fr; }
    .document-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .filters.report-filters { grid-template-columns: 1fr 1fr; }
    .report-grid { grid-template-columns: 1fr; }
    .filters.library-filters { grid-template-columns: 1fr 1fr; }
    .library-grid { grid-template-columns: 1fr 1fr; }
    .assistant-results { grid-template-columns: 1fr; }
    .case-progress-summary { grid-template-columns: 1fr; }
    .stage-metrics { grid-template-columns: 1fr 1fr; }
    .locked-case-data { grid-template-columns: 1fr; }
    .edit-case-layout { grid-template-columns: 1fr; }
    .change-log-panel { order: 2; }
}
@media (max-width: 520px) {
    .brand-panel { min-height: 310px; }
    .login-card { padding: 30px 24px; }
    .login-logo { width: min(300px, 86%); }
    .brand-copy { padding: 36px 0 24px; }
    .topbar { align-items: flex-start; }
    .topbar-actions { width: 100%; align-items: stretch; flex-direction: column; }
    .user-chip { text-align: left; }
    .kpi-grid { grid-template-columns: 1fr; }
    .clients-kpis { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .modal { padding: 10px; }
    .modal-card { padding: 24px 18px; }
    .document-summary { align-items: flex-start; flex-direction: column; }
    .document-card { grid-template-columns: 1fr; }
    .document-actions { grid-column: auto; justify-content: flex-start; }
    .capture-tabs { grid-template-columns: 1fr; }
    .capture-tab { border-right: 0; border-bottom: 1px solid #d8dbe1; }
    .credential-card { align-items: flex-start; flex-direction: column; }
    .filters.activity-filters { grid-template-columns: 1fr; }
    .activity-card { grid-template-columns: 60px 1fr; }
    .activity-action { grid-column: 1 / -1; justify-self: end; }
    .filters.finance-filters { grid-template-columns: 1fr; }
    .dashboard-welcome { align-items: flex-start; flex-direction: column; }
    .dashboard-list-row { grid-template-columns: 42px 1fr; }
    .dashboard-list-row > .status,
    .dashboard-list-row > .priority { grid-column: 2; justify-self: start; }
    .performance-row { grid-template-columns: 1fr repeat(3, 58px); }
    .filters.report-filters { grid-template-columns: 1fr; }
    .report-numbers { grid-template-columns: 1fr 1fr; }
    .filters.library-filters { grid-template-columns: 1fr; }
    .library-grid { grid-template-columns: 1fr; }
    .assistant-form > div { grid-template-columns: 1fr; }
    .assistant-form button { width: 100%; }
    .assistant-hero { align-items: flex-start; flex-direction: column; }
    .case-actions { align-items: flex-start; flex-direction: column; }
    .stage-card { grid-template-columns: 44px minmax(0,1fr); }
    .stage-body { padding: 18px 14px; }
    .stage-body > header { align-items: flex-start; flex-direction: column; }
    .stage-metrics { grid-template-columns: 1fr; }
    .collaborator-grid { grid-template-columns: 1fr; }
    .edit-form-footer { align-items: stretch; flex-direction: column; }
    .edit-form-footer button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .intelligence-network { display: none; }
    .primary-button, .login-submit span:last-child { transition: none; }
}
