:root {
    --ink: #162033;
    --muted: #667085;
    --line: #e4e7ec;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --navy: #101828;
    --navy-2: #1d2939;
    --accent: #e94f37;
    --accent-dark: #c83b27;
    --success: #16794b;
    --success-soft: #eaf8f0;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --shadow: 0 24px 70px rgba(16, 24, 40, .12);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--surface-soft);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

a { color: inherit; text-decoration: none; }

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

.muted { color: var(--muted); }

/* Login */
.login-page {
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(circle at 15% 15%, rgba(233, 79, 55, .18), transparent 30%),
        linear-gradient(135deg, #0b1220 0%, #101828 48%, #1d2939 100%);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
    width: min(1100px, 100%);
    min-height: 650px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 28px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .38);
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 72px;
    color: #fff;
    background:
        linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,255,255,0)),
        #121b2d;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -150px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(233,79,55,.45);
    border-radius: 50%;
    box-shadow:
        0 0 0 48px rgba(233,79,55,.04),
        0 0 0 96px rgba(233,79,55,.025);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin-bottom: 38px;
    border-radius: 17px;
    color: #fff;
    background: var(--accent);
    font-size: 32px;
    font-weight: 900;
    box-shadow: 0 14px 34px rgba(233, 79, 55, .35);
}

.login-brand h1 {
    max-width: 560px;
    margin: 0;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.02;
    letter-spacing: -.045em;
}

.login-brand-copy {
    max-width: 500px;
    margin: 24px 0 44px;
    color: #cbd5e1;
    font-size: 17px;
    line-height: 1.7;
}

.login-points {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

.login-points div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-points span {
    color: #fda495;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

.login-points p {
    margin: 0;
    color: #e5e7eb;
    font-size: 14px;
}

.login-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.login-card-header,
.login-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 34px;
    color: var(--muted);
    font-size: 12px;
    border-bottom: 1px solid var(--line);
}

.login-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: #12b76a;
    box-shadow: 0 0 0 5px rgba(18,183,106,.12);
}

.login-card-header { justify-content: flex-start; }

.login-card-body {
    width: min(410px, calc(100% - 56px));
    margin: auto;
    padding: 54px 0;
}

.login-card-body h2 {
    margin: 0 0 8px;
    color: var(--navy);
    font-size: 36px;
    letter-spacing: -.035em;
}

.login-form {
    display: grid;
    gap: 12px;
    margin-top: 34px;
}

.login-form label {
    margin-top: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(233,79,55,.12);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 12px !important;
    font-weight: 500 !important;
}

.check-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 750;
    transition: transform .15s, background .15s, box-shadow .15s;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 12px 24px rgba(233,79,55,.2);
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-ghost {
    color: #d0d5dd;
    background: rgba(255,255,255,.07);
}

.btn-ghost:hover { background: rgba(255,255,255,.12); }

.btn-block { width: 100%; }

.alert {
    margin: 20px 0 0;
    padding: 13px 15px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.45;
}

.alert-error { color: var(--danger); background: var(--danger-soft); }
.alert-success { color: var(--success); background: var(--success-soft); }

/* Application */
.app-shell {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 26px 20px 20px;
    color: #f8fafc;
    background: var(--navy);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 26px;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.brand-mark-small {
    width: 42px;
    height: 42px;
    margin: 0;
    border-radius: 12px;
    font-size: 21px;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand strong {
    font-size: 15px;
    letter-spacing: .08em;
}

.sidebar-brand small {
    margin-top: 3px;
    color: #98a2b3;
    font-size: 11px;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    margin-top: 26px;
}

.nav-label {
    margin: 0 10px 8px;
    color: #667085;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
}

.nav-label-spaced { margin-top: 22px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: #d0d5dd;
    font-size: 13px;
    font-weight: 650;
}

.nav-item.active {
    color: #fff;
    background: rgba(233,79,55,.16);
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item small {
    margin-left: auto;
    color: #667085;
    font-size: 9px;
    text-transform: uppercase;
}

.nav-item-disabled { cursor: default; opacity: .72; }

.nav-icon {
    display: grid;
    place-items: center;
    width: 24px;
    color: #98a2b3;
    font-size: 17px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.09);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    color: #fff;
    background: #344054;
    font-weight: 800;
}

.user-mini strong,
.user-mini small {
    display: block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-mini strong { font-size: 12px; }
.user-mini small { margin-top: 3px; color: #98a2b3; font-size: 10px; }

.main-content { min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 104px;
    padding: 24px 40px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -.025em;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 12px;
}

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    color: var(--success);
    background: var(--success-soft);
    border-radius: 999px;
    font-weight: 700;
}

.live-pill i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #12b76a;
}

.content-area {
    display: grid;
    gap: 24px;
    padding: 32px 40px 50px;
}

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 32px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 90% 10%, rgba(233,79,55,.32), transparent 30%),
        var(--navy-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.welcome-panel h2 {
    margin: 0 0 10px;
    font-size: 30px;
    letter-spacing: -.035em;
}

.welcome-panel p:not(.eyebrow) {
    max-width: 720px;
    margin: 0;
    color: #cbd5e1;
    line-height: 1.65;
}

.welcome-badge {
    min-width: 190px;
    padding: 18px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
}

.welcome-badge strong,
.welcome-badge span { display: block; }

.welcome-badge span {
    margin-top: 4px;
    color: #98a2b3;
    font-size: 11px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.kpi-card,
.roadmap-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(16,24,40,.055);
}

.kpi-card {
    position: relative;
    padding: 24px;
}

.kpi-index {
    position: absolute;
    top: 20px;
    right: 22px;
    color: #d0d5dd;
    font-size: 11px;
    font-weight: 800;
}

.kpi-card p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.kpi-card strong {
    display: block;
    margin-bottom: 14px;
    font-size: 34px;
    letter-spacing: -.04em;
}

.kpi-card small {
    display: block;
    color: var(--muted);
    line-height: 1.5;
}

.status-text { color: var(--success); font-size: 25px !important; }

.roadmap-card { padding: 28px; }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.section-heading h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -.025em;
}

.progress-label {
    padding: 8px 11px;
    color: #475467;
    background: #f2f4f7;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.roadmap-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding-top: 22px;
}

.roadmap-item {
    display: flex;
    gap: 12px;
    min-height: 86px;
    padding: 15px;
    background: #f9fafb;
    border: 1px solid #eaecf0;
    border-radius: 13px;
}

.roadmap-item > span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    color: #475467;
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 800;
}

.roadmap-item strong,
.roadmap-item small { display: block; }

.roadmap-item strong { margin: 2px 0 5px; font-size: 13px; }
.roadmap-item small { color: var(--muted); line-height: 1.4; }

.roadmap-item.done { background: var(--success-soft); border-color: #c9ead8; }
.roadmap-item.done > span { color: #fff; background: var(--success); border-color: var(--success); }

.roadmap-item.current { background: #fff7f5; border-color: #ffd7cf; }
.roadmap-item.current > span { color: #fff; background: var(--accent); border-color: var(--accent); }

@media (max-width: 980px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-card { min-height: 620px; }
    .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
    .sidebar { padding-inline: 14px; }
    .sidebar-brand > span:last-child,
    .nav-label,
    .nav-item:not(.active) small,
    .nav-item { font-size: 0; }
    .nav-item { justify-content: center; }
    .nav-icon { font-size: 18px; }
    .user-mini > div:last-child { display: none; }
    .user-mini { justify-content: center; }
    .kpi-grid,
    .roadmap-list { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .login-page { padding: 0; }
    .login-shell { min-height: 100vh; border-radius: 0; border: 0; }
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; }
    .sidebar-nav, .sidebar-footer { display: none; }
    .topbar { align-items: flex-start; padding: 22px; }
    .topbar-meta { display: none; }
    .content-area { padding: 20px; }
    .welcome-panel { align-items: flex-start; flex-direction: column; }
    .welcome-badge { width: 100%; }
}


/* R2 Maestros Comerciales */
.alert-floating { margin: 0; }
.alert ul { margin: 8px 0 0 18px; padding: 0; }

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.page-actions h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.025em; }
.page-actions p { margin: 0; color: var(--muted); font-size: 13px; }

.btn-secondary {
    color: #344054;
    background: #fff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 2px 4px rgba(16,24,40,.04);
}
.btn-secondary:hover { background: #f9fafb; }
.btn-link { min-height: 36px; padding: 0 8px; color: var(--accent); background: transparent; }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 12px; }

.kpi-grid-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-card { color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.kpi-card:hover { transform: translateY(-2px); border-color: #d0d5dd; box-shadow: 0 16px 36px rgba(16,24,40,.09); }
.kpi-warning { border-color: #f9dbaf; background: #fffbeb; }
.kpi-warning strong { color: #b54708; }

.entity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.entity-card {
    padding: 26px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(16,24,40,.055);
}
.entity-card.is-inactive { opacity: .7; }
.entity-card-head { display: flex; gap: 15px; align-items: flex-start; }
.entity-logo {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    color: #fff;
    background: var(--navy);
    border-radius: 13px;
    font-size: 20px;
    font-weight: 900;
}
.entity-card h3 { margin: 8px 0 3px; font-size: 19px; }
.entity-card p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 22px;
    margin: 24px 0;
    padding: 18px 0;
    border-block: 1px solid var(--line);
}
.detail-list dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.detail-list dd { margin: 5px 0 0; font-size: 13px; font-weight: 650; }
.entity-card-actions { display: flex; justify-content: flex-end; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.badge-success { color: #067647; background: #ecfdf3; }
.badge-neutral { color: #475467; background: #f2f4f7; }
.badge-warning { color: #b54708; background: #fffaeb; }
.badge-accent { color: #c43220; background: #fff1ed; }

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(16,24,40,.04);
}
.search-field {
    display: flex;
    align-items: center;
    flex: 1 1 420px;
    min-width: 240px;
    height: 44px;
    border: 1px solid #d0d5dd;
    border-radius: 11px;
    background: #fff;
}
.search-field span { padding-left: 14px; color: #98a2b3; font-size: 20px; }
.search-field input { width: 100%; height: 100%; padding: 0 13px; border: 0; outline: none; background: transparent; }
.filter-bar select {
    height: 44px;
    padding: 0 34px 0 12px;
    color: #344054;
    border: 1px solid #d0d5dd;
    border-radius: 11px;
    background: #fff;
}
.filter-check { display: flex; align-items: center; gap: 8px; color: #475467; font-size: 12px; white-space: nowrap; }
.filter-check input { width: 16px; height: 16px; accent-color: var(--accent); }

.table-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(16,24,40,.055);
}
.table-summary {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 20px;
    color: var(--muted);
    background: #f9fafb;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    font-weight: 700;
}
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 13px 16px;
    color: #667085;
    background: #fff;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.data-table td { padding: 15px 16px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; font-size: 12px; }
.data-table tbody tr:hover { background: #fcfcfd; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td strong, .data-table td small { display: block; }
.data-table td strong { color: #1d2939; font-size: 12px; }
.data-table td small { margin-top: 4px; color: #98a2b3; font-size: 10px; }
.row-muted { opacity: .62; }
.row-note { display: block; margin-top: 6px; color: #b54708; font-size: 10px; }
.align-right { text-align: right !important; }
.money { font-weight: 800; font-variant-numeric: tabular-nums; }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; }
.row-actions form { margin: 0; }

.pagination { display: flex; justify-content: flex-end; gap: 6px; padding: 16px 20px; background: #fff; border-top: 1px solid var(--line); }
.page-link {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    color: #475467;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
}
.page-link.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.page-link.disabled { color: #d0d5dd; background: #f9fafb; }

.form-card {
    width: min(1100px, 100%);
    margin: 0 auto;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 16px 42px rgba(16,24,40,.07);
}
.form-card-narrow { width: min(820px, 100%); }
.form-section { padding: 28px 30px; border-bottom: 1px solid var(--line); }
.form-section-heading { display: flex; gap: 13px; margin-bottom: 22px; }
.form-section-heading > span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: #fff;
    background: var(--navy);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 900;
}
.form-section-heading h2 { margin: 0 0 4px; font-size: 18px; }
.form-section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #344054; font-size: 11px; font-weight: 800; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    outline: none;
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(233,79,55,.1); }
.field-span-2 { grid-column: span 2; }
.switch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.switch-field {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #eaecf0;
    border-radius: 11px;
}
.switch-field input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--accent); }
.switch-field strong, .switch-field small { display: block; }
.switch-field strong { font-size: 12px; }
.switch-field small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 30px; background: #f9fafb; }
.legacy-banner, .review-banner {
    margin: 20px 30px 0;
    padding: 13px 15px;
    color: #475467;
    background: #f2f4f7;
    border-radius: 11px;
    font-size: 12px;
}
.review-banner { color: #b54708; background: #fffaeb; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }

@media (max-width: 1250px) {
    .kpi-grid-five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .entity-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar { flex-wrap: wrap; }
}
@media (max-width: 680px) {
    .page-actions { align-items: stretch; flex-direction: column; }
    .page-actions .btn { width: 100%; }
    .kpi-grid-five { grid-template-columns: 1fr; }
    .form-grid, .switch-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: auto; }
    .form-section { padding: 22px 18px; }
    .form-actions { padding: 18px; }
    .filter-bar > * { width: 100%; }
    .filter-bar select { width: 100%; }
    .detail-list { grid-template-columns: 1fr; }
}

/* R2.1 Clientes jurídicos y sucursales */
.branches-panel {
    display: grid;
    gap: 20px;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(16, 24, 40, .055);
}

.page-actions.compact {
    margin: 0;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}

.branch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.branch-card {
    display: flex;
    flex-direction: column;
    min-height: 270px;
    padding: 22px;
    background: #f9fafb;
    border: 1px solid #e4e7ec;
    border-radius: 15px;
}

.branch-card-inactive {
    opacity: .66;
    background: #f2f4f7;
}

.branch-card-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e7ec;
}

.branch-card h3 {
    margin: 0 0 9px;
    color: var(--navy);
    font-size: 17px;
}

.branch-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-info {
    color: #175cd3;
    background: #eff8ff;
}

.branch-code {
    color: #98a2b3;
    font-size: 11px;
    font-weight: 800;
}

.branch-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin: 18px 0;
}

.branch-details div {
    min-width: 0;
}

.branch-details dt {
    margin-bottom: 4px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.branch-details dd {
    margin: 0;
    color: #344054;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.branch-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.branch-empty {
    grid-column: 1 / -1;
}

.context-banner {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(180px, .7fr);
    gap: 16px;
    padding: 20px 24px;
    color: #fff;
    background: var(--navy-2);
    border-radius: 15px;
}

.context-banner div {
    display: grid;
    gap: 4px;
}

.context-banner span {
    color: #98a2b3;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.context-banner strong {
    font-size: 15px;
}

[data-chile-location-form] select:disabled {
    color: #98a2b3;
    cursor: not-allowed;
    background: #f2f4f7;
}

@media (max-width: 900px) {
    .branch-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .branches-panel {
        padding: 20px;
    }

    .branch-details,
    .context-banner {
        grid-template-columns: 1fr;
    }
}

/* HF1: presentación chilena del RUT */
.rut-input {
    text-align: right;
    font-variant-numeric: tabular-nums;
    letter-spacing: .035em;
    font-weight: 750;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: #667085;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}


/* R2.1 HF2 — orden visual del formulario de clientes */
.customer-form {
    width: min(1080px, 100%);
}

.customer-form .form-section {
    padding: 30px;
}

.customer-form .form-section-heading {
    margin-bottom: 24px;
}

.customer-grid {
    display: grid;
    gap: 18px;
    align-items: start;
}

.customer-grid + .customer-grid {
    margin-top: 18px;
}

.customer-grid-identity {
    grid-template-columns: minmax(240px, .82fr) minmax(0, 1.75fr);
}

.customer-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.customer-grid-bottom {
    grid-template-columns: minmax(0, 2fr) minmax(235px, .85fr);
}

.customer-form .field {
    align-self: start;
    align-content: start;
}

.customer-form .field input,
.customer-form .field select {
    height: 46px;
    min-height: 46px;
}

.customer-form .field textarea {
    min-height: 122px;
}

.customer-form .rut-input {
    font-size: 15px;
}

.customer-form .field-help {
    min-height: 16px;
    margin-top: 2px;
}

.customer-active-switch {
    min-height: 122px;
    height: 100%;
    padding: 18px;
    align-items: center;
}

.customer-form .form-actions {
    padding: 20px 30px;
}

@media (max-width: 900px) {
    .customer-grid-identity,
    .customer-grid-three,
    .customer-grid-bottom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .customer-grid-three .field:last-child,
    .customer-grid-bottom .field:first-child {
        grid-column: 1 / -1;
    }

    .customer-active-switch {
        min-height: 72px;
    }
}

@media (max-width: 680px) {
    .customer-form .form-section {
        padding: 22px 18px;
    }

    .customer-grid-identity,
    .customer-grid-three,
    .customer-grid-bottom {
        grid-template-columns: 1fr;
    }

    .customer-grid-three .field:last-child,
    .customer-grid-bottom .field:first-child {
        grid-column: auto;
    }

    .customer-form .form-actions {
        flex-direction: column-reverse;
        padding: 18px;
    }

    .customer-form .form-actions .btn {
        width: 100%;
    }
}

/* R3.1 Motor de cotizaciones */
.kpi-grid-four{grid-template-columns:repeat(4,minmax(0,1fr))}
.welcome-action{color:#fff;cursor:pointer;transition:.15s}.welcome-action:hover{transform:translateY(-2px);background:rgba(255,255,255,.12)}
.quote-summary-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}
.quote-summary-grid article{padding:18px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 8px 24px rgba(16,24,40,.045)}
.quote-summary-grid span,.quote-summary-grid strong{display:block}.quote-summary-grid span{margin-bottom:8px;color:var(--muted);font-size:11px;font-weight:800;text-transform:uppercase}.quote-summary-grid strong{font-size:23px}
.quote-filter{grid-template-columns:minmax(280px,1.5fr) minmax(170px,.8fr) minmax(160px,.7fr) auto}.quote-table td{vertical-align:middle}.quote-money{white-space:nowrap;font-weight:850}
.quote-status{display:inline-flex;align-items:center;min-height:27px;padding:0 10px;border-radius:999px;font-size:11px;font-weight:850;white-space:nowrap}
.quote-status-draft{color:#475467;background:#f2f4f7}.quote-status-sent{color:#175cd3;background:#eff8ff}.quote-status-client_review{color:#854a0e;background:#fff8eb}.quote-status-awarded{color:#067647;background:#ecfdf3}.quote-status-lost{color:#b42318;background:#fef3f2}.quote-status-cancelled{color:#344054;background:#e4e7ec}.quote-status-expired{color:#b54708;background:#fffaeb}
.quotation-editor{display:grid;gap:18px;padding-bottom:88px}.quote-document{padding:26px;background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 10px 30px rgba(16,24,40,.05)}
.quote-document-head,.quote-section-title,.quote-view-actions,.quote-view-header,.quote-view-bottom{display:flex;align-items:center;justify-content:space-between;gap:20px}
.quote-document-head{margin-bottom:22px;padding-bottom:20px;border-bottom:1px solid var(--line)}.quote-document-head h2,.quote-section-title h2{margin:0;color:var(--navy)}.quote-document-head h2{font-size:25px}.quote-section-title h2{font-size:20px}
.quote-section-title{justify-content:flex-start;margin-bottom:22px}.quote-section-title>span{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;color:#fff;background:var(--navy);border-radius:10px;font-size:11px;font-weight:900}
.quote-section-title p{margin:4px 0 0;color:var(--muted);font-size:12px}.quote-section-title-actions{display:flex;align-items:center;gap:20px}
.quote-grid{display:grid;gap:16px}.quote-grid-four{grid-template-columns:repeat(4,minmax(0,1fr))}.quote-grid-three{grid-template-columns:repeat(3,minmax(0,1fr))}
.quote-duplicate-check{display:flex;align-items:flex-start;gap:9px;margin-top:15px;color:#667085;font-size:12px}.quote-duplicate-check input{margin-top:2px;accent-color:var(--accent)}
.customer-picker{display:grid;grid-template-columns:minmax(290px,1.2fr) minmax(260px,1fr) minmax(260px,.9fr);gap:16px;align-items:stretch}.customer-search-field{position:relative}
.lookup-results{position:absolute;z-index:80;top:calc(100% + 7px);left:0;right:0;max-height:330px;overflow-y:auto;background:#fff;border:1px solid #d0d5dd;border-radius:13px;box-shadow:0 20px 60px rgba(16,24,40,.18)}
.lookup-row{display:flex;align-items:center;justify-content:space-between;gap:15px;width:100%;min-height:60px;padding:11px 13px;color:var(--ink);text-align:left;background:#fff;border:0;border-bottom:1px solid #eaecf0;cursor:pointer}
.lookup-row:last-child{border-bottom:0}.lookup-row:hover,.lookup-row:focus{background:#f9fafb;outline:none}.lookup-row span,.lookup-row strong,.lookup-row small{display:block}.lookup-row>span:last-child{text-align:right;color:#667085;font-size:11px}.lookup-row small{margin-top:3px;color:#98a2b3;font-size:10px}.lookup-empty{padding:22px;color:var(--muted);text-align:center;font-size:12px}
.customer-selected-card{display:flex;flex-direction:column;justify-content:center;min-height:78px;padding:15px;background:#f8fafc;border:1px solid #e4e7ec;border-radius:12px}.customer-selected-card strong,.customer-selected-card span,.customer-selected-card small{display:block}.customer-selected-card span{margin-top:3px;color:var(--accent);font-size:12px;font-weight:800}.customer-selected-card small{margin-top:7px;color:var(--muted);line-height:1.4}.quote-grid-contact{margin-top:18px}
.product-search-wrap{position:relative;display:grid;grid-template-columns:minmax(240px,1fr) auto;gap:10px;width:min(600px,100%);margin-left:auto}.product-search-wrap>input{height:44px;padding:0 14px;border:1px solid #d0d5dd;border-radius:11px}.product-results{top:51px;right:100px}
.quote-items-scroll{overflow-x:auto;border:1px solid #e4e7ec;border-radius:13px}.quote-items-table{width:100%;min-width:980px;border-collapse:collapse}.quote-items-table th{padding:12px 10px;color:#667085;text-align:left;background:#f8fafc;border-bottom:1px solid #e4e7ec;font-size:10px;text-transform:uppercase}.quote-items-table td{padding:10px;vertical-align:top;border-bottom:1px solid #eaecf0}
.quote-items-table input,.quote-items-table textarea{width:100%;padding:9px 10px;color:var(--ink);background:#fff;border:1px solid #d0d5dd;border-radius:9px}.quote-items-table textarea{margin-top:6px;resize:vertical}.quote-items-table td>small{display:block;margin-top:5px;color:#98a2b3;font-size:9px}.quote-line-number{text-align:center;color:#98a2b3;font-weight:850}.quote-items-table td:nth-child(3){width:100px}.quote-items-table td:nth-child(4),.quote-items-table td:nth-child(5){width:145px}.quote-items-table td:nth-child(6){width:130px}
.quote-line-total{padding-top:20px!important;text-align:right;white-space:nowrap;font-weight:900}.quote-remove-line{display:grid;place-items:center;width:32px;height:32px;margin:4px auto;color:#b42318;background:#fef3f2;border:0;border-radius:9px;cursor:pointer;font-size:20px}
.market-divider{display:grid;grid-template-columns:minmax(260px,1fr) 130px auto minmax(180px,.8fr);gap:12px;align-items:end;margin-top:16px;padding:16px;background:#fffaeb;border:1px solid #fedf89;border-radius:13px}.market-divider strong,.market-divider small,.market-divider label span{display:block}.market-divider small{margin-top:4px;color:#93370d}.market-divider label span{margin-bottom:6px;color:#854a0e;font-size:10px;font-weight:850;text-transform:uppercase}.market-divider input{width:100%;height:44px;padding:0 10px;border:1px solid #fdb022;border-radius:10px}.market-message{align-self:center;font-size:11px;font-weight:750}.market-message.error{color:#b42318}.market-message.ok{color:#067647}
.quote-final-grid{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(280px,.72fr);gap:26px}.quote-final-grid .field+.field{margin-top:16px}.quote-totals-card{position:sticky;top:24px;align-self:start;padding:22px;color:#fff;background:var(--navy);border-radius:15px}.quote-totals-card dl{margin:0}.quote-totals-card dl div{display:flex;justify-content:space-between;gap:15px;padding:10px 0;border-bottom:1px solid rgba(255,255,255,.1)}.quote-totals-card dt{color:#98a2b3;font-size:12px}.quote-totals-card dd{margin:0;font-weight:850}.quote-totals-card .quote-total-grand{margin-top:5px;padding-top:15px;border-bottom:0}.quote-totals-card .quote-total-grand dt,.quote-totals-card .quote-total-grand dd{color:#fff;font-size:19px;font-weight:900}.quote-totals-card>small{display:block;margin-top:14px;color:#98a2b3}
.quote-sticky-actions{position:fixed;z-index:50;right:0;bottom:0;left:270px;display:flex;align-items:center;justify-content:space-between;gap:18px;min-height:72px;padding:13px 40px;background:rgba(255,255,255,.96);border-top:1px solid #d0d5dd;box-shadow:0 -12px 30px rgba(16,24,40,.08)}.quote-sticky-actions>div{display:flex;align-items:center;gap:10px}.keyboard-hint{margin-right:8px;color:#98a2b3;font-size:10px}
.quote-view-actions>div,.quote-view-actions form{display:inline-flex;gap:8px;margin:0}.quote-view-document,.quote-management-card{padding:30px;background:#fff;border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 10px 30px rgba(16,24,40,.05)}.quote-view-header{padding-bottom:24px;border-bottom:2px solid var(--navy)}.quote-view-header h2{margin:0;font-size:30px}.quote-view-header>div:last-child{display:grid;justify-items:end;gap:10px}
.quote-view-info-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;padding:24px 0}.quote-view-info-grid article{padding:16px;background:#f8fafc;border-radius:12px}.quote-view-info-grid span,.quote-view-info-grid strong{display:block}.quote-view-info-grid span{margin-bottom:7px;color:#98a2b3;font-size:10px;font-weight:850;text-transform:uppercase}.quote-view-info-grid p{margin:5px 0 0;color:var(--muted);font-size:12px}
.quote-view-items{width:100%;min-width:760px;border-collapse:collapse}.quote-view-items th,.quote-view-items td{padding:13px 11px;border-bottom:1px solid #eaecf0}.quote-view-items th{color:#667085;text-align:left;background:#f8fafc;font-size:10px;text-transform:uppercase}.quote-view-items td{font-size:12px}.quote-view-items td strong,.quote-view-items td small{display:block}.quote-view-items td small{margin-top:5px;color:var(--muted)}
.quote-view-bottom{align-items:flex-start;margin-top:24px}.quote-view-conditions{max-width:650px}.quote-view-conditions h3{margin:0 0 13px}.quote-view-conditions p{margin:7px 0;color:#475467}.quote-view-notes{margin-top:16px!important;padding:14px;white-space:pre-wrap;background:#f8fafc;border-radius:10px}.quote-view-totals{width:min(330px,100%);margin:0}.quote-view-totals div{display:flex;justify-content:space-between;gap:20px;padding:9px 0;border-bottom:1px solid #eaecf0}.quote-view-totals dd{margin:0;font-weight:850}.quote-view-totals .grand{margin-top:5px;padding-top:15px;color:var(--navy);border-top:2px solid var(--navy);border-bottom:0;font-size:20px;font-weight:900}
.quote-management-grid{display:grid;grid-template-columns:minmax(300px,.8fr) minmax(0,1.2fr);gap:18px}.status-form{display:grid;gap:14px;margin-top:20px}.quote-history{display:grid;margin-top:20px}.quote-history>div{position:relative;padding:0 0 20px 24px;border-left:2px solid #e4e7ec}.quote-history>div:before{content:"";position:absolute;top:3px;left:-6px;width:10px;height:10px;background:var(--accent);border-radius:50%}.quote-history span,.quote-history strong{display:block}.quote-history span{color:#98a2b3;font-size:10px}.quote-history strong{margin-top:3px;font-size:12px}.quote-history p{margin:5px 0 0;color:#667085;font-size:12px}

@media(max-width:1180px){.quote-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.quote-filter{grid-template-columns:repeat(2,minmax(0,1fr))}.quote-grid-four{grid-template-columns:repeat(2,minmax(0,1fr))}.customer-picker,.quote-view-info-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.customer-selected-card{grid-column:1/-1}.quote-section-title-actions{flex-wrap:wrap}.product-search-wrap{margin-left:46px}.market-divider{grid-template-columns:1fr 130px auto}.market-divider>span{grid-column:1/-1}}
@media(max-width:980px){.kpi-grid-four{grid-template-columns:repeat(2,minmax(0,1fr))}.quote-sticky-actions{left:82px;padding-inline:24px}.quote-final-grid,.quote-management-grid{grid-template-columns:1fr}.quote-totals-card{position:static}}
@media(max-width:680px){.quote-summary-grid,.quote-filter,.quote-grid-four,.quote-grid-three,.customer-picker,.quote-view-info-grid,.kpi-grid-four{grid-template-columns:1fr}.quote-document,.quote-view-document,.quote-management-card{padding:20px}.product-search-wrap{grid-template-columns:1fr;margin-left:0}.product-results{right:0}.market-divider{grid-template-columns:1fr}.quote-sticky-actions{position:static;flex-direction:column-reverse;align-items:stretch;padding:16px;border:1px solid var(--line);border-radius:14px}.quote-sticky-actions>div{flex-direction:column;align-items:stretch}.keyboard-hint{text-align:center}.quote-view-actions,.quote-view-header,.quote-view-bottom{align-items:stretch;flex-direction:column}.quote-view-header>div:last-child{justify-items:start}.quote-view-actions>div{flex-wrap:wrap}}


.quote-items-table{min-width:1120px}
.quote-items-table td:nth-child(2){width:94px}
.quote-items-table td:nth-child(4){width:100px}
.quote-items-table td:nth-child(5),.quote-items-table td:nth-child(6){width:145px}
.quote-items-table td:nth-child(7){width:130px}
.quote-thumb-cell{padding-top:12px!important}
.quote-product-thumb{display:grid;place-items:center;width:64px;height:64px;overflow:hidden;background:#fff;border:1px solid #e4e7ec;border-radius:14px;box-shadow:inset 0 1px 0 rgba(255,255,255,.8)}
.quote-product-thumb img{display:block;width:100%;height:100%;object-fit:cover}
.quote-product-thumb-placeholder{color:#f04438;font-weight:900;font-size:22px;background:linear-gradient(180deg,#fff 0%,#fff6f3 100%)}
.quote-item-meta{margin-top:6px}
.quote-item-meta small{display:inline-block;margin-top:0;padding:4px 8px;color:#475467;background:#f8fafc;border:1px solid #eaecf0;border-radius:999px;font-size:10px;font-weight:700}
.lookup-row-product{align-items:center}
.lookup-product-main{display:flex!important;align-items:center;gap:12px;min-width:0}
.lookup-product-main>span:last-child{min-width:0}
.lookup-product-main strong,.lookup-product-main small{white-space:normal}
.lookup-row-product .quote-product-thumb{width:52px;height:52px;border-radius:12px;flex:0 0 52px}
.lookup-row-product>span:last-child{min-width:120px}
@media(max-width:680px){.quote-items-table{min-width:980px}.quote-product-thumb{width:56px;height:56px}}



/* R3.1 HF2.2 — imagen real y grilla estable */
.quote-items-table {
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
}

.quote-items-table col.quote-col-index { width: 42px; }
.quote-items-table col.quote-col-image { width: 92px; }
.quote-items-table col.quote-col-product { width: auto; }
.quote-items-table col.quote-col-quantity { width: 104px; }
.quote-items-table col.quote-col-unit-price { width: 138px; }
.quote-items-table col.quote-col-discount { width: 126px; }
.quote-items-table col.quote-col-total { width: 124px; }
.quote-items-table col.quote-col-remove { width: 52px; }

.quote-items-table th,
.quote-items-table td {
    overflow: visible;
}

.quote-items-table th:nth-child(3),
.quote-items-table td:nth-child(3) {
    width: auto !important;
    min-width: 390px;
}

.quote-items-table td:nth-child(4) { width: 104px !important; }
.quote-items-table td:nth-child(5) { width: 138px !important; }
.quote-items-table td:nth-child(6) { width: 126px !important; }
.quote-items-table td:nth-child(7) { width: 124px !important; }

.quote-thumb-cell {
    padding: 10px !important;
    vertical-align: middle !important;
}

.quote-product-thumb {
    position: relative;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 13px;
}

.quote-product-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 4px;
    object-fit: contain;
    background: #fff;
}

.quote-product-thumb-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #f04438;
    font-size: 23px;
    font-weight: 900;
}

.quote-product-thumb-placeholder {
    color: #f04438;
    background:
        linear-gradient(135deg, rgba(240, 68, 56, .08), transparent),
        #fff8f6;
}

.quote-product-cell {
    min-width: 390px;
}

.quote-product-cell .quote-item-name,
.quote-product-cell .quote-item-description {
    min-width: 0;
    width: 100%;
}

.quote-product-cell .quote-item-name {
    height: 42px;
}

.quote-product-cell .quote-item-description {
    min-height: 70px;
    line-height: 1.45;
}

.quote-number-input,
.quote-money-input {
    width: 100% !important;
    min-width: 0;
}

.quote-line-total {
    vertical-align: middle !important;
    padding-top: 10px !important;
    font-size: 14px;
}

.lookup-row-product .quote-product-thumb {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
}

.lookup-product-main {
    flex: 1 1 auto;
    min-width: 0;
}

.lookup-product-main > span:last-child {
    min-width: 0;
}

.lookup-product-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lookup-product-main small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.35;
}

@media (max-width: 1180px) {
    .quote-items-table {
        min-width: 1120px;
    }
}

@media (max-width: 680px) {
    .quote-items-table {
        min-width: 1080px;
    }

    .quote-product-thumb {
        width: 64px;
        height: 64px;
    }
}


/* R3.1 HF3 — tema azul oscuro */
:root {
    --ink: #e6edf7;
    --muted: #9fb0c7;
    --line: #223247;
    --surface: #111c2d;
    --surface-soft: #0b1220;
    --navy: #081221;
    --navy-2: #102036;
    --accent: #f25c3c;
    --accent-dark: #d84b2d;
    --success: #2fb171;
    --success-soft: #0f2d22;
    --danger: #ff7b72;
    --danger-soft: #351a1d;
    --shadow: 0 24px 70px rgba(0, 0, 0, .38);
}

body,
body.app-page {
    color: var(--ink);
    background: radial-gradient(circle at top, rgba(37, 99, 235, .08), transparent 26%), var(--surface-soft);
}

/* Login */
.login-card,
.login-card-header,
.login-footer {
    color: var(--ink);
    background: #0f1728;
    border-color: var(--line);
}

.login-card-body h2,
.login-form label {
    color: var(--ink);
}

.login-form input[type="email"],
.login-form input[type="password"] {
    color: var(--ink);
    background: #0c1626;
    border-color: #314155;
}

.login-form input::placeholder { color: #8ea2bb; }
.login-footer, .login-card-header { color: var(--muted); }

/* Shell */
.sidebar {
    background: linear-gradient(180deg, #07111f 0%, #0a1526 100%);
    border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar-brand { border-bottom-color: rgba(255,255,255,.08); }
.sidebar-footer { border-top-color: rgba(255,255,255,.08); }
.nav-item { color: #c8d6e8; }
.nav-item:hover { background: rgba(255,255,255,.04); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(242,92,60,.2), rgba(242,92,60,.08));
    box-shadow: inset 3px 0 0 var(--accent), 0 8px 22px rgba(0,0,0,.16);
}
.nav-item small, .nav-label, .sidebar-brand small, .user-mini small, .nav-icon { color: #8fa3bd; }
.avatar { background: #14253c; }

.topbar {
    background: rgba(9, 17, 31, .92);
    border-bottom-color: var(--line);
    backdrop-filter: blur(10px);
}
.topbar h1 { color: var(--ink); }
.topbar-meta { color: var(--muted); }
.live-pill { color: #7ee2a8; background: rgba(47,177,113,.13); }
.live-pill i { background: #2fb171; box-shadow: 0 0 0 5px rgba(47,177,113,.12); }
.content-area { background: transparent; }

/* Generic surfaces */
.kpi-card,
.roadmap-card,
.entity-card,
.filter-bar,
.table-card,
.form-card,
.branches-panel,
.quote-document,
.quote-view-document,
.quote-management-card,
.quote-summary-grid article,
.quote-view-info-grid article,
.roadmap-item,
.switch-field,
.branch-card,
.customer-selected-card,
.table-summary,
.pagination,
.form-actions,
.legacy-banner,
.review-banner,
.context-banner,
.customer-active-switch,
.market-divider,
.quote-sticky-actions,
.quote-totals-card,
.quote-view-notes {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.table-summary,
.form-actions,
.legacy-banner,
.review-banner,
.switch-field,
.branch-card,
.customer-selected-card,
.quote-view-info-grid article,
.roadmap-item {
    background: #0f1728;
}

.welcome-panel,
.context-banner,
.quote-totals-card {
    background: radial-gradient(circle at 90% 10%, rgba(242,92,60,.22), transparent 28%), #0f1b2f;
}

.welcome-panel p:not(.eyebrow),
.welcome-badge span,
.quote-totals-card dt,
.quote-totals-card > small,
.context-banner span,
.customer-selected-card small,
.kpi-card small,
.kpi-card p,
.roadmap-item small,
.section-heading .progress-label,
.table-summary,
.detail-list dt,
.branch-details dt,
.quote-view-info-grid p,
.quote-view-info-grid span,
.quote-view-items td small,
.quote-history span,
.quote-history p,
.field-help,
.form-section-heading p,
.page-actions p,
.login-card-header,
.login-footer,
.muted,
.search-field span,
.lookup-row small,
.lookup-row > span:last-child,
.quote-section-title p,
.quote-document .eyebrow,
.data-table td small,
.data-table th,
.quote-items-table th,
.quote-items-table td>small {
    color: var(--muted);
}

.kpi-index { color: #5d7390; }
.status-text { color: #65d29a !important; }
.progress-label,
.badge-neutral {
    color: #cbd5e1;
    background: #162336;
}

.roadmap-item.done { background: #0e2a21; border-color: #174835; }
.roadmap-item.current { background: #2b1714; border-color: #6d3128; }
.roadmap-item > span { background: #162336; border-color: #304258; color: #cbd5e1; }

.entity-logo,
.form-section-heading > span,
.quote-section-title > span { background: #11233a; }

/* Tables */
.data-table th,
.quote-view-items th,
.quote-items-table th {
    background: #0f1728;
    border-bottom-color: var(--line);
}

.data-table td,
.quote-view-items td,
.quote-items-table td,
.quote-history > div,
.detail-list,
.branch-card-head,
.table-summary,
.pagination,
.quote-view-header,
.quote-document-head,
.section-heading {
    border-color: var(--line);
}

.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.data-table td strong,
.quote-document-head h2,
.quote-section-title h2,
.page-actions h2,
.form-section-heading h2,
.branch-card h3,
.topbar h1,
.section-heading h2,
.quote-view-header h2,
.quote-view-conditions h3,
.entity-card h3,
.kpi-card strong,
.customer-selected-card strong {
    color: var(--ink);
}

/* Inputs */
.field input,
.field select,
.field textarea,
.search-field,
.filter-bar select,
.product-search-wrap > input,
.quote-items-table input,
.quote-items-table textarea,
.market-divider input,
.login-form input[type="email"],
.login-form input[type="password"] {
    color: var(--ink);
    background: #0c1626;
    border-color: #304258;
}

.field input::placeholder,
.field textarea::placeholder,
.search-field input::placeholder,
.product-search-wrap > input::placeholder,
.quote-items-table input::placeholder,
.quote-items-table textarea::placeholder { color: #8ea2bb; }

.search-field input {
    color: var(--ink);
}

.filter-bar select,
.field select { color: var(--ink); }

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-field:focus-within,
.product-search-wrap > input:focus,
.quote-items-table input:focus,
.quote-items-table textarea:focus,
.market-divider input:focus,
.login-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(242,92,60,.14);
}

.search-field { background: #0c1626; border-color: #304258; }

/* Buttons and badges */
.btn-secondary {
    color: var(--ink);
    background: #142033;
    border-color: #304258;
    box-shadow: none;
}
.btn-secondary:hover { background: #17263b; }
.btn-ghost { color: #d7e2f1; background: rgba(255,255,255,.06); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.page-link {
    color: var(--ink);
    background: #101b2d;
    border-color: #304258;
}
.page-link.disabled { color: #6b809a; background: #0d1523; }
.badge-success { color: #7de2a7; background: #0f2d22; }
.badge-warning { color: #ffd085; background: #302413; }
.badge-accent { color: #ffb4a6; background: #311916; }
.badge-info { color: #96ccff; background: #112742; }

.quote-status-draft { color: #d1d9e6; background: #162336; }
.quote-status-sent { color: #96ccff; background: #112742; }
.quote-status-client_review { color: #ffd085; background: #302413; }
.quote-status-awarded { color: #7de2a7; background: #0f2d22; }
.quote-status-lost { color: #ffaea7; background: #351a1d; }
.quote-status-cancelled { color: #d1d9e6; background: #213249; }
.quote-status-expired { color: #ffd085; background: #302413; }

/* Search dropdowns */
.lookup-results {
    background: #0f1728;
    border-color: #304258;
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.lookup-row {
    color: var(--ink);
    background: #0f1728;
    border-bottom-color: #1f3047;
}
.lookup-row:hover,
.lookup-row:focus { background: #142033; }
.lookup-empty { color: var(--muted); }

/* Product images */
.quote-product-thumb {
    background: #0f1728;
    border-color: #2d4058;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.quote-product-thumb img { background: #0f1728; }
.quote-product-thumb-placeholder {
    color: #ff9b86;
    background: linear-gradient(180deg, #1a2437 0%, #151e2f 100%);
}
.quote-item-meta small {
    color: #c9d5e4;
    background: #162336;
    border-color: #304258;
}
.quote-remove-line { color: #ffaea7; background: #351a1d; }

.customer-selected-card,
.branch-card,
.switch-field,
.quote-view-info-grid article { border-color: var(--line); }
.branch-card-inactive { background: #101a2a; }
.branch-code { color: #8ea2bb; }
.branch-details dd,
.page-actions h2,
.quote-view-totals dd,
.quote-view-totals .grand,
.quote-view-header h2 { color: var(--ink); }

.quote-view-totals div,
.quote-view-items th,
.quote-view-items td,
.quote-view-header,
.quote-view-info-grid,
.quote-view-bottom,
.quote-history > div { border-color: var(--line); }
.quote-view-totals .grand { border-top-color: #36506f; }

.quote-sticky-actions {
    background: rgba(9, 17, 31, .96);
    border-top-color: var(--line);
    box-shadow: 0 -16px 30px rgba(0,0,0,.28);
}
.keyboard-hint { color: #8ea2bb; }

.market-divider {
    background: #1b1920;
    border-color: #5a4330;
}
.market-divider small,
.market-divider label span { color: #e1b574; }
.market-message.error { color: #ffaea7; }
.market-message.ok { color: #7de2a7; }

.alert-error { color: #ffaea7; background: #351a1d; }
.alert-success { color: #7de2a7; background: #0f2d22; }

@media (max-width: 680px) {
    .quote-sticky-actions {
        background: #0f1728;
        border-color: var(--line);
    }
}


/* R4.1 alerta global y bancos */
.process-field small{display:block;margin-top:6px;color:var(--muted);font-size:10px;line-height:1.4}.process-required>span:after{content:" *";color:var(--accent)}.process-alert{margin-top:14px;padding:12px 14px;border:1px solid var(--line);border-radius:11px;font-size:12px;font-weight:700}.process-alert-checking{color:#9fc8ff;background:#102640;border-color:#2d5d8e}.process-alert-ok{color:#7de2a7;background:#0f2d22;border-color:#1d6042}.process-alert-warning{color:#ffd085;background:#302413;border-color:#6b5125}.process-alert-error{color:#ffaea7;background:#351a1d;border-color:#7d2e34}.bank-editor{display:grid;gap:14px}.bank-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:end;padding:16px;background:#0f1728;border:1px solid var(--line);border-radius:13px}.bank-check{display:flex;align-items:center;gap:8px;min-height:44px;color:var(--ink);font-size:12px}.bank-check input{width:17px;height:17px;accent-color:var(--accent)}@media(max-width:980px){.bank-row{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.bank-row{grid-template-columns:1fr}}


/* R4.3 — motor documental, correo e historial */
.document-page-actions{display:flex;gap:10px;flex-wrap:wrap}.document-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.document-summary-grid article{padding:18px;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:0 10px 28px rgba(0,0,0,.16)}.document-summary-grid span,.document-summary-grid strong{display:block}.document-summary-grid span{color:var(--muted);font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.document-summary-grid strong{margin-top:7px;color:var(--ink);font-size:25px}.document-card{padding:26px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 12px 30px rgba(0,0,0,.18)}.document-version-list,.document-event-list{display:grid;gap:12px;margin-top:20px}.document-version{display:grid;grid-template-columns:58px minmax(0,1fr) auto auto;gap:14px;align-items:center;padding:16px;background:#0f1728;border:1px solid var(--line);border-radius:13px}.document-version.current{border-color:#2d6c51;box-shadow:inset 3px 0 0 #2fb171}.document-version-badge{display:grid;place-items:center;width:48px;height:48px;color:#fff;background:#162b45;border-radius:12px;font-size:12px;font-weight:900}.document-version-main strong,.document-version-main span,.document-version-main small{display:block}.document-version-main strong{color:var(--ink);font-size:13px}.document-version-main span{margin-top:4px;color:var(--muted);font-size:11px}.document-version-main small{margin-top:5px;color:#7f94af;font-size:9px;overflow-wrap:anywhere}.document-version-actions{display:flex;gap:7px}.document-event-list article{display:grid;grid-template-columns:120px minmax(0,1fr);gap:16px;padding:15px;border-left:3px solid #2f5c91;background:#0f1728;border-radius:0 11px 11px 0}.document-event-channel{align-self:start;color:#9fc8ff;font-size:10px;font-weight:900;text-transform:uppercase}.document-event-list strong{color:var(--ink)}.document-event-list p{margin:4px 0;color:var(--muted);font-size:11px}.document-event-list small{display:block;margin-top:4px;color:#8fa3bd;font-size:10px}.document-event-error{color:#ffaea7!important}.mail-mode-warning,.mail-mode-ok{display:flex;flex-direction:column;gap:4px;padding:15px 18px;border-radius:13px}.mail-mode-warning{color:#ffd085;background:#302413;border:1px solid #6b5125}.mail-mode-ok{color:#7de2a7;background:#0f2d22;border:1px solid #1d6042}.mail-mode-warning span,.mail-mode-ok span{font-size:11px}.mail-form{max-width:1000px}.mail-attachment-card{display:grid;grid-template-columns:54px minmax(0,1fr) auto;gap:14px;align-items:center;margin:0 26px 24px;padding:15px;background:#0f1728;border:1px solid var(--line);border-radius:13px}.mail-attachment-icon{display:grid;place-items:center;width:46px;height:46px;color:#fff;background:#b42318;border-radius:11px;font-size:10px;font-weight:900}.mail-attachment-card strong,.mail-attachment-card small{display:block}.mail-attachment-card strong{color:var(--ink);font-size:12px}.mail-attachment-card small{margin-top:4px;color:var(--muted);font-size:10px}.quote-document-status-card{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px 24px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 12px 30px rgba(0,0,0,.16)}.quote-document-status-card h2{margin:0;color:var(--ink);font-size:18px}.quote-document-status-card p{margin:5px 0;color:var(--muted)}.quote-document-status-card small{color:#7f94af}.quote-view-actions>div{flex-wrap:wrap}@media(max-width:980px){.document-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.document-version{grid-template-columns:58px minmax(0,1fr)}.document-version>.badge,.document-version-actions{grid-column:2}.document-version-actions{justify-content:flex-start}}@media(max-width:680px){.document-summary-grid{grid-template-columns:1fr}.document-version{grid-template-columns:1fr}.document-version>.badge,.document-version-actions{grid-column:auto}.document-event-list article{grid-template-columns:1fr}.mail-attachment-card{grid-template-columns:46px minmax(0,1fr);margin-inline:18px}.mail-attachment-card .btn{grid-column:1/-1}.quote-document-status-card{align-items:stretch;flex-direction:column}}
