:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #eef4ff;
    --text: #111827;
    --muted: #64748b;
    --line: #dbe3ef;
    --blue: #0755a3;
    --blue-2: #0f6cbd;
    --green: #159447;
    --amber: #f4b731;
    --orange: #f97316;
    --slate: #0f172a;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
    background: var(--surface);
}
.auth-visual {
    position: relative;
    overflow: hidden;
    background: #0f172a;
    color: #fff;
    padding: 64px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
/* Velo neutro sutil (sin tinte azul) solo para legibilidad del título, anclado a la izquierda. */
.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(90deg, rgba(12, 17, 28, .58) 0%, rgba(12, 17, 28, .28) 42%, rgba(12, 17, 28, 0) 72%);
}
.auth-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.auth-brand img { width: 230px; max-width: 100%; filter: brightness(0) invert(1); }
.auth-copy {
    position: relative;
    z-index: 2;
    max-width: 640px;
}
/* Título de marca: "Gestión de" (light) + "CONTRATOS" (bold) + "SANTOLAYA" (tracking amplio). */
.hero-title {
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: "Montserrat", Inter, ui-sans-serif, system-ui, sans-serif;
    color: #fff;
    line-height: 1;
    text-shadow: 0 14px 40px rgba(15, 23, 42, .4);
}
.hero-title-light {
    font-weight: 300;
    font-size: clamp(30px, 4vw, 56px);
    letter-spacing: .005em;
}
.hero-title-bold {
    font-weight: 700;
    font-size: clamp(52px, 7.4vw, 108px);
    letter-spacing: -.015em;
    text-transform: uppercase;
    margin-top: 4px;
}
.hero-brand {
    display: block;
    margin-top: 26px;
    font-family: "Montserrat", Inter, ui-sans-serif, system-ui, sans-serif;
    font-weight: 500;
    font-size: clamp(13px, 1.5vw, 19px);
    letter-spacing: .5em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .92);
    text-shadow: 0 6px 22px rgba(15, 23, 42, .4);
}
.auth-copy p { font-size: 18px; line-height: 1.6; color: rgba(255, 255, 255, .78); margin: 0; }
.auth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; position: relative; }
.auth-metric { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); padding: 18px; border-radius: 8px; }
.auth-metric strong { display: block; font-size: 26px; }
.auth-metric span { display: block; color: rgba(255,255,255,.72); font-size: 13px; margin-top: 5px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 430px; }
.login-card img { width: 260px; max-width: 100%; margin-bottom: 34px; }
.login-card h2 { font-size: 30px; margin: 0 0 8px; }
.login-card p { margin: 0 0 28px; color: var(--muted); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field.no-margin { margin-bottom: 0; }
.field label { font-size: 13px; font-weight: 700; color: #344054; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.35; }
.input, .select, .textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    padding: 10px 13px;
    min-height: 46px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: #98a2b3; }
.textarea { min-height: 110px; resize: vertical; }
.no-spin::-webkit-outer-spin-button,
.no-spin::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}
.no-spin[type=number] {
    -moz-appearance: textfield;
}
.input:focus, .select:focus, .textarea:focus {
    outline: 0;
    border-color: #86b7fe;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .14), 0 1px 2px rgba(16, 24, 40, .05);
}
.input-unit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.input-unit .input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-unit span {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid #d0d5dd;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364758b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 10px;
}
.select:disabled, .input:disabled, .textarea:disabled {
    background-color: #f2f4f7;
    color: #667085;
    cursor: not-allowed;
}
.check-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 18px; color: #334155; }
.type-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.feature-check {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 850;
}
.table-check {
    display: inline-grid;
    place-items: center;
}
.table-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.table-check span {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
}
.table-check span::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
    opacity: 0;
}
.table-check input:checked + span {
    border-color: var(--blue-2);
    background: var(--blue-2);
}
.table-check input:checked + span::after {
    opacity: 1;
}
.btn {
    border: 0;
    border-radius: 8px;
    padding: 11px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15, 23, 42, .12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47, 111, 237, .30); }
.btn svg { flex: 0 0 auto; width: 16px; height: 16px; opacity: .95; }
.btn-primary { background: var(--blue-2); color: #fff; }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(37, 99, 235, .34); }
.btn-dark { background: var(--slate); color: #fff; }
.btn-dark:hover { box-shadow: 0 10px 24px rgba(51, 65, 85, .34); }
.btn-soft { background: #e8f1ff; color: var(--blue); }
.btn-soft:hover { background: #dbeafe; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { box-shadow: 0 10px 24px rgba(22, 163, 74, .32); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { box-shadow: 0 10px 24px rgba(220, 38, 38, .32); }
.btn-warn { background: var(--amber); color: #111827; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: #334155; }
.btn-outline:hover { border-color: #b7d4f6; color: var(--blue); background: #f7fafe; }
.btn-outline svg { opacity: .85; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 10px; font-size: 13px; }

.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: #fff;
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-logo { display: block; padding: 4px 10px 26px; }
.sidebar-logo img { width: 210px; max-width: 100%; }
.nav-title { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin: 20px 12px 8px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #334155;
    font-weight: 750;
    margin-bottom: 4px;
}
.nav-link:hover, .nav-link.active { background: #eaf3ff; color: var(--blue); }
.nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-icon path {
    stroke: currentColor;
    vector-effect: non-scaling-stroke;
}
.main { min-width: 0; }
.topbar {
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 30px;
    background: rgba(255,255,255,.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}
.topbar h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.05;
    font-weight: 300;
    letter-spacing: 0;
    color: #0f172a;
}
.topbar-meta { color: var(--muted); font-size: 13px; }
.content { padding: 30px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-title { margin: 0 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.maintenance-link {
    min-height: 148px;
    transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.maintenance-link:hover {
    transform: translateY(-2px);
    border-color: #9bc4ef;
    box-shadow: 0 18px 34px rgba(15, 108, 189, .12);
}
.stat { padding: 20px; border-left: 5px solid var(--blue-2); position: relative; }
.stat span { color: var(--muted); font-weight: 750; font-size: 13px; }
.stat strong { display: block; font-size: 34px; margin-top: 8px; }
.stat-link {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 12px;
    font-weight: 800;
    color: var(--blue, #2f6fed);
    text-decoration: none;
    opacity: .75;
    transition: opacity .15s ease;
}
.stat-link:hover { opacity: 1; text-decoration: underline; }
.stat-link span { color: inherit; font-weight: 800; font-size: 13px; }
.dashboard-filter { margin-bottom: 18px; }
.dashboard-filter-form {
    display: grid;
    grid-template-columns: minmax(260px, 460px) auto;
    align-items: end;
    gap: 12px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #475569; background: #f8fafc; }
td { font-size: 14px; }
.badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 850; background: #eef2ff; }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge-success {
    border: 1px solid #86efac;
    background: #dcfce7;
    color: #166534;
}
.badge-danger {
    border: 1px solid #fecaca;
    background: #fee2e2;
    color: #991b1b;
}
.muted { color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 {
    margin: 0;
    font-size: 31px;
    line-height: 1.06;
    font-weight: 300;
    letter-spacing: 0;
    color: #0f172a;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    border-radius: 10px;
    padding: 13px 15px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-left: 4px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}
.alert::before {
    content: "";
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background-color: currentColor;
    -webkit-mask: var(--alert-icon) center / contain no-repeat;
    mask: var(--alert-icon) center / contain no-repeat;
}
.alert-ok {
    border-color: #bbf7d0;
    border-left-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.6-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4-7 7z'/%3E%3C/svg%3E");
}
.alert-error {
    border-color: #fecaca;
    border-left-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2 1 21h22L12 2zm1 15h-2v-2h2v2zm0-4h-2V9h2v4z'/%3E%3C/svg%3E");
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.financial-row {
    display: grid;
    grid-template-columns: minmax(130px, 170px) minmax(260px, 1fr) minmax(150px, 190px);
    gap: 16px;
    align-items: start;
}
.percent-card {
    padding: 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.percent-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.percent-label-row label {
    font-size: 15px;
    color: #0f172a;
}
.percent-label-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}
.percent-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    align-items: stretch;
    margin-top: 10px;
}
.percent-input .input {
    min-height: 52px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    font-size: 18px;
    font-weight: 800;
}
.percent-input > span {
    display: grid;
    place-items: center;
    min-height: 52px;
    border: 1px solid #d0d5dd;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: #eef6ff;
    color: var(--blue);
    font-size: 16px;
    font-weight: 900;
}
.percent-check {
    margin: 12px 0 0;
    font-weight: 850;
}
.approval-indicator {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
}
.approval-indicator strong {
    display: block;
    font-size: 12px;
    line-height: 1.25;
    color: #334155;
}
.approval-indicator p {
    margin: 3px 0 0;
    color: inherit;
    font-size: 12px;
    line-height: 1.35;
}
.approval-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-top: 3px;
    background: #94a3b8;
    box-shadow: 0 0 0 4px rgba(148, 163, 184, .14);
}
.approval-indicator.is-ok {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}
.approval-indicator.is-ok strong { color: #14532d; }
.approval-indicator.is-ok .approval-dot {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .14);
}
.approval-indicator.is-required {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}
.approval-indicator.is-required strong { color: #7c2d12; }
.approval-indicator.is-required .approval-dot {
    background: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .16);
}
.approval-indicator.is-muted {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #64748b;
}
.approval-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}
.approval-list h4 {
    margin: 0;
    font-size: 13px;
    color: #334155;
}
.approval-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}
.approval-row strong {
    display: block;
    font-size: 13px;
}
.approval-row span:not(.badge) {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}
.approval-flow-grid {
    display: grid;
    gap: 18px;
}
.approval-inbox {
    display: grid;
    gap: 18px;
}
.approval-task {
    border-left: 5px solid var(--amber);
}
.approval-task-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}
.approval-task-head span:not(.badge) {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.approval-task-head h3 {
    margin: 4px 0 5px;
    font-size: 20px;
    font-weight: 500;
}
.approval-task-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.approval-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
}
.approval-meta-grid div {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}
.approval-meta-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.approval-meta-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}
.approval-resolution-form {
    display: grid;
    gap: 10px;
}
.approval-flow-card {
    border-left: 5px solid var(--blue-2);
}
.approval-flow-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.approval-flow-head span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}
.approval-flow-head h3 {
    margin: 4px 0 0;
    font-size: 20px;
    font-weight: 500;
}
.switch-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}
.switch-row input {
    accent-color: var(--blue-2);
}
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    max-height: 220px;
    overflow: auto;
}
.check-row.compact {
    align-items: flex-start;
    margin: 0;
    padding: 7px 8px;
    border-radius: 7px;
    background: #fff;
    border: 1px solid #eef2f7;
    font-size: 12px;
    line-height: 1.3;
}
.check-row.compact input {
    margin-top: 2px;
}
.user-maintenance-list {
    display: grid;
    gap: 14px;
}
.user-maintenance-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.user-maintenance-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.user-maintenance-head strong {
    display: block;
    font-size: 16px;
}
.user-maintenance-head span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}
.itemized-panel {
    padding: 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}
/* El atributo hidden debe ocultar los campos condicionales del formulario
   (por defecto `.field { display:grid }` lo anula). */
.field[hidden],
[data-itemized-panel][hidden],
[data-retention-field][hidden],
[data-advance-field][hidden],
[data-guarantee-field][hidden] {
    display: none !important;
}
.itemized-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.itemized-head,
.itemized-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(135px, .55fr) minmax(135px, .55fr) minmax(105px, .4fr) minmax(125px, .45fr) auto;
    gap: 10px;
    align-items: center;
}
.itemized-head {
    color: #475569;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.itemized-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}
.itemized-balance {
    padding: 11px 13px;
    border-radius: 8px;
    border: 1px solid #dbe3ef;
    background: #fff;
    font-size: 13px;
    font-weight: 800;
}
.itemized-balance.is-muted {
    color: #64748b;
}
.itemized-balance.is-ok {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}
.itemized-balance.is-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}
.contract-type-panel {
    padding: 20px;
    border: 1px solid #b7d4f6;
    border-left: 5px solid var(--blue-2);
    border-radius: 8px;
    background: linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
    box-shadow: 0 12px 28px rgba(15, 108, 189, .10);
}
.contract-type-panel label {
    font-size: 20px;
    font-weight: 300;
    color: #0f172a;
}
.contract-type-panel .select {
    min-height: 58px;
    font-size: 18px;
    font-weight: 700;
    border-color: #9bc4ef;
    color: var(--blue);
}
.contract-type-panel .field-help {
    font-size: 13px;
    color: #305878;
}
.timeline { display: grid; gap: 10px; }
.timeline-item { display: grid; grid-template-columns: 20px 1fr; gap: 11px; align-items: start; color: var(--muted); font-weight: 700; }
.timeline-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; background: var(--line); }
.timeline-item.done { color: #0f172a; }
.pie-chart-wrap {
    display: grid;
    place-items: center;
    padding: 4px 0 18px;
}
.pie-chart {
    width: 176px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    align-content: center;
    background: conic-gradient(var(--pie));
    box-shadow: inset 0 0 0 16px #fff, 0 16px 32px rgba(15, 23, 42, .10);
}
.pie-chart span {
    display: block;
    color: #0f172a;
    font-size: 34px;
    font-weight: 850;
    line-height: 1;
}
.pie-chart small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
.chart-legend {
    display: grid;
    gap: 8px;
}
.chart-legend-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    color: #334155;
    font-size: 13px;
}
.chart-legend-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chart-legend-item em {
    color: #0f172a;
    font-style: normal;
    font-weight: 850;
}
.chart-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.contract-status-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    border-left: 6px solid var(--blue-2);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.contract-status-hero .status-kicker,
.status-version span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.contract-status-hero strong {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    font-size: 32px;
    line-height: 1.1;
}
.contract-status-hero p {
    max-width: 760px;
    margin: 10px 0 0;
    color: var(--muted);
}
.status-version {
    min-width: 150px;
    padding: 14px 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #fff;
    text-align: center;
}
.status-version strong { justify-content: center; font-size: 28px; color: var(--blue); }
.status-version.is-versions strong { font-size: 19px; letter-spacing: .3px; white-space: nowrap; }
.status-version small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.35;
}
.guarantee-status.is-pending {
    border-color: #fed7aa;
    background: #fff7ed;
}
.guarantee-status.is-pending strong { color: #c2410c; }
.guarantee-status.is-processed {
    border-color: #86efac;
    background: #f0fdf4;
}
.guarantee-status.is-processed strong { color: #166534; }
.contract-progress {
    margin-top: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(248, 251, 255, .98) 100%),
        radial-gradient(circle at top left, rgba(15, 108, 189, .10), transparent 34%);
}
.progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}
.progress-head span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.progress-head h3 {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 450;
}
.progress-head strong {
    min-width: 92px;
    padding: 9px 13px;
    border: 1px solid #b7d4f6;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--blue);
    text-align: center;
    font-size: 13px;
    font-weight: 900;
}
.process-stepper {
    --rail-top: 20px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--step-count, 12), minmax(92px, 1fr));
    gap: 0;
    min-width: 1040px;
    padding: 0 4px 4px;
}
.process-stepper::before,
.process-stepper::after {
    content: "";
    position: absolute;
    left: 48px;
    right: 48px;
    top: var(--rail-top);
    height: 4px;
    border-radius: 999px;
}
.process-stepper::before {
    background: #dbe3ef;
}
.process-stepper::after {
    right: auto;
    width: calc((100% - 96px) * var(--progress) / 100);
    background: linear-gradient(90deg, var(--green), var(--blue-2));
    box-shadow: 0 0 0 4px rgba(15, 108, 189, .08);
}
.process-step {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 9px;
    min-width: 0;
}
.process-node {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 3px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
    font-size: 11px;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}
.process-step.is-done .process-node {
    border-color: var(--status-color, var(--green));
    background: var(--status-color, var(--green));
    color: #fff;
}
.process-step.is-current .process-node {
    width: 52px;
    height: 52px;
    margin-top: -4px;
    border-color: var(--status-color, var(--blue-2));
    background: #fff;
    color: var(--status-color, var(--blue-2));
    box-shadow: 0 0 0 8px rgba(15, 108, 189, .12), 0 16px 28px rgba(15, 108, 189, .18);
}
.process-label {
    display: grid;
    gap: 3px;
    max-width: 106px;
    text-align: center;
}
.process-label strong {
    color: #334155;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 850;
}
.process-label small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
}
.process-step.is-done .process-label strong {
    color: #334155;
}
.process-step.is-current .process-label strong {
    color: #0f172a;
    font-size: 12px;
}
.process-step.is-current .process-label small {
    color: var(--blue);
}
.quick-panel { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.trace-print-list {
    display: grid;
    gap: 9px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.trace-print-list h4 {
    margin: 0 0 2px;
    color: #334155;
    font-size: 13px;
}
.trace-print-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}
.trace-print-row span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
}
.trace-print-row strong {
    color: #0f172a;
    font-size: 13px;
}
.trace-print-row small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.empty-note {
    padding: 13px 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}
.contract-stage-list {
    display: grid;
    gap: 20px;
    margin-top: 18px;
}
.contract-stage {
    --stage-accent: #cbd5e1;
    position: relative;
    width: 100%;
    border-left: 4px solid var(--stage-accent);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .06);
    transition: box-shadow .2s ease, border-color .2s ease;
}
/* Espina continua que conecta las etapas consecutivas del proceso. */
.contract-stage-list .contract-stage:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -4px;
    top: 100%;
    width: 4px;
    height: 20px;
    background: #e2e8f0;
}
/* Estado: etapa completada */
.contract-stage.is-done { --stage-accent: #16a34a; }
.contract-stage.is-done .stage-number {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}
/* Estado: etapa actual accionable */
.contract-stage.is-active {
    --stage-accent: var(--blue, #2f6fed);
    background: linear-gradient(180deg, #f5f9ff 0%, #ffffff 62%);
    box-shadow: 0 16px 36px rgba(47, 111, 237, .16);
}
.contract-stage.is-active .stage-number {
    background: var(--blue, #2f6fed);
    border-color: var(--blue, #2f6fed);
    color: #fff;
}
/* Estado: etapa pendiente / bloqueada */
.contract-stage.is-locked {
    --stage-accent: #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}
.contract-stage.is-locked .stage-number {
    background: #f1f5f9;
    border-color: #dde5ef;
    color: #94a3b8;
}
.stage-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}
.stage-head .card-title {
    margin-bottom: 4px;
}
.stage-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.stage-number {
    min-width: 50px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #b7d4f6;
    border-radius: 8px;
    background: #eef6ff;
    color: var(--blue);
    font-size: 13px;
    font-weight: 950;
}
.stage-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.stage-summary div {
    padding: 11px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
}
.stage-summary span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.stage-summary strong {
    display: block;
    margin-top: 4px;
    color: #0f172a;
    font-size: 13px;
}
.stage-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.contract-stage button:disabled {
    opacity: .62;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.settlement-form {
    margin-top: 6px;
}
.settlement-subhead {
    padding: 11px 13px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f0f7ff;
    color: var(--blue);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.settlement-approvals {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}
.settlement-approvals div {
    padding: 11px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}
.settlement-approvals span,
.settlement-meta-grid span,
.settlement-card-head span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.settlement-approvals strong {
    display: block;
    margin-top: 5px;
    color: #0f172a;
    font-size: 13px;
}
.settlement-approvals small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.settlement-approvals form {
    margin-top: 10px;
}
.settlement-control-panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.settlement-close-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
}
.settlement-close-actions span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.settlement-close-actions strong {
    display: block;
    margin-top: 4px;
    color: #0f172a;
    font-size: 13px;
}
.settlement-close-actions small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.settlement-board {
    display: grid;
    gap: 16px;
}
.settlement-card {
    border-left: 5px solid #94a3b8;
}
.settlement-card.has-settlement {
    border-left-color: var(--orange);
}
.settlement-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.settlement-card-head h3 {
    margin: 4px 0 5px;
    font-size: 20px;
    font-weight: 500;
}
.settlement-card-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.settlement-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.settlement-meta-grid div {
    padding: 11px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}
.settlement-meta-grid strong {
    display: block;
    margin-top: 4px;
    color: #0f172a;
    font-size: 13px;
}
.settlement-meta-grid small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.settlement-detail-line {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    padding: 12px 13px;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 13px;
}
.settlement-approval-strip {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}
.settlement-approval-strip span {
    color: #334155;
    font-size: 12px;
    font-weight: 900;
}
.approval-meter {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}
.approval-meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
}
.settlement-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}
.autocomplete { position: relative; }
.autocomplete .input {
    padding-left: 40px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' viewBox='0 0 24 24'%3e%3cpath stroke='%2364758b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 13px center;
}
.autocomplete-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, .16);
    overflow: hidden;
}
.autocomplete-option {
    width: 100%;
    display: grid;
    gap: 4px;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 12px 14px;
    cursor: pointer;
}
.autocomplete-option:hover, .autocomplete-option:focus {
    outline: none;
    background: #eef6ff;
}
.autocomplete-option strong { color: var(--slate); }
.autocomplete-option span, .autocomplete-option small { color: var(--muted); font-size: 12px; }
.autocomplete-empty { padding: 13px 14px; color: var(--muted); font-size: 13px; }
.autocomplete-help { margin-top: 7px; color: var(--muted); font-size: 12px; }
.autocomplete-help.is-error { color: #991b1b; font-weight: 750; }
.autocomplete-help.is-success { color: #166534; font-weight: 750; }
.field-help.is-error { color: #991b1b; font-weight: 750; }
.field-help.is-success { color: #166534; font-weight: 750; }
.field-help.is-warning { color: #b45309; font-weight: 750; }
.provider-lookup-row {
    display: grid;
    grid-template-columns: minmax(210px, 280px) max-content minmax(260px, 1fr) max-content;
    align-items: end;
    gap: 12px;
    margin-bottom: 0;
}
.provider-portal-button {
    min-height: 46px;
    padding-inline: 20px;
    white-space: nowrap;
}
.provider-rut-field label {
    font-size: 16px;
    font-weight: 850;
    color: #1f2937;
}
.provider-rut-field [data-provider-rut] {
    min-height: 56px;
    font-size: 19px;
    font-weight: 750;
    letter-spacing: .01em;
    border-color: #9bbcf4;
    background: #fbfdff;
}
.provider-rut-field [data-provider-name] {
    min-height: 56px;
    font-size: 16px;
}
.provider-rut-field [data-provider-rut]:focus {
    border-color: #0f6cbd;
    box-shadow: 0 0 0 5px rgba(15, 108, 189, .16), 0 1px 2px rgba(16, 24, 40, .05);
}
.provider-rut-field .provider-portal-button {
    min-height: 56px;
}
.provider-results {
    margin-top: 10px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 16px 32px rgba(15, 23, 42, .10);
    overflow: hidden;
}
.provider-result-option,
.provider-result-empty {
    width: 100%;
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid #edf2f7;
    background: #fff;
    text-align: left;
    color: #334155;
}
.provider-result-option {
    cursor: pointer;
}
.provider-result-option:hover,
.provider-result-option:focus {
    outline: none;
    background: #eef6ff;
}
.provider-result-option strong { color: #0f172a; font-size: 13px; }
.provider-result-option span,
.provider-result-empty { color: #64748b; font-size: 12px; }
.provider-summary {
    display: grid;
    gap: 4px;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #334155;
    font-size: 13px;
}
.provider-summary strong {
    color: #0f172a;
    font-size: 14px;
}
.provider-summary span { color: #475569; }
.work-description-lookup {
    display: grid;
    gap: 10px;
}
.work-description-selected {
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.contract-paper {
    position: relative;
    background: #fff;
    color: #111827;
    width: min(100%, 920px);
    max-width: 920px;
    margin: 0 auto;
    padding: 54px 58px;
    border: 1px solid #d1d5db;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .10);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.62;
}
.contract-paper.is-preview::before {
    content: "NO VALIDO";
    position: fixed;
    inset: 0;
    z-index: 3;
    display: grid;
    place-items: center;
    color: rgba(153, 27, 27, .13);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 112px;
    font-weight: 900;
    letter-spacing: .08em;
    transform: rotate(-28deg);
    pointer-events: none;
}
.contract-invalid-ribbon {
    position: absolute;
    top: 18px;
    left: 50%;
    z-index: 4;
    transform: translateX(-50%);
    padding: 7px 18px;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}
.print-screen {
    min-height: 100vh;
    padding: 28px 18px 44px;
    background: #dfe7f1;
}
.print-toolbar {
    width: min(100%, 816px);
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .08);
}
.print-toolbar strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
}
.print-toolbar span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}
.print-screen > .contract-paper {
    width: min(100%, 816px);
    min-height: 1056px;
    padding: 48px 54px 150px;
}
.contract-paper h1 {
    margin: 26px 0 24px;
    text-align: center;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}
.contract-paper h3 {
    margin: 26px 0 10px;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 15px;
    text-transform: uppercase;
    color: #0f172a;
}
.contract-paper p { margin: 0 0 12px; text-align: justify; }
.contract-paper ul, .contract-paper ol { margin: 8px 0 14px 24px; padding: 0; }
.contract-items-table {
    width: 100%;
    margin: 14px 0 18px;
    border-collapse: collapse;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.contract-items-table th,
.contract-items-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 9px;
    font-size: 11px;
    line-height: 1.35;
}
.contract-items-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 850;
    text-transform: uppercase;
}
.contract-items-table tfoot th {
    background: #eaf3ff;
}
.text-right { text-align: right; }
.contract-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding-bottom: 18px;
    border-bottom: 2px solid #0f172a;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.contract-doc-header img { width: 190px; max-width: 45%; height: auto; }
.contract-doc-header div { text-align: right; display: grid; gap: 3px; }
.contract-doc-header span, .contract-doc-header small { color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.contract-doc-header strong { color: #0755a3; font-size: 18px; }
.contract-doc-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-top: 18px;
    border: 1px solid #cbd5e1;
    background: #cbd5e1;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.contract-doc-meta div { background: #f8fafc; padding: 11px 12px; }
.contract-doc-meta span {
    display: block;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.contract-doc-meta strong { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; }
.contract-doc-body { min-height: 360px; }
.contract-page-continuation {
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #cbd5e1;
    color: #64748b;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}
.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 42px;
    margin-top: 86px;
    break-inside: avoid;
}
.signature-box {
    min-height: 92px;
    padding-top: 16px;
    border-top: 1.5px solid #111827;
    text-align: center;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.signature-box span { display: block; color: #475569; font-size: 12px; }
.signature-box strong { display: block; margin-top: 4px; font-size: 13px; }
.signature-box small { display: block; margin-top: 3px; color: #475569; font-size: 11px; font-weight: 750; }
.print-signature-fixed { display: none; }
.print-footer { margin-top: 60px; border-top: 1px solid #111827; padding-top: 12px; font-size: 12px; color: #374151; }
.invalid-footer { color: #991b1b; font-weight: 850; }
.wysiwyg {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.wysiwyg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}
.wysiwyg-toolbar button {
    min-width: 34px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
}
.wysiwyg-toolbar button:hover {
    border-color: #cbd5e1;
    background: #fff;
}
.wysiwyg-surface {
    min-height: 190px;
    padding: 14px;
    outline: 0;
    line-height: 1.6;
}
.wysiwyg-surface:focus { box-shadow: inset 0 0 0 3px rgba(13, 110, 253, .12); }
.wysiwyg-surface p { margin: 0 0 10px; }
.wysiwyg-surface h3 { margin: 16px 0 8px; font-size: 16px; }
.wysiwyg-input { display: none; }
.variable-panel {
    display: grid;
    gap: 12px;
    padding: 13px;
    margin-bottom: 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}
.variable-group strong {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.variable-list { display: flex; flex-wrap: wrap; gap: 8px; }
.variable-chip {
    border: 1px solid #b7d4f6;
    border-radius: 999px;
    background: #eef6ff;
    color: var(--blue);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    user-select: none;
}
.variable-chip:hover { background: #dbeafe; }
.variable-chip:active { cursor: grabbing; }
.editor-textarea {
    min-height: 180px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.clause-list { display: grid; gap: 16px; }
.clause-editor {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.compact-check { margin: 0; }
.type-picker { width: min(360px, 100%); }
.add-clause-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 14px;
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 16px;
}
.add-clause-row .field { margin-bottom: 0; }
.draggable-row {
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.draggable-row.is-dragging {
    opacity: .55;
    border-color: #9bc4ef;
}
.drag-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    cursor: grab;
    font-weight: 900;
    letter-spacing: -2px;
}
.editor-preview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 43%);
    gap: 18px;
    align-items: start;
}
.type-version-picker {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(150px, .6fr);
    gap: 10px;
    width: min(520px, 100%);
}
.version-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
}
.version-strip span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #f8fbff;
    color: #475569;
    padding: 7px 11px;
    font-size: 12px;
}
.version-strip strong { color: var(--blue); }
.version-strip .status-pill-success {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}
.version-strip .status-pill-danger {
    border-color: #fecaca;
    background: #fee2e2;
    color: #991b1b;
}
.version-strip .status-pill-success strong,
.version-strip .status-pill-danger strong {
    color: inherit;
}
.type-status-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.type-status-panel .field-help { flex-basis: 100%; }
.template-builder-grid {
    display: grid;
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(360px, 41%);
    gap: 18px;
    align-items: start;
}
.builder-library {
    position: sticky;
    top: 128px;
    max-height: calc(100vh - 150px);
    overflow: auto;
}
.library-list { display: grid; gap: 10px; }
.library-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: grab;
}
.library-item:hover {
    border-color: #9bc4ef;
    background: #f8fbff;
}
.library-item strong { color: #0f172a; }
.library-item span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.builder-sheet-card { min-width: 0; }
.template-sheet {
    min-height: 520px;
    padding: 16px;
    border: 1px dashed #b7c6d8;
    border-radius: 8px;
    background: #f8fafc;
}
.template-part {
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.part-summary {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.part-edit-panel {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.template-part.is-editing .part-edit-panel { display: block; }
.sheet-empty {
    display: grid;
    place-items: center;
    min-height: 180px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    background: rgba(255,255,255,.72);
    font-weight: 750;
    text-align: center;
}
.contract-preview-sticky {
    position: sticky;
    top: 128px;
    display: grid;
    gap: 12px;
}
.preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.contract-preview-pages {
    display: grid;
    gap: 18px;
    max-height: calc(100vh - 210px);
    overflow: auto;
}
.contract-preview-paper {
    width: 100%;
    aspect-ratio: 8.5 / 11;
    padding: 34px;
    transform-origin: top center;
    min-height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.contract-preview-paper.is-measuring {
    position: absolute;
    left: -9999px;
    top: 0;
    visibility: hidden;
    pointer-events: none;
}
.contract-preview-paper .contract-doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.contract-preview-paper h1 { font-size: 19px; }
.contract-preview-paper .contract-doc-header img { width: 145px; }
.contract-preview-paper .contract-doc-body {
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.contract-preview-paper .signature-grid { gap: 24px; margin-top: auto; padding-top: 34px; }
.preview-clause-section { break-inside: avoid; page-break-inside: avoid; }

@media print {
    @page { size: Letter; margin: 12mm 14mm 36mm; }
    body { background: #fff; }
    .print-screen { padding: 0; background: #fff; }
    .no-print { display: none !important; }
    .contract-paper {
        border: 0;
        box-shadow: none;
        padding: 0;
        width: 100%;
        max-width: none;
        font-size: 10pt;
        line-height: 1.45;
    }
    .contract-paper.is-preview::before {
        position: fixed;
        color: rgba(153, 27, 27, .18);
        font-size: 58pt;
    }
    .contract-invalid-ribbon {
        position: fixed;
        top: 5mm;
        font-size: 8pt;
    }
    .contract-paper h1 { font-size: 15pt; margin: 16px 0 14px; }
    .contract-paper h3 { font-size: 10pt; margin: 16px 0 7px; }
    .contract-paper p { margin-bottom: 8px; }
    .contract-items-table th,
    .contract-items-table td {
        padding: 5px 6px;
        font-size: 7.8pt;
    }
    .contract-doc-header { padding-bottom: 10px; }
    .contract-doc-header img { width: 145px; }
    .contract-doc-header span,
    .contract-doc-header small { font-size: 7.5pt; }
    .contract-doc-header strong { font-size: 11pt; }
    .contract-doc-meta { margin-top: 10px; }
    .contract-doc-meta div { padding: 7px 8px; }
    .contract-doc-meta span { font-size: 7pt; }
    .contract-doc-meta strong { font-size: 8.5pt; }
    .contract-doc-body { min-height: 0; }
    .print-signature-block { display: none; }
    .print-signature-fixed {
        display: grid;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 9mm;
        gap: 26px;
        margin: 0;
        background: #fff;
    }
    .signature-box {
        min-height: 48px;
        padding-top: 8px;
    }
    .signature-box span { font-size: 8pt; }
    .signature-box strong { font-size: 8.5pt; }
    .signature-box small { font-size: 7.5pt; }
    .print-footer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 3mm;
        margin: 0;
        padding-top: 4px;
        font-size: 7.5pt;
        background: #fff;
    }
    .preview-print-mode .app-shell > .sidebar,
    .preview-print-mode .topbar,
    .preview-print-mode .content > :not(.template-builder-grid),
    .preview-print-mode .template-builder-grid > :not(.contract-preview-sticky),
    .preview-print-mode .preview-actions {
        display: none !important;
    }
    .preview-print-mode .app-shell { display: block; }
    .preview-print-mode .content { padding: 0; }
    .preview-print-mode .template-builder-grid { display: block; }
    .preview-print-mode .contract-preview-sticky { position: static; display: block; }
    .preview-print-mode .contract-preview-pages {
        max-height: none;
        overflow: visible;
        display: block;
    }
    .preview-print-mode .contract-preview-paper {
        height: calc(11in - 48mm);
        min-height: calc(11in - 48mm);
        padding: 0;
        aspect-ratio: auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        break-after: page;
    }
    .preview-print-mode .contract-preview-paper .contract-doc-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }
    .preview-print-mode .contract-preview-paper .signature-grid {
        margin-top: auto;
        padding-top: 8mm;
    }
    .preview-print-mode .contract-preview-paper:last-child { break-after: auto; }
}

@media (max-width: 980px) {
    .auth-shell, .app-shell { grid-template-columns: 1fr; }
    .auth-visual { min-height: 360px; padding: 34px; }
    .hero-brand { letter-spacing: .4em; }
    .sidebar { position: relative; height: auto; }
	    .grid-2, .grid-3, .grid-4, .form-grid, .approval-meta-grid, .checkbox-grid, .stage-summary, .settlement-approvals, .settlement-meta-grid, .type-feature-grid { grid-template-columns: 1fr; }
	    .form-grid .span-2 { grid-column: auto; }
    .stage-head { grid-template-columns: auto minmax(0, 1fr); }
    .stage-head > .badge { grid-column: 1 / -1; justify-self: start; }
    .trace-print-row { grid-template-columns: 1fr; }
    .settlement-close-actions { align-items: flex-start; flex-direction: column; }
	    .financial-row { grid-template-columns: 1fr; }
    .content { padding: 20px; }
    .topbar { min-height: 88px; padding: 16px 20px; align-items: flex-start; }
	    .topbar h1 { font-size: 19px; }
	    .section-head { align-items: flex-start; flex-direction: column; }
	    .dashboard-filter-form { grid-template-columns: 1fr; }
	    .section-head h2 { font-size: 22px; }
	    .provider-lookup-row { grid-template-columns: 1fr; }
	    .provider-portal-button { width: 100%; }
	    .add-clause-row { grid-template-columns: 1fr; align-items: stretch; }
    .editor-preview-layout { grid-template-columns: 1fr; }
    .template-builder-grid { grid-template-columns: 1fr; }
    .builder-library { position: static; max-height: none; }
    .type-version-picker { grid-template-columns: 1fr; }
    .contract-preview-sticky { position: static; }
    .contract-doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .signature-grid { grid-template-columns: 1fr; }
}

/* Dashboard v2 — alertas e indicadores */
.text-danger { color: #dc2626; }
.alert-list { list-style: none; margin: 0 0 14px; padding: 0; }
.alert-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.alert-list li:last-child { border-bottom: 0; }
.alert-list li span { color: var(--muted); font-size: 13px; }
.alert-list li strong { font-size: 18px; }

/* Listados v2 — barra de filtros */
.list-filter { margin-bottom: 16px; }
.filter-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-grid .field { min-width: 180px; flex: 1 1 180px; margin: 0; }
.field.no-margin { margin: 0; }

/* Aprobaciones v2 — acciones secundarias */
.approval-secondary-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .select { min-width: 160px; }

/* Mantenedores v2 */
.clause-meta { font-size: 12px; margin-bottom: 8px; }
.clause-preview { margin: 8px 0; }
.clause-preview summary { cursor: pointer; color: var(--brand, #0f6cbd); font-size: 13px; }
.clause-preview-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 8px; background: #fafbfc; font-size: 13px; }
.sync-info { margin: 14px 0; }

/* Expediente v2 — Integración SAP y acuse de retiro */
.sap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.withdrawal-receipt { display: flex; gap: 16px; align-items: center; margin-top: 14px; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; background: #fafbfc; }
.receipt-qr { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 96px; height: 96px; border: 2px solid #111827; border-radius: 8px; text-align: center; padding: 6px; }
.receipt-qr span { font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.receipt-qr strong { font-size: 12px; word-break: break-all; }
@media (max-width: 720px){ .sap-grid { grid-template-columns: 1fr 1fr; } }

/* Acuse de retiro — QR */
.receipt-qr-img { width: 110px; height: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }

/* Acuse de recibo público (sin login) */
.text-ok { color: #16a34a; }
.receipt-page { background: #eef2f6; min-height: 100vh; margin: 0; }
.receipt-shell { max-width: 520px; margin: 0 auto; padding: 40px 16px; }
.receipt-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
.receipt-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 20px; }
.receipt-brand img { height: 44px; }
.receipt-brand span { font-weight: 600; color: #111827; }
.receipt-detail { display: grid; gap: 10px; margin-bottom: 20px; }
.receipt-detail > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.receipt-detail span { color: var(--muted); font-size: 13px; }
.receipt-detail strong { text-align: right; font-size: 13px; }
.receipt-lead { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.receipt-form .field { margin-bottom: 12px; }
.receipt-form .check-row { margin: 12px 0 18px; }
.receipt-form .btn { width: 100%; }
.receipt-ok { text-align: center; padding: 18px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 12px; }
.receipt-ok h2 { color: #16a34a; margin: 0 0 8px; }
.receipt-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* Resumen de solicitud + revisión de notaría */
.request-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.request-summary > div { display: flex; flex-direction: column; gap: 3px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.request-summary > div.span-2 { grid-column: span 3; }
.request-summary span { color: var(--muted); font-size: 12px; }
.request-summary strong { font-size: 14px; }
.notary-review { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
@media (max-width: 820px){ .request-summary { grid-template-columns: 1fr 1fr; } .request-summary > div.span-2 { grid-column: span 2; } .notary-review { grid-template-columns: 1fr; } }

/* Bloqueo de etapas hasta la revisión de Servicios Generales */
.contract-stage-list.is-review-locked { opacity: .55; pointer-events: none; filter: grayscale(0.3); }

/* Multiempresa: barra superior con selector de empresa y logo */
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { height: 40px; max-width: 160px; object-fit: contain; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.company-switcher { display: flex; align-items: center; gap: 8px; }
.company-switcher label { font-size: 12px; color: var(--muted); }
.company-switcher .select { min-width: 200px; }
.topbar-company { font-weight: 600; }
.company-head-brand { display: flex; align-items: center; gap: 12px; }
.company-logo-thumb { height: 40px; max-width: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }

/* Badge legacy / advertencia */
.badge-warn { background: #fef3c7; color: #b45309; }

/* Menú lateral v2 — familia Contratos + CTA destacado */
.sidebar { overflow-y: auto; }
.sidebar nav { display: flex; flex-direction: column; }
.nav-title:first-of-type { margin-top: 10px; }
.nav-title { position: relative; padding-top: 14px; border-top: 1px solid var(--line); margin: 18px 12px 8px; }
.nav-cta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--blue-2);
    color: #fff;
    font-weight: 800;
    letter-spacing: .01em;
    margin: 2px 0 6px;
    box-shadow: 0 8px 18px rgba(15, 108, 189, .30);
    transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
}
.nav-cta span { flex: 1; }
.nav-cta:hover { background: var(--blue); box-shadow: 0 10px 22px rgba(7, 85, 163, .34); }
.nav-cta:active { transform: translateY(1px); }
.nav-cta.active { background: var(--blue); }
.nav-cta .nav-icon { width: 20px; height: 20px; color: #fff; opacity: .95; }

/* Chips de documento en etapas + botón/modal Const. de Sociedad */
.stage-docs { margin: 10px 0 4px; }
.trace-heading { display: inline-flex; align-items: center; gap: 7px; }
.trace-heading svg { color: var(--blue, #2f6fed); flex: 0 0 auto; }
.type-flag-note { display: inline-flex; align-items: center; gap: 8px; color: #166534; font-size: 13.5px; }
.type-flag-note svg { color: #16a34a; flex: 0 0 auto; }
.type-flag-note strong { font-weight: 800; }
.doc-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f4f8ff; color: var(--blue); font-weight: 700; font-size: 13px; }
.doc-chip:hover { background: #e8f1ff; }
.doc-icon-btn { display: inline-flex; align-items: center; gap: 8px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal-overlay[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; width: min(920px, 100%); height: min(85vh, 900px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(15,23,42,.35); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head strong { flex: 1; }
.modal-close { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-doc { flex: 1; width: 100%; border: 0; }

/* Notarías/Proveedor: proveedor seleccionado desde el buscador */
.user-maintenance-card.is-selected { border: 2px solid var(--blue-2); box-shadow: 0 8px 20px rgba(15,108,189,.18); }

/* Versión imprimible: texto interior del contrato máximo 10px (el título centrado no se ve afectado) */
.contract-doc-body,
.contract-doc-body p,
.contract-doc-body li,
.contract-doc-body td,
.contract-doc-body th,
.contract-doc-body span,
.contract-doc-body div,
.contract-doc-body h1,
.contract-doc-body h2,
.contract-doc-body h3,
.contract-doc-body h4,
.contract-doc-body strong { font-size: 10px; line-height: 1.5; }

/* Filas tipo stripe (zebra) en los listados */
.table-wrap table tbody tr:nth-child(even) { background: #f7f9fc; }
.table-wrap table tbody tr:hover { background: #eef4fb; }

/* Bitácora de movimientos (trazabilidad) */
.audit-card .stage-head { margin-bottom: 14px; }
.audit-timeline { position: relative; padding-left: 6px; }
.audit-item { position: relative; display: flex; gap: 14px; padding: 0 0 16px 0; }
.audit-item:last-child { padding-bottom: 0; }
.audit-dot { position: relative; flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: #2f6fed; margin-top: 4px; box-shadow: 0 0 0 3px rgba(47,111,237,.15); }
.audit-item:not(:last-child) .audit-dot::after { content: ''; position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: 2px; height: calc(100% + 18px); background: #e3e8f0; }
.audit-body { flex: 1 1 auto; min-width: 0; }
.audit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.audit-head strong { font-size: 13.5px; color: #1f2a44; }
.audit-time { font-size: 12px; color: #6b7280; font-variant-numeric: tabular-nums; white-space: nowrap; }
.audit-detail { font-size: 12.5px; color: #3a4256; margin-top: 2px; }
.audit-meta { font-size: 11.5px; margin-top: 3px; }

/* Footer de la aplicación */
.app-footer {
    margin-top: 32px;
    padding: 18px 4px 8px;
    border-top: 1px solid #e6ebf2;
    color: var(--muted, #64748b);
    font-size: 12.5px;
    text-align: center;
}
.app-footer strong { color: #334155; font-weight: 800; }

/* Modales anchos y con scroll (listados extensos) */
.modal-box.modal-wide { width: min(960px, 94vw); }
.modal-box.modal-form { height: auto; max-height: min(85vh, 900px); }
.modal-scroll { flex: 1; overflow: auto; padding: 12px 18px 18px; }
.modal-scroll table { width: 100%; }
.modal-box.modal-form form { padding: 16px 18px 18px; overflow: auto; }

/* Data-table: filtros por columna + orden */
.dt-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.dt-sortable:hover { color: var(--blue, #2f6fed); }
.dt-sortable[data-dir]::after { content: ' ▲'; font-size: 9px; opacity: .8; }
.dt-sortable[data-dir="desc"]::after { content: ' ▼'; }
.dt-filter-row th { padding: 4px 8px 8px; background: #f7f9fc; }
.dt-filter {
    width: 100%;
    min-width: 70px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 500;
    background: #fff;
}
.dt-filter:focus { outline: none; border-color: var(--blue, #2f6fed); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }

/* Pill de estado con color de fondo y texto por contraste */
.status-pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
}

/* Cabecera de acciones del expediente: utilidades a la izquierda, CTA + eliminar a la derecha */
.detail-actions { align-items: center; row-gap: 8px; }
.detail-actions .push-right { margin-left: auto; }
@media (max-width: 720px) {
    .detail-actions .push-right { margin-left: 0; }
}

/* Diálogo del sistema (confirm/alert propios) */
.app-dialog {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(15, 23, 42, .5);
    --dlg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}
.app-dialog[hidden] { display: none; }
.app-dialog-box {
    width: min(460px, 100%); background: #fff; border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
    padding: 22px 22px 18px;
    display: grid; grid-template-columns: auto 1fr; gap: 6px 15px;
    animation: dlgIn .16s ease;
}
@keyframes dlgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.app-dialog-icon {
    grid-row: 1 / span 2; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; background: #eff6ff; color: #2563eb;
}
.app-dialog-icon::before {
    content: ''; width: 24px; height: 24px; background-color: currentColor;
    -webkit-mask: var(--dlg-icon) center / contain no-repeat;
    mask: var(--dlg-icon) center / contain no-repeat;
}
.app-dialog.is-danger { --dlg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2 1 21h22L12 2zm1 15h-2v-2h2v2zm0-4h-2V9h2v4z'/%3E%3C/svg%3E"); }
.app-dialog.is-danger .app-dialog-icon { background: #fef2f2; color: #dc2626; }
.app-dialog.is-alert { --dlg-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.6-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4-7 7z'/%3E%3C/svg%3E"); }
.app-dialog.is-alert .app-dialog-icon { background: #f0fdf4; color: #16a34a; }
.app-dialog-title { grid-column: 2; margin: 3px 0 0; font-size: 16px; font-weight: 850; color: #0f172a; }
.app-dialog-message { grid-column: 2; margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: #475569; }
.app-dialog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Fila de radios (destinatario de notificación) */
.radio-row { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 4px; }
.radio-row .check-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #334155; }

/* Buscador dentro de modales (listas largas) */
.modal-searchbar { padding: 12px 18px 0; }
.modal-searchbar .input { width: 100%; }

/* Menú "Más acciones" del expediente */
.detail-actions { align-items: center; gap: 8px; }
.detail-actions > .btn, .detail-actions .action-menu > summary { padding: 9px 15px; font-size: 13.5px; }
.action-menu { position: relative; }
.action-menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > summary { background: #eef4fb; border-color: #b7d4f6; }
.action-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
    min-width: 210px; background: #fff; border: 1px solid var(--line);
    border-radius: 10px; box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
    padding: 6px; display: grid; gap: 2px;
}
.action-menu-panel form { margin: 0; }
.action-menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; box-sizing: border-box;
    padding: 9px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 650;
    color: #334155; background: none; border: 0; cursor: pointer; text-decoration: none;
}
.action-menu-item svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .8; }
.action-menu-item:hover { background: #f1f5f9; }
.action-menu-item.is-danger { color: #dc2626; }
.action-menu-item.is-danger:hover { background: #fef2f2; }
.action-menu-item.is-disabled { color: #94a3b8; cursor: default; }
.action-menu-item.is-disabled:hover { background: none; }
.action-menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }

/* Cabecera del expediente: botones arriba, luego proveedor y obra */
.detail-head { flex-direction: column; align-items: stretch; gap: 14px; }
.detail-head .detail-actions { justify-content: flex-end; flex-wrap: wrap; }
.detail-head-title h2 { margin: 0; }
.detail-head-title .muted { margin-top: 2px; }
