:root {
    --lp-primary: #1b3a6b;
    --lp-primary-dark: #122951;
    --lp-accent: #c89b2a;
    --lp-accent-light: #f0d98a;
    --lp-sidebar-width: 240px;
    --lp-topbar-height: 58px;
    --lp-background: #f4f5f7;
    --lp-surface: #ffffff;
    --lp-border: #dfe3e8;
    --lp-text: #20252b;
    --lp-muted: #69737d;
    --lp-radius: .6rem;
    --lp-shadow: 0 2px 10px rgba(18, 41, 81, .09);
    --lp-font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.lp-statement-sheet { max-width: 1050px; margin: 0 auto; }
.lp-statement-table tfoot { border-top: 2px solid var(--lp-navy, #17345f); }
.lp-statement-balance { background: #edf3fa; border-left: 4px solid #d2a31f; padding: 1rem 1.25rem; display: flex; justify-content: space-between; gap: 1rem; font-size: 1.2rem; }
.lp-statement-balance strong { color: #17345f; font-size: 1.35rem; }

@media print {
    .lp-sidebar, .lp-topbar, .lp-no-print, .toast-container { display: none !important; }
    .lp-main, main { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .lp-statement-sheet { border: 0 !important; box-shadow: none !important; max-width: none; }
    .lp-statement-sheet .card-body { padding: 0 !important; }
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--lp-text);
    background: var(--lp-background);
    font-family: var(--lp-font);
    font-size: 14px;
}

a { color: var(--lp-primary); }
a:hover { color: var(--lp-primary-dark); }

.lp-topbar,
.lp-auth-topbar {
    background: var(--lp-primary-dark);
    color: #fff;
    min-height: var(--lp-topbar-height);
    box-shadow: var(--lp-shadow);
}

.lp-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
}

.lp-auth-topbar {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
}

.lp-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-decoration: none;
}

.lp-brand:hover { color: var(--lp-accent-light); text-decoration: none; }

.lp-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: .45rem;
    color: var(--lp-primary-dark);
    background: var(--lp-accent);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .05em;
}

.lp-menu-button {
    display: none;
    border: 0;
    color: #fff;
    background: transparent;
    font-size: 1.4rem;
}

.lp-user-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.lp-user-summary > span { display: flex; flex-direction: column; text-align: right; }
.lp-user-summary small { color: rgba(255,255,255,.65); font-size: .72rem; }

.lp-sidebar {
    position: fixed;
    inset: var(--lp-topbar-height) auto 0 0;
    z-index: 1030;
    width: var(--lp-sidebar-width);
    overflow-y: auto;
    background: var(--lp-primary);
    transition: transform .2s ease;
}

.lp-nav { display: flex; flex-direction: column; padding: 1rem 0 2rem; }

.lp-nav-group-label {
    margin-top: .8rem;
    padding: .45rem 1rem .2rem;
    color: rgba(255,255,255,.42);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.lp-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 42px;
    padding: .55rem 1rem;
    border-left: 3px solid transparent;
    color: rgba(255,255,255,.82);
    text-decoration: none;
}

.lp-nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    text-decoration: none;
}

.lp-nav-link.active {
    border-left-color: var(--lp-accent);
    color: var(--lp-accent-light);
    background: rgba(200,155,42,.14);
}

.lp-nav-link.disabled { color: rgba(255,255,255,.42); cursor: not-allowed; }
.lp-nav-link small { margin-left: auto; color: var(--lp-accent-light); font-size: .62rem; text-transform: uppercase; }

.lp-nav-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: .35rem;
    font-size: .68rem;
    font-weight: 700;
}

.lp-main {
    min-height: calc(100vh - var(--lp-topbar-height));
    margin-top: var(--lp-topbar-height);
    margin-left: var(--lp-sidebar-width);
    padding: 1.5rem;
}

.lp-sidebar-overlay { display: none; }

.lp-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.lp-page-title { margin: 0; color: var(--lp-primary); font-size: 1.45rem; font-weight: 750; }
.lp-page-subtitle { margin: .25rem 0 0; color: var(--lp-muted); }

.lp-stat-card,
.card,
.lp-auth-card {
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    background: var(--lp-surface);
    box-shadow: var(--lp-shadow);
}

.lp-stat-card { height: 100%; padding: 1.15rem; }
.lp-stat-label { color: var(--lp-muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lp-stat-value { display: block; margin-top: .35rem; color: var(--lp-primary); font-size: 1.3rem; font-weight: 750; }
.lp-stat-detail { display: block; margin-top: .25rem; color: var(--lp-muted); font-size: .8rem; }

.card-header { border-bottom: 1px solid var(--lp-border); background: var(--lp-surface); font-weight: 650; }

.btn-lp-primary { border-color: var(--lp-primary); color: #fff; background: var(--lp-primary); }
.btn-lp-primary:hover, .btn-lp-primary:focus { border-color: var(--lp-primary-dark); color: #fff; background: var(--lp-primary-dark); }

.form-label { color: var(--lp-muted); font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.form-control:focus,
.form-select:focus { border-color: var(--lp-primary); box-shadow: 0 0 0 .2rem rgba(27,58,107,.14); }

.lp-action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    color: var(--lp-text);
    background: var(--lp-surface);
    box-shadow: var(--lp-shadow);
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.lp-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(27,58,107,.35);
    color: var(--lp-text);
    box-shadow: 0 8px 22px rgba(18,41,81,.13);
}

.lp-action-card > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; gap: .2rem; }
.lp-action-card strong { color: var(--lp-primary); font-size: 1rem; }
.lp-action-card small { color: var(--lp-muted); }
.lp-action-icon,
.lp-health-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: .55rem;
    color: var(--lp-primary-dark);
    background: rgba(200,155,42,.22);
    font-size: .78rem;
    font-weight: 800;
}
.lp-action-arrow { color: var(--lp-accent); font-size: 1.4rem; }

.lp-settings-form { max-width: 980px; }
.lp-record-form { max-width: 1080px; }
.lp-record-link { color: var(--lp-primary); font-weight: 700; text-decoration: none; }
.lp-record-link:hover { text-decoration: underline; }
.lp-matter-number { padding: .18rem .42rem; border-radius: .3rem; color: var(--lp-primary); background: #e8eef7; font-size: .75rem; }
.lp-section-title { margin: 0 0 .55rem; color: var(--lp-primary); font-size: .82rem; font-weight: 750; text-transform: uppercase; }
.text-prewrap { white-space: pre-wrap; }

.lp-empty-state {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: .4rem;
    padding: 2.5rem 1rem;
    color: var(--lp-muted);
    text-align: center;
}
.lp-empty-state strong { color: var(--lp-primary); font-size: 1rem; }
.lp-empty-state .btn { margin-top: .55rem; }

.lp-readiness-banner {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem;
    border: 1px solid #ead38d;
    border-radius: .5rem;
    color: #67501a;
    background: #fff8e3;
}
.lp-readiness-banner span { font-size: .8rem; line-height: 1.45; }
.lp-readiness-banner.verified { border-color: #9dd8b7; color: #17623c; background: #e7f7ed; }
.lp-readiness-banner.expired { border-color: #e1a5ae; color: #8b2635; background: #fcebed; }
.lp-readiness-banner.received { border-color: #9ebbd8; color: #234e78; background: #edf5fc; }

.lp-cdd-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--lp-border);
    border-radius: .6rem;
    background: #fff;
    box-shadow: var(--lp-shadow);
}
.lp-cdd-summary div { padding: .9rem 1rem; border-right: 1px solid var(--lp-border); }
.lp-cdd-summary div:last-child { border-right: 0; }
.lp-cdd-summary span { display: block; color: var(--lp-muted); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.lp-cdd-summary strong { display: block; margin-top: .2rem; color: var(--lp-primary); }
.lp-reference-location { max-width: 360px; overflow-wrap: anywhere; white-space: normal; }
.lp-empty-state.compact { padding: 1.25rem 1rem; }

.lp-status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: .22rem .52rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.2;
}
.lp-status-pill.is-good { color: #17623c; background: #def5e8; }
.lp-status-pill.is-warning { color: #775607; background: #fff1c7; }
.lp-status-pill.is-bad { color: #8b2635; background: #fce1e5; }
.lp-status-pill.is-neutral { color: #405160; background: #e9eef2; }
.lp-status-pill.cdd-verified { color: #17623c; background: #def5e8; }
.lp-status-pill.cdd-received { color: #234e78; background: #dcebf8; }
.lp-status-pill.cdd-missing { color: #775607; background: #fff1c7; }
.lp-status-pill.cdd-expired { color: #8b2635; background: #fce1e5; }
.lp-status-pill.title-active,
.lp-status-pill.lot-available { color: #17623c; background: #def5e8; }
.lp-status-pill.title-pendingsplinter,
.lp-status-pill.lot-reserved { color: #775607; background: #fff1c7; }
.lp-status-pill.title-surrendered,
.lp-status-pill.lot-sold { color: #405160; background: #e9eef2; }

.lp-callout {
    padding: .75rem .85rem;
    border-left: 3px solid var(--lp-primary);
    border-radius: .25rem;
    color: #42505d;
    background: #edf3fa;
    font-size: .8rem;
}
.lp-callout-warning { border-left-color: #b78209; background: #fff6dc; }
.lp-callout-danger { border-left-color: #a33445; background: #fcecef; }

.lp-health-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 150px;
    margin-bottom: 1rem;
    overflow: hidden;
    padding: 1.6rem 1.8rem;
    border-radius: .8rem;
    color: #fff;
    background: linear-gradient(118deg, var(--lp-primary-dark), var(--lp-primary));
    box-shadow: var(--lp-shadow);
}
.lp-health-hero.has-warning { background: linear-gradient(118deg, #493813, #85630d); }
.lp-health-kicker { color: rgba(255,255,255,.7); font-size: .69rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.lp-health-hero h2 { margin: .35rem 0 .2rem; font-size: 1.45rem; }
.lp-health-hero p { margin: 0; color: rgba(255,255,255,.72); }
.lp-health-orb {
    position: relative;
    width: 72px;
    height: 72px;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.lp-health-orb::before,
.lp-health-orb::after {
    position: absolute;
    content: "";
    inset: 12px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 50%;
}
.lp-health-orb::after { inset: 24px; background: #61d394; border: 0; box-shadow: 0 0 0 7px rgba(97,211,148,.15); }
.lp-health-hero.has-warning .lp-health-orb::after { background: #ffd166; box-shadow: 0 0 0 7px rgba(255,209,102,.15); }

.lp-health-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 175px;
    padding: 1rem;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    background: var(--lp-surface);
    box-shadow: var(--lp-shadow);
}
.lp-health-card-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .85rem; }
.lp-health-card strong { color: var(--lp-muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.lp-health-card > span { margin-top: .25rem; color: var(--lp-primary); font-size: 1.05rem; font-weight: 750; }
.lp-health-card small { margin-top: auto; padding-top: .55rem; color: var(--lp-muted); line-height: 1.35; }

.lp-detail-grid {
    display: grid;
    grid-template-columns: minmax(135px, .6fr) minmax(0, 1.4fr);
    margin: 0;
}
.lp-detail-grid dt,
.lp-detail-grid dd { margin: 0; padding: .7rem 0; border-bottom: 1px solid #edf0f2; }
.lp-detail-grid dt { color: var(--lp-muted); font-size: .77rem; font-weight: 650; }
.lp-detail-grid dd { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.lp-detail-grid dt:nth-last-of-type(1),
.lp-detail-grid dd:last-child { border-bottom: 0; }
.lp-detail-grid-compact dt,
.lp-detail-grid-compact dd { padding: .5rem 0; }

.lp-readiness-list { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.lp-readiness-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: .65rem; border-bottom: 1px solid #edf0f2; }
.lp-readiness-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.lp-readiness-list span { color: var(--lp-muted); }
.lp-readiness-list strong { text-align: right; font-size: .8rem; }

.lp-description-row td { padding-top: .45rem; color: var(--lp-muted); background: #fafbfc; }
.lp-date-compact { width: 145px; }
.lp-metric-number { color: var(--lp-primary); font-size: 2.2rem; font-weight: 800; line-height: 1; }
.lp-process-list { display: grid; gap: .65rem; margin: 0 0 1rem; padding-left: 1.2rem; }
.lp-process-list li::marker { color: var(--lp-accent); font-weight: 800; }
.lp-price-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--lp-border); border-radius: var(--lp-radius); background: var(--lp-surface); box-shadow: var(--lp-shadow); }
.lp-price-strip div { display: grid; gap: .2rem; padding: .9rem; border-right: 1px solid var(--lp-border); }
.lp-price-strip div:last-child { border-right: 0; }
.lp-price-strip span { color: var(--lp-muted); font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.lp-price-strip strong { color: var(--lp-primary); font-size: 1.05rem; }
.lp-price-strip .is-total { background: #edf3fa; }
.lp-history-table { max-height: 360px; }
.lp-contract-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lp-status-pill.contract-draft { color: #405160; background: #e9eef2; }
.lp-status-pill.contract-issued { color: #234e78; background: #dcebf8; }
.lp-status-pill.contract-executed { color: #17623c; background: #def5e8; }
.lp-status-pill.contract-void { color: #8b2635; background: #fce1e5; }
.lp-contract-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; min-width: 240px; }
.lp-contract-actions form { display: flex; gap: .3rem; }

.lp-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--lp-border);
    color: var(--lp-muted);
    font-size: .72rem;
    text-align: center;
}
.lp-footer span,
.lp-auth-footer span { color: var(--lp-accent); }
.lp-auth-footer { padding: .7rem; color: rgba(255,255,255,.58); background: var(--lp-primary-dark); font-size: .72rem; text-align: center; }

.lp-auth-body {
    background:
        linear-gradient(135deg, rgba(18,41,81,.97), rgba(27,58,107,.88)),
        var(--lp-primary-dark);
}

.lp-auth-main {
    display: grid;
    min-height: calc(100vh - var(--lp-topbar-height) - 36px);
    place-items: center;
    padding: 2rem 1rem;
}

.lp-auth-card { width: min(100%, 470px); padding: 2rem; }
.lp-auth-card h1 { margin: 0 0 .4rem; color: var(--lp-primary); font-size: 1.5rem; }
.lp-auth-card p { color: var(--lp-muted); }

.lp-auth-heading { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.lp-form-stack { display: grid; gap: 1rem; }
.lp-auth-note { margin: 1.25rem 0 0; border-top: 1px solid var(--lp-border); padding-top: 1rem; font-size: .78rem; }
.lp-otp-input { font-size: 1.45rem; font-weight: 700; letter-spacing: .35em; text-align: center; }
.lp-otp-code { font-size: 1.15rem; letter-spacing: .16em; }

.validation-summary-valid { display: none; }

@media (max-width: 991.98px) {
    .lp-price-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lp-price-strip div:nth-child(3) { border-right: 0; }
    .lp-menu-button { display: inline-flex; }
    .lp-sidebar { transform: translateX(calc(-1 * var(--lp-sidebar-width))); }
    .lp-sidebar.show { transform: translateX(0); }
    .lp-main { margin-left: 0; }
    .lp-sidebar-overlay.show {
        display: block;
        position: fixed;
        inset: var(--lp-topbar-height) 0 0;
        z-index: 1020;
        background: rgba(0,0,0,.38);
    }
}

@media (max-width: 575.98px) {
    .lp-cdd-summary { grid-template-columns: 1fr; }
    .lp-cdd-summary div { border-right: 0; border-bottom: 1px solid var(--lp-border); }
    .lp-cdd-summary div:last-child { border-bottom: 0; }
    .lp-main { padding: 1rem; }
    .lp-user-summary small { display: none; }
    .lp-user-summary strong { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .lp-auth-card { padding: 1.4rem; }
    .lp-page-header { align-items: stretch; flex-direction: column; }
    .lp-health-hero { min-height: 125px; padding: 1.2rem; }
    .lp-health-orb { display: none; }
    .lp-health-hero h2 { font-size: 1.2rem; }
    .lp-detail-grid { grid-template-columns: 1fr; }
    .lp-detail-grid dt { padding-bottom: .15rem; border-bottom: 0; }
    .lp-detail-grid dd { padding-top: 0; }
}
