:root {
    --brand-navy: #06162f;
    --brand-navy-2: #0b274f;
    --brand-navy-3: #102f5f;
    --brand-gold: #d7a13a;
    --brand-gold-dark: #a96f12;
    --brand-gold-light: #f0c96b;
    --brand-cream: #fff9ed;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #eef2f7;
    --text: #10213d;
    --muted: #65738a;
    --muted-2: #8d98aa;
    --border: #dde4ed;
    --border-strong: #cdd6e2;
    --success: #13795b;
    --success-soft: #e9f8f1;
    --warning: #a86500;
    --warning-soft: #fff4da;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --info: #2457a7;
    --info-soft: #edf4ff;
    --sidebar-width: 258px;
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(6, 22, 47, .05);
    --shadow: 0 14px 40px rgba(6, 22, 47, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
body.sidebar-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { border: 0; }
img { max-width: 100%; }
small { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

input, select, textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    padding: 11px 13px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 4px rgba(215, 161, 58, .14);
}
textarea { resize: vertical; line-height: 1.55; }
input[type="checkbox"] { accent-color: var(--brand-gold-dark); }

/* Buttons */
.button,
.new-chat-button,
.send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 750;
    cursor: pointer;
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease;
}
.button:hover, .new-chat-button:hover, .send-button:hover { transform: translateY(-1px); }
.button:disabled, .send-button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.gold { color: #07152c; background: linear-gradient(135deg, var(--brand-gold-light), var(--brand-gold)); box-shadow: 0 8px 22px rgba(169, 111, 18, .18); }
.button.gold:hover { box-shadow: 0 12px 28px rgba(169, 111, 18, .24); }
.button.navy { color: #fff; background: var(--brand-navy); border-color: var(--brand-navy); }
.button.navy:hover { background: var(--brand-navy-2); }
.button.light { color: var(--text); background: #fff; border-color: var(--border); box-shadow: var(--shadow-sm); }
.button.light:hover, .button.ghost:hover { background: var(--surface-soft); }
.button.ghost { color: var(--text); background: transparent; border-color: transparent; }
.button.large { min-height: 50px; padding-inline: 22px; border-radius: 13px; }
.button.full { width: 100%; }
.icon-button, .sidebar-close {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: inherit;
    background: transparent;
    cursor: pointer;
}
.icon-button:hover, .sidebar-close:hover { background: rgba(255,255,255,.08); }
.text-button { padding: 4px; color: var(--brand-navy-2); background: transparent; font-weight: 750; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.text-button.danger, .text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* Shell and sidebar */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    width: var(--sidebar-width);
    min-height: 100vh;
    flex-direction: column;
    color: #eef3fb;
    background:
        radial-gradient(circle at 20% 0%, rgba(215,161,58,.11), transparent 24%),
        linear-gradient(180deg, #071b39 0%, #041127 100%);
    border-right: 1px solid rgba(240,201,107,.15);
    box-shadow: 12px 0 30px rgba(3, 13, 30, .08);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.sidebar-brand { display: flex; min-width: 0; align-items: center; gap: 11px; }
.sidebar-brand-mark { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 13px; object-fit: cover; box-shadow: 0 8px 20px rgba(0,0,0,.22); }
.sidebar-brand-copy { display: flex; min-width: 0; flex-direction: column; }
.sidebar-brand-copy strong { color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 500; letter-spacing: .045em; }
.sidebar-brand-copy small { margin-top: 2px; color: var(--brand-gold-light); font-size: 9px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.sidebar-close { display: none; color: #fff; font-size: 24px; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 5px 13px 14px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.sidebar-section-label { padding: 18px 11px 8px; color: rgba(240,201,107,.78); font-size: 10px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #cad4e4;
    font-size: 14px;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; border-color: rgba(240,201,107,.25); background: rgba(255,255,255,.075); }
.nav-item.active::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 5px; background: var(--brand-gold-light); }
.nav-icon { display: inline-grid; width: 21px; place-items: center; color: var(--brand-gold-light); font-size: 17px; }
.sidebar-note { display: flex; gap: 10px; margin-top: 24px; padding: 13px; border: 1px solid rgba(240,201,107,.2); border-radius: 13px; background: rgba(255,255,255,.045); font-size: 11px; line-height: 1.5; }
.sidebar-note strong, .sidebar-note span { display: block; }
.sidebar-note strong { color: #fff; }
.sidebar-note span { margin-top: 2px; color: #aebbd0; }
.pulse-dot { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 4px; border-radius: 50%; background: #50d1a0; box-shadow: 0 0 0 5px rgba(80,209,160,.12); }
.sidebar-footer { padding: 13px; border-top: 1px solid rgba(255,255,255,.1); }
.organization-picker { display: block; margin-bottom: 10px; }
.organization-picker > span { display: block; padding: 0 3px 6px; color: #8392aa; font-size: 10px; }
.organization-picker select { color: #f2f5fa; border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.055); }
.account-row { display: flex; align-items: center; gap: 9px; padding: 7px 3px 1px; }
.avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 50%; color: var(--brand-navy); background: linear-gradient(135deg, var(--brand-gold-light), var(--brand-gold)); font-weight: 900; }
.account-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { color: #fff; font-size: 12px; }
.account-copy small { color: #8998af; font-size: 10px; }
.sidebar-backdrop { display: none; }
.app-main { min-width: 0; min-height: 100vh; margin-left: var(--sidebar-width); }
.mobile-header { display: none; }
.content-wrap { width: 100%; max-width: 1540px; margin: 0 auto; padding: 32px clamp(22px, 3vw, 44px) 60px; }
.content-wrap.chat-content { max-width: none; height: 100vh; padding: 0; overflow: hidden; }

/* Shared page components */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-header h1 { margin: 5px 0 8px; color: var(--brand-navy); font-size: clamp(30px, 3vw, 46px); line-height: 1.08; letter-spacing: -.045em; }
.page-header p { max-width: 760px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.eyebrow { color: var(--brand-gold-dark); font-size: 10px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.gold-text { color: var(--brand-gold-light) !important; }
.header-actions, .panel-actions, .dialog-actions, .table-actions, .row-actions, .filter-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.panel-card, .metric-card, .premium-assistant-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.panel-card { padding: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-heading h2 { margin: 3px 0 4px; color: var(--brand-navy); font-size: 20px; letter-spacing: -.02em; }
.panel-heading p { max-width: 720px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.alert { margin: 0 0 18px; padding: 12px 15px; border: 1px solid; border-radius: 11px; font-size: 14px; }
.alert.success { color: var(--success); border-color: #aee6cd; background: var(--success-soft); }
.alert.error { color: var(--danger); border-color: #fac6c1; background: var(--danger-soft); }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.stack-form label, .filter-grid label, .workflow-action-form label { display: block; color: #33445f; font-size: 12px; font-weight: 750; }
.stack-form label > span, .filter-grid label > span, .workflow-action-form label > span { display: block; margin-bottom: 6px; }
.stack-form label small { display: block; margin-top: 6px; font-weight: 450; }
.checkbox-row { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 600 !important; }
.checkbox-row input { width: 16px; height: 16px; flex: 0 0 16px; margin: 2px 0 0; }
.checkbox-row span { margin: 0 !important; line-height: 1.4; }
.file-drop { padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--surface-soft); }
.empty-state { padding: 28px; color: var(--muted); text-align: center; }

/* Metrics and dashboard */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { min-height: 132px; padding: 18px; overflow: hidden; }
.metric-card > span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.metric-card strong { display: block; margin: 13px 0 6px; color: var(--brand-navy); font-size: clamp(28px, 2.4vw, 38px); letter-spacing: -.045em; }
.metric-card small { display: block; line-height: 1.45; }
.navy-card, .dark-panel { color: #fff; border-color: rgba(215,161,58,.25); background: linear-gradient(145deg, var(--brand-navy-2), var(--brand-navy)); box-shadow: 0 16px 40px rgba(6,22,47,.16); }
.navy-card > span, .navy-card small, .dark-panel p, .dark-panel .usage-label { color: #bac7d9; }
.navy-card strong, .dark-panel h2 { color: #fff; }
.metric-progress { height: 5px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.13); }
.metric-progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand-gold-light); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(270px, .72fr); gap: 18px; margin-bottom: 18px; }
.command-center { min-width: 0; }
.saving-badge { display: inline-flex; padding: 7px 10px; border-radius: 999px; color: #81560d; background: #fff2d2; font-size: 10px; font-weight: 850; white-space: nowrap; }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 20px 0; }
.pipeline-step { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.pipeline-step b { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 9px; color: #fff; background: var(--brand-navy); }
.pipeline-step.done b { color: var(--brand-navy); background: var(--brand-gold-light); }
.pipeline-step span { display: flex; min-width: 0; flex-direction: column; color: var(--muted); font-size: 10px; line-height: 1.4; }
.pipeline-step strong { color: var(--text); font-size: 12px; }
.usage-number { margin-top: 20px; font-size: 44px; font-weight: 800; letter-spacing: -.05em; }
.usage-label { color: var(--muted); }
.usage-cost { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.14); font-size: 21px; font-weight: 800; }
.muted-copy { color: var(--muted); font-size: 12px; line-height: 1.55; }
.model-map-card { margin-top: 18px; }
.model-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.model-map article, .model-routing-banner article { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.model-map strong, .model-routing-banner strong { color: var(--brand-navy); font-size: 12px; }
.model-map p, .model-routing-banner p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.model-map b { color: var(--brand-gold-dark); font-size: 10px; }
.model-icon { display: inline-grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; color: var(--brand-navy); background: #f4dfaf; font-weight: 900; }
.model-icon.local { background: #daf4e8; }
.model-icon.deepseek, .model-icon.economy { background: #e6efff; color: #1d4f9b; }
.model-icon.luna, .model-icon.balanced { background: #eee7ff; color: #6745a9; }
.model-icon.terra, .model-icon.advanced { background: #fff0d3; color: #8d5700; }
.model-icon.sol { background: #fde7e4; color: #a2382f; }
.model-icon.embed { background: #e7f5ef; color: #176b4f; }

/* Tables and status */
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading { margin: 0; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table th { color: #71572b; background: #fcf8ef; font-size: 10px; font-weight: 900; letter-spacing: .055em; text-transform: uppercase; }
.data-table td { color: #3f4f68; font-size: 12px; line-height: 1.45; }
.data-table td strong, .data-table td small { display: block; }
.data-table tbody tr:hover { background: #fafcff; }
.legal-table { min-width: 1160px; }
.legal-table th:first-child, .legal-table td:first-child { width: 34px; padding-right: 2px; }
.legal-table input[type="checkbox"] { width: 16px; height: 16px; }
.summary-cell { min-width: 290px; max-width: 420px; }
.case-reference { min-width: 165px; }
.case-reference strong { color: var(--brand-navy); }
.case-reference small, .route-cell small { margin-top: 4px; }
.route-cell { min-width: 145px; }
.route-cell strong { color: var(--brand-navy); }
.source-result { display: inline-flex; padding: 4px 8px; border-radius: 7px; color: #5f6d80; background: #edf1f6; font-size: 10px; font-weight: 700; }
.mismatch-flag { width: fit-content; margin-top: 5px; color: var(--danger); font-weight: 800; }
.status-pill, .outcome-pill, .indexed-flag {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    color: #526077;
    background: #edf1f6;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.status-pill.ready, .outcome-pill.success { color: var(--success); background: var(--success-soft); }
.status-pill.processing, .outcome-pill.warning { color: var(--warning); background: var(--warning-soft); }
.status-pill.failed, .outcome-pill.danger { color: var(--danger); background: var(--danger-soft); }
.outcome-pill.info { color: var(--info); background: var(--info-soft); }
.indexed-flag { display: block; margin-top: 6px; color: var(--success); background: var(--success-soft); }
.review-flag { display: block; margin-top: 5px; color: var(--warning); font-weight: 800; }
.error-copy { margin-top: 5px; color: var(--danger); }
.empty-row { padding: 34px !important; color: var(--muted); text-align: center !important; }
.pagination-wrap { padding: 14px 18px; border-top: 1px solid var(--border); }
.pagination-wrap nav > div:first-child { display: none; }
.pagination-wrap nav > div:last-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pagination-wrap svg { width: 18px; height: 18px; }
.pagination-wrap a, .pagination-wrap span[aria-current="page"] span { display: inline-flex; min-width: 34px; min-height: 34px; align-items: center; justify-content: center; border: 1px solid var(--border); background: #fff; }

/* Jurisprudence */
.legal-operations-metrics { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
.strategy-panel { margin-bottom: 18px; background: linear-gradient(145deg, #fff, #fbfcff); }
.strategy-heading { align-items: center; }
.estimate-summary { min-width: 150px; text-align: right; }
.estimate-summary strong, .estimate-summary span { display: block; }
.estimate-summary strong { color: var(--brand-navy); font-size: 30px; letter-spacing: -.04em; }
.estimate-summary span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.analysis-profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; margin: 18px 0; }
.analysis-profile { padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: #fff; }
.analysis-profile.recommended { border-color: #dfb45f; box-shadow: inset 0 3px 0 var(--brand-gold); }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.profile-tag { padding: 5px 8px; border-radius: 99px; color: #7e560f; background: #fff2d2; font-size: 9px; font-weight: 850; }
.analysis-profile h3 { margin: 13px 0 7px; color: var(--brand-navy); font-size: 17px; }
.analysis-profile p { min-height: 44px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.analysis-profile > small { display: block; margin-top: 9px; font-size: 9px; }
.profile-cost { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--border); }
.profile-cost strong, .profile-cost span { display: block; }
.profile-cost strong { color: var(--brand-navy); font-size: 18px; }
.profile-cost span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.workflow-actions-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(250px,.72fr); gap: 13px; }
.workflow-action-form { display: flex; min-width: 0; flex-direction: column; gap: 12px; padding: 17px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.workflow-form-heading { display: flex; gap: 10px; }
.workflow-form-heading strong { color: var(--brand-navy); font-size: 14px; }
.workflow-form-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.step-number { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; color: var(--brand-navy); background: #f4dfaf; font-weight: 900; }
.workflow-form-fields { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(100px,.8fr); gap: 10px; }
.efficiency-card { padding: 18px; border: 1px solid rgba(240,201,107,.25); border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--brand-navy-2), var(--brand-navy)); }
.efficiency-card h2 { color: inherit; }
.check-list { margin: 15px 0 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding: 0 0 12px 22px; color: inherit; font-size: 11px; line-height: 1.5; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--brand-gold-light); font-weight: 900; }
.light-efficiency { color: var(--text); border-color: #ead6ad; background: #fffaf0; }
.light-efficiency .check-list li::before { color: var(--success); }
.filter-card { margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: minmax(250px, 2fr) repeat(3, minmax(130px, .8fr)); gap: 11px; align-items: end; }
.filter-options { display: flex; grid-column: 1 / span 3; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-actions { grid-column: 4; justify-content: flex-end; }
.search-field input { min-width: 0; }
.table-toolbar { align-items: center; }

/* Detail page */
.back-link { display: inline-flex; margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.detail-header { align-items: flex-end; }
.case-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 18px; }
.case-grid.text-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.case-result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.case-result-top h2 { margin: 12px 0 0; }
.confidence-ring { --score: 0; display: grid; width: 96px; height: 96px; flex: 0 0 96px; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand-gold) calc(var(--score) * 1%), #e9edf3 0); }
.confidence-ring::before { content: ""; grid-area: 1/1; width: 74px; height: 74px; border-radius: 50%; background: #fff; }
.confidence-ring > div { position: relative; grid-area: 1/1; display: flex; flex-direction: column; align-items: center; }
.confidence-ring strong { color: var(--brand-navy); }
.confidence-ring span { color: var(--muted); font-size: 9px; }
.analysis-block { padding: 17px 0; border-top: 1px solid var(--border); }
.analysis-block h3 { margin: 0 0 7px; font-size: 13px; }
.analysis-block p { margin: 0; color: #46566f; line-height: 1.7; }
.quote-block blockquote { margin: 0; padding: 13px 15px; border-left: 3px solid var(--brand-gold); border-radius: 0 10px 10px 0; color: #34445d; background: #fffaf0; line-height: 1.65; }
.case-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 18px; }
.case-meta-grid div { padding: 10px; border-radius: 10px; background: var(--surface-soft); }
.case-meta-grid span, .case-meta-grid strong { display: block; }
.case-meta-grid span { color: var(--muted); font-size: 9px; }
.case-meta-grid strong { margin-top: 4px; font-size: 11px; }
.comparison-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.comparison-row span { color: var(--muted); }
.comparison-row strong { text-align: right; }
.source-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.legal-text { max-height: 520px; overflow: auto; white-space: pre-wrap; color: #33445e; font-family: ui-serif, Georgia, serif; font-size: 13px; line-height: 1.75; }
.long-text summary { margin-bottom: 14px; cursor: pointer; font-weight: 750; }
.manual-review-card { margin-bottom: 35px; }

/* Knowledge and assistants */
.library-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
.library-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .7fr); gap: 18px; margin-bottom: 18px; }
.inline-create-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto; gap: 9px; }
.knowledge-list { display: grid; gap: 9px; margin-top: 16px; }
.knowledge-list article { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.knowledge-list p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.knowledge-list > article > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.repository-panel { margin-top: 18px; }
.model-routing-banner { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.model-routing-banner article { grid-template-columns: 38px minmax(0,1fr); }
.assistant-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.premium-assistant-card { padding: 18px; }
.assistant-card-head { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; }
.assistant-avatar { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--brand-navy); background: linear-gradient(135deg, var(--brand-gold-light), var(--brand-gold)); font-weight: 900; }
.assistant-card-head h2 { margin: 0; font-size: 15px; }
.assistant-card-head > div > span { color: var(--muted); font-size: 10px; }
.premium-assistant-card > p { min-height: 40px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.assistant-meta { display: grid; gap: 6px; margin: 13px 0; padding: 11px; border-radius: 11px; background: var(--surface-soft); font-size: 10px; }

/* Dialogs */
.app-dialog { width: min(540px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: auto; border: 1px solid #e5d2aa; border-radius: 18px; box-shadow: 0 30px 90px rgba(6,22,47,.28); }
.app-dialog::backdrop { background: rgba(3, 13, 30, .55); backdrop-filter: blur(3px); }
.app-dialog > form { padding: 22px; }
.wide-dialog { width: min(780px, calc(100vw - 28px)); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.dialog-heading h2 { margin: 5px 0 0; }
.dialog-actions { justify-content: flex-end; margin-top: 3px; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 238px minmax(0,1fr); width: 100%; height: 100vh; background: #fff; }
.conversation-panel { display: flex; min-width: 0; flex-direction: column; padding: 14px; border-right: 1px solid var(--border); background: linear-gradient(180deg, #f8fafc 0%, #f1f4f8 100%); overflow: hidden; }
.conversation-panel-top { flex: 0 0 auto; }
.conversation-brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 16px; }
.conversation-brand img { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; object-fit: cover; }
.conversation-brand div { display: flex; min-width: 0; flex-direction: column; }
.conversation-brand strong { color: var(--brand-navy); font-size: 13px; }
.conversation-brand span { margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.new-chat-button { width: 100%; min-height: 43px; color: var(--brand-navy); border-color: #dfb45f; background: #fffaf0; }
.conversation-heading { padding: 18px 6px 8px; color: #7d899a; font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.conversation-list { min-height: 0; flex: 1; overflow-y: auto; }
.conversation-item { display: flex; width: 100%; min-width: 0; align-items: center; gap: 8px; padding: 9px 8px; border-radius: 9px; color: #526077; background: transparent; text-align: left; cursor: pointer; }
.conversation-item > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item:hover, .conversation-item.active { color: var(--brand-navy); background: #fff; box-shadow: var(--shadow-sm); }
.conversation-bullet { color: var(--brand-gold-dark); }
.conversation-empty { padding: 10px 7px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.conversation-tip { flex: 0 0 auto; padding: 12px; border: 1px solid #ead7af; border-radius: 12px; background: #fffaf0; }
.conversation-tip strong, .conversation-tip span { display: block; }
.conversation-tip strong { color: var(--brand-navy); font-size: 11px; }
.conversation-tip span { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.chat-workspace { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #fff; }
.chat-header { display: flex; min-height: 68px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); box-shadow: 0 4px 16px rgba(6,22,47,.035); }
.assistant-selector { display: flex; min-width: 0; align-items: center; gap: 9px; }
.assistant-selector label { min-width: 0; }
.assistant-selector select { width: auto; max-width: min(430px, 45vw); min-width: 220px; border: 0; padding: 8px 30px 8px 0; font-weight: 800; background-color: transparent; }
.assistant-live-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #50d1a0; box-shadow: 0 0 0 5px rgba(80,209,160,.12); }
.chat-status { color: var(--muted); font-size: 10px; white-space: nowrap; }
.analysis-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 11px; }
.analysis-toggle input { width: 16px; height: 16px; }
.analysis-toggle span { display: flex; flex-direction: column; }
.analysis-toggle b { font-size: 10px; }
.analysis-toggle small { font-size: 8px; }
.messages-area { min-height: 0; flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-welcome { width: min(860px, calc(100% - 42px)); margin: 0 auto; padding: clamp(38px, 7vh, 78px) 0 42px; text-align: center; }
.chat-welcome.compact { padding-top: 80px; }
.assistant-orb { display: grid; width: 72px; height: 72px; margin: 0 auto 14px; place-items: center; overflow: hidden; border: 1px solid #dfb45f; border-radius: 20px; background: var(--brand-navy); box-shadow: 0 15px 36px rgba(6,22,47,.15); }
.assistant-orb img { width: 100%; height: 100%; object-fit: cover; }
.chat-welcome h1 { margin: 8px 0 10px; color: var(--brand-navy); font-size: clamp(28px, 3vw, 42px); letter-spacing: -.045em; }
.chat-welcome > p { max-width: 700px; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 1.6; }
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; margin-top: 26px; }
.prompt-grid button { min-height: 108px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: linear-gradient(145deg, #fff, #fafbfe); text-align: left; cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.prompt-grid button:hover { transform: translateY(-2px); border-color: #dfb45f; box-shadow: 0 10px 24px rgba(6,22,47,.08); }
.prompt-icon { display: inline-grid; width: 28px; height: 28px; margin-bottom: 9px; place-items: center; border-radius: 8px; color: var(--brand-navy); background: #f6e6bf; }
.prompt-grid strong, .prompt-grid small { display: block; }
.prompt-grid strong { color: var(--brand-navy); font-size: 12px; }
.prompt-grid small { margin-top: 5px; font-size: 10px; line-height: 1.45; }
.chat-message-row { display: grid; grid-template-columns: 34px minmax(0, 760px); justify-content: center; gap: 12px; padding: 18px 26px; }
.chat-message-row.assistant { background: #fbfcfe; }
.message-avatar { display: grid; width: 32px; height: 32px; place-items: center; overflow: hidden; border-radius: 9px; }
.brand-message-avatar { padding: 1px; background: var(--brand-navy); }
.brand-message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-message-avatar { color: var(--brand-navy); background: #f3dfb1; font-size: 9px; font-weight: 800; }
.message-content { min-width: 0; }
.message-role { margin-bottom: 5px; color: #8b6a31; font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.message-text { color: #2f405a; font-size: 13px; line-height: 1.75; }
.message-sources { margin-top: 13px; padding: 11px; border: 1px solid #e7decf; border-radius: 11px; background: #fffaf1; }
.message-sources strong { display: block; margin-bottom: 7px; font-size: 10px; }
.message-sources div { display: flex; flex-wrap: wrap; gap: 6px; }
.message-sources a, .message-sources span { padding: 5px 8px; border-radius: 7px; color: #76521b; background: #f8e8c5; font-size: 9px; }
.thinking-dots { display: flex; align-items: center; gap: 4px; padding-top: 7px; }
.thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-gold); animation: pulse 1.2s infinite ease-in-out; }
.thinking-dots i:nth-child(2) { animation-delay: .14s; }
.thinking-dots i:nth-child(3) { animation-delay: .28s; }
.thinking-dots span { margin-left: 6px; color: var(--muted); font-size: 10px; }
@keyframes pulse { 0%, 80%, 100% { opacity: .3; transform: scale(.75); } 40% { opacity: 1; transform: scale(1); } }
.composer-wrap { flex: 0 0 auto; padding: 12px 20px 13px; border-top: 1px solid var(--border); background: rgba(255,255,255,.97); }
.composer { display: flex; width: min(860px, 100%); align-items: flex-end; gap: 9px; margin: 0 auto; padding: 8px 9px 8px 14px; border: 1px solid var(--border-strong); border-radius: 17px; background: #fff; box-shadow: 0 10px 30px rgba(6,22,47,.08); }
.composer textarea { max-height: 150px; padding: 8px 0; border: 0; box-shadow: none; }
.send-button { width: 40px; height: 40px; flex: 0 0 40px; min-height: 40px; padding: 0; border-radius: 12px; color: var(--brand-navy); background: linear-gradient(135deg, var(--brand-gold-light), var(--brand-gold)); }
.composer-note { margin: 7px auto 0; color: #8b95a5; font-size: 8px; text-align: center; }
.composer-note span { color: var(--success); }

/* Landing and auth */
.landing-page { min-height: 100vh; color: #fff; background: radial-gradient(circle at 72% 28%, rgba(215,161,58,.15), transparent 24%), linear-gradient(145deg, #071b39, #030d20 70%); }
.landing-nav { display: flex; max-width: 1380px; align-items: center; justify-content: space-between; margin: 0 auto; padding: 20px 30px; }
.landing-brand img { width: 190px; height: 74px; object-fit: contain; object-position: left; }
.landing-actions, .landing-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.ghost-on-dark { color: #fff; background: transparent; }
.outline-gold { color: #fff; border-color: rgba(240,201,107,.5); background: rgba(255,255,255,.03); }
.landing-main { display: grid; grid-template-columns: minmax(0, .95fr) minmax(480px, 1.05fr); max-width: 1380px; min-height: calc(100vh - 114px); align-items: center; gap: 60px; margin: 0 auto; padding: 45px 30px 80px; }
.landing-copy h1 { max-width: 720px; margin: 14px 0 20px; font-size: clamp(46px, 5.3vw, 78px); line-height: 1.02; letter-spacing: -.055em; }
.landing-copy h1 em { color: var(--brand-gold-light); font-family: Georgia, serif; font-weight: 500; }
.landing-copy > p { max-width: 650px; margin: 0; color: #bcc8d9; font-size: 17px; line-height: 1.7; }
.landing-cta { margin-top: 28px; }
.trust-row { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.dark-trust span { color: #aebbd0; font-size: 10px; }
.product-preview { overflow: hidden; border: 1px solid rgba(240,201,107,.25); border-radius: 22px; background: #f7f9fc; box-shadow: 0 40px 100px rgba(0,0,0,.35); transform: perspective(1200px) rotateY(-3deg) rotateX(1deg); }
.preview-topbar { display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #dde4ed; background: #fff; }
.preview-brand img { width: 90px; height: 42px; object-fit: contain; }
.preview-chip { padding: 6px 9px; border-radius: 99px; color: var(--success); background: var(--success-soft); font-size: 9px; font-weight: 800; }
.preview-body { display: grid; grid-template-columns: 140px minmax(0,1fr); min-height: 420px; }
.preview-menu { display: flex; flex-direction: column; gap: 6px; padding: 16px 10px; color: #aab6c8; background: var(--brand-navy); font-size: 9px; }
.preview-menu span { padding: 9px; border-radius: 8px; }
.preview-menu .active { color: #fff; background: rgba(255,255,255,.08); }
.preview-content { padding: 20px; color: var(--text); }
.preview-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.preview-kpis div { padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.preview-kpis small, .preview-kpis strong { display: block; }
.preview-kpis strong { margin-top: 5px; color: var(--brand-navy); font-size: 19px; }
.preview-question { margin: 18px 0 12px; padding: 12px 14px; border-radius: 12px; color: #fff; background: var(--brand-navy-2); font-size: 11px; }
.preview-answer { display: flex; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.preview-ai { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; border-radius: 9px; color: var(--brand-navy); background: var(--brand-gold-light); font-weight: 900; }
.preview-answer strong { color: var(--brand-navy); font-size: 11px; }
.preview-answer p { margin: 6px 0 10px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.preview-sources { display: flex; gap: 6px; flex-wrap: wrap; }
.preview-sources span { padding: 5px 7px; border-radius: 7px; color: #76521b; background: #fff0cf; font-size: 8px; }
.auth-page { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(430px, .92fr); min-height: 100vh; }
.auth-visual { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: 45px clamp(32px, 6vw, 88px); color: #fff; background: radial-gradient(circle at 45% 32%, rgba(215,161,58,.14), transparent 28%), linear-gradient(150deg,#0a2851,#041126 70%); overflow: hidden; }
.auth-visual::after { content: "§"; position: absolute; right: -30px; bottom: -150px; color: rgba(215,161,58,.055); font-family: Georgia, serif; font-size: 520px; line-height: 1; }
.auth-logo img { position: relative; z-index: 1; width: 210px; height: 90px; object-fit: contain; object-position: left; }
.auth-visual-copy { position: relative; z-index: 1; max-width: 650px; }
.auth-visual-copy h1 { margin: 12px 0 18px; font-size: clamp(42px, 5vw, 74px); line-height: 1; letter-spacing: -.055em; }
.auth-visual-copy p { max-width: 560px; color: #bdc8d9; font-size: 16px; line-height: 1.7; }
.auth-feature-list { position: relative; z-index: 1; display: flex; gap: 9px; flex-wrap: wrap; }
.auth-feature-list span { padding: 8px 10px; border: 1px solid rgba(240,201,107,.24); border-radius: 99px; color: #e7dcc5; background: rgba(255,255,255,.04); font-size: 10px; }
.auth-panel { display: flex; width: min(520px, 100%); flex-direction: column; justify-content: center; margin: auto; padding: 45px; }
.auth-heading h1 { margin: 7px 0; color: var(--brand-navy); font-size: 34px; letter-spacing: -.04em; }
.auth-heading p { margin: 0 0 24px; color: var(--muted); }
.auth-switch { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-switch a { color: var(--brand-gold-dark); font-weight: 800; }

/* Responsive */
@media (max-width: 1360px) {
    .workflow-actions-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .workflow-actions-grid .efficiency-card { grid-column: 1 / -1; }
    .model-routing-banner { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .filter-grid { grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(130px,1fr)); }
    .filter-options { grid-column: 1 / span 2; }
    .filter-actions { grid-column: 3; }
}

@media (max-width: 1100px) {
    :root { --sidebar-width: 238px; }
    .content-wrap { padding-inline: 24px; }
    .dashboard-grid, .library-layout, .case-grid { grid-template-columns: 1fr; }
    .pipeline { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .analysis-profile-grid { grid-template-columns: 1fr; }
    .chat-layout { grid-template-columns: 210px minmax(0,1fr); }
    .conversation-panel { padding: 11px; }
    .landing-main { grid-template-columns: 1fr; }
    .product-preview { max-width: 850px; transform: none; }
}

@media (max-width: 900px) {
    .sidebar { width: 270px; transform: translateX(-102%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: inline-grid; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 55; display: block; visibility: hidden; opacity: 0; background: rgba(3,13,30,.5); transition: opacity .2s ease, visibility .2s ease; }
    body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .app-main { margin-left: 0; }
    .mobile-header { position: sticky; top: 0; z-index: 45; display: flex; height: 58px; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
    .mobile-menu-button:hover { background: var(--surface-muted); }
    .mobile-brand { display: flex; align-items: center; gap: 8px; }
    .mobile-brand img { width: 32px; height: 32px; border-radius: 9px; }
    .mobile-brand strong { color: var(--brand-navy); font-family: Georgia, serif; }
    .top-status { color: var(--muted); font-size: 9px; }
    .top-status i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #50d1a0; }
    .content-wrap.chat-content { height: calc(100vh - 58px); }
    .page-header { flex-direction: column; }
    .header-actions { width: 100%; }
    .form-grid.two, .case-grid.text-grid { grid-template-columns: 1fr; }
    .workflow-actions-grid { grid-template-columns: 1fr; }
    .workflow-actions-grid .efficiency-card { grid-column: auto; }
    .filter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .search-field { grid-column: 1 / -1; }
    .filter-options, .filter-actions { grid-column: 1 / -1; }
    .filter-actions { justify-content: flex-start; }
    .library-metrics { grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); }
    .auth-page { display: block; }
    .auth-visual { min-height: auto; padding: 28px 24px 45px; }
    .auth-visual-copy h1 { font-size: 42px; }
    .auth-panel { padding: 34px 22px; }
}

@media (max-width: 720px) {
    .content-wrap { padding: 22px 14px 40px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .metric-card { min-height: 118px; padding: 15px; }
    .metric-card strong { font-size: 28px; }
    .pipeline { grid-template-columns: 1fr; }
    .workflow-form-fields { grid-template-columns: 1fr; }
    .inline-create-form { grid-template-columns: 1fr; }
    .model-routing-banner { grid-template-columns: 1fr; }
    .case-meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .chat-layout { grid-template-columns: 1fr; }
    .conversation-panel { display: none; }
    .chat-header { padding: 9px 12px; }
    .assistant-selector select { min-width: 0; max-width: 52vw; }
    .chat-status { display: none; }
    .analysis-toggle small { display: none; }
    .chat-welcome { width: min(100% - 24px, 760px); padding-top: 34px; }
    .prompt-grid { grid-template-columns: 1fr; }
    .composer-wrap { padding-inline: 10px; }
    .chat-message-row { grid-template-columns: 30px minmax(0,1fr); padding-inline: 14px; }
    .landing-nav { padding: 15px 18px; }
    .landing-brand img { width: 145px; }
    .landing-main { padding: 35px 18px 60px; }
    .landing-copy h1 { font-size: 44px; }
    .product-preview { display: none; }
    .preview-body { grid-template-columns: 1fr; }
    .preview-menu { display: none; }
}

@media (max-width: 500px) {
    .metric-grid { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
    .search-field, .filter-options, .filter-actions { grid-column: auto; }
    .filter-options { align-items: flex-start; flex-direction: column; }
    .page-header h1 { font-size: 34px; }
    .header-actions .button, .header-actions form { width: 100%; }
    .header-actions form .button { width: 100%; }
    .analysis-toggle span { display: none; }
    .assistant-selector select { max-width: 62vw; font-size: 11px; }
    .case-meta-grid { grid-template-columns: 1fr; }
    .landing-actions .ghost-on-dark { display: none; }
}

/* Small compatibility modifiers */
.outcome-pill.large { padding: 8px 12px; font-size: 13px; }
.reanalyze-form { display: flex; align-items: center; gap: 9px; }
.reanalyze-form select { min-width: 165px; }
.premium-result-card { border-top: 3px solid var(--brand-gold); }
.source-comparison { min-width: 0; }
.usage-card { min-width: 0; }
.gold-outline { border-color: #dfb45f; background: #fffaf0; }
@media (max-width: 600px) {
    .reanalyze-form { width: 100%; flex-direction: column; align-items: stretch; }
    .reanalyze-form select { min-width: 0; }
}

/* =========================================================
   EXPERIENCIA FINAL AUTOMÁTICA
   ========================================================= */
.final-user-nav { margin-top: 18px; }
.home-header { align-items: center; }
.home-header p { max-width: 650px; }

.auto-status-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid #cfe8dc;
    border-radius: 15px;
    background: linear-gradient(135deg, #f5fcf8, #fff);
    box-shadow: var(--shadow-sm);
}
.auto-status-card.warning-state { border-color: #f0d8a6; background: #fffaf0; }
.auto-status-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 50%; background: var(--success-soft); }
.auto-status-icon span { width: 10px; height: 10px; border-radius: 50%; background: #27ae7b; box-shadow: 0 0 0 6px rgba(39,174,123,.13); }
.warning-state .auto-status-icon { background: var(--warning-soft); }
.warning-state .auto-status-icon span { background: var(--warning); box-shadow: 0 0 0 6px rgba(168,101,0,.12); }
.auto-status-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.auto-status-copy strong { color: var(--brand-navy); font-size: 14px; }
.auto-status-copy span { color: var(--muted); font-size: 12px; }
.auto-progress-wrap { display: grid; grid-template-columns: auto 110px; align-items: center; gap: 10px; color: var(--brand-navy); font-size: 12px; font-weight: 800; }
.auto-progress { width: 110px; height: 6px; overflow: hidden; border-radius: 99px; background: #e6ecf3; }
.auto-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-light)); }

.end-user-metrics .metric-card { min-height: 122px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr); gap: 18px; }
.home-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.home-actions > a { display: flex; min-width: 0; gap: 12px; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.home-actions > a:hover { transform: translateY(-2px); border-color: #e0bd76; box-shadow: var(--shadow); }
.home-actions > a > span { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 10px; color: var(--brand-navy); background: #f7e4b8; font-size: 18px; }
.home-actions > a > div { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.home-actions strong { color: var(--brand-navy); font-size: 13px; }
.home-actions small { line-height: 1.45; }
.recent-list { display: flex; flex-direction: column; }
.recent-list > a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.recent-list > a:last-child { border-bottom: 0; }
.recent-list > a > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.recent-list strong { color: var(--brand-navy); font-size: 12px; }
.compact-empty { padding: 20px 0; color: var(--muted); font-size: 12px; }

.compact-auto-status { display: flex; min-width: 190px; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: var(--shadow-sm); }
.compact-auto-status > i { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: #39c28e; box-shadow: 0 0 0 5px rgba(57,194,142,.12); }
.compact-auto-status > div { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.compact-auto-status strong { color: var(--brand-navy); font-size: 11px; }
.compact-auto-status small { font-size: 9px; }
.jurisprudence-metrics { grid-template-columns: repeat(4, minmax(0,1fr)); }
.end-user-filter-card { margin-bottom: 18px; }
.simple-filters { grid-template-columns: minmax(300px, 2fr) minmax(130px, .65fr) minmax(170px, .85fr) auto auto; }
.review-filter { align-self: end; min-height: 43px; white-space: nowrap; }
.final-legal-table { min-width: 960px; }
.final-legal-table th:nth-child(1) { width: 215px; }
.final-legal-table th:nth-child(3) { width: 185px; }
.final-legal-table th:nth-child(4) { width: 115px; }
.final-legal-table th:last-child { width: 70px; }
.compact-button { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.status-pill.processing { color: #725008; background: #fff1c8; }
.case-processing-card { margin-top: -4px; }
.final-case-grid { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .55fr); }
.confidence-simple { display: flex; width: 78px; height: 78px; flex: 0 0 78px; align-items: center; justify-content: center; flex-direction: column; border: 6px solid #f1dfb5; border-radius: 50%; color: var(--brand-navy); }
.confidence-simple strong { font-size: 18px; }
.confidence-simple span { color: var(--muted); font-size: 9px; }
.case-facts { margin: 0; }
.case-facts > div { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.case-facts > div:last-child { border-bottom: 0; }
.case-facts dt { color: var(--muted); font-size: 11px; }
.case-facts dd { margin: 0; color: var(--brand-navy); font-size: 12px; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
.review-notice { margin-top: 15px; padding: 12px 14px; border: 1px solid #efd59d; border-radius: 11px; color: #77520d; background: #fff9eb; font-size: 12px; }
.manager-review-card { margin-top: 18px; border-style: dashed; }
.legal-details summary { color: var(--brand-navy); font-weight: 750; cursor: pointer; }
.legal-details[open] summary { margin-bottom: 16px; }

.final-library-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
.collection-card { margin-bottom: 18px; }
.final-inline-form { grid-template-columns: minmax(180px,.8fr) minmax(260px,1.4fr) auto; }
.collection-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 10px; margin-top: 16px; }
.collection-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.collection-list article > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.collection-list strong { color: var(--brand-navy); font-size: 12px; }
.collection-list article > span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.final-document-table { min-width: 760px; }

.final-chat-layout { grid-template-columns: 230px minmax(0,1fr); }
.final-chat-header { min-height: 64px; }
.chat-brand-title { display: flex; align-items: center; gap: 10px; }
.chat-brand-title img { width: 38px; height: 38px; border-radius: 10px; }
.chat-brand-title > div { display: flex; flex-direction: column; gap: 2px; }
.chat-brand-title strong { color: var(--brand-navy); font-family: Georgia, "Times New Roman", serif; font-size: 17px; letter-spacing: .03em; }
.chat-brand-title small { font-size: 10px; }
.final-chat-welcome { max-width: 850px; }
.final-prompt-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.final-prompt-grid button { min-height: 106px; }

@media (max-width: 1180px) {
    .home-grid { grid-template-columns: 1fr; }
    .home-actions { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .simple-filters { grid-template-columns: minmax(260px,2fr) repeat(2,minmax(130px,1fr)); }
    .review-filter, .simple-filters .filter-actions { grid-column: auto; }
    .final-case-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .home-actions { grid-template-columns: 1fr; }
    .jurisprudence-metrics, .final-library-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .compact-auto-status { width: 100%; }
    .simple-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .simple-filters .search-field { grid-column: 1 / -1; }
    .final-inline-form { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .auto-status-card { align-items: flex-start; }
    .auto-progress-wrap { display: none; }
    .jurisprudence-metrics, .final-library-metrics { grid-template-columns: 1fr 1fr; }
    .simple-filters { grid-template-columns: 1fr; }
    .simple-filters .search-field { grid-column: auto; }
    .review-filter { align-self: auto; }
    .final-prompt-grid { grid-template-columns: 1fr; }
    .final-chat-layout { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
    .jurisprudence-metrics, .final-library-metrics { grid-template-columns: 1fr; }
    .auto-status-card { padding: 14px; }
    .home-actions > a { padding: 14px; }
}

/* =========================================================
   Aristotlex — arquitectura de tres módulos jurídicos
   ========================================================= */
.module-sidebar-nav { gap: 7px; }
.module-nav-group { border: 1px solid transparent; border-radius: 12px; overflow: hidden; }
.module-nav-group[open] { border-color: rgba(240,201,107,.18); background: rgba(255,255,255,.035); }
.module-nav-summary { display: grid; grid-template-columns: 22px minmax(0,1fr) 18px; align-items: center; gap: 10px; padding: 11px 12px; color: #cad4e4; cursor: pointer; list-style: none; font-size: 13px; font-weight: 720; }
.module-nav-summary::-webkit-details-marker { display: none; }
.module-nav-summary:hover, .module-nav-summary.active { color: #fff; background: rgba(255,255,255,.05); }
.module-nav-summary i { color: #7e8ca3; font-style: normal; transition: transform .18s ease; }
.module-nav-group[open] .module-nav-summary i { transform: rotate(180deg); }
.module-nav-links { display: flex; flex-direction: column; gap: 2px; padding: 1px 8px 9px 43px; }
.module-nav-links a { position: relative; padding: 7px 9px; border-radius: 8px; color: #92a1b8; font-size: 11px; }
.module-nav-links a:hover, .module-nav-links a.active { color: #fff; background: rgba(255,255,255,.055); }
.module-nav-links a.active::before { content: ""; position: absolute; left: -8px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand-gold-light); }

.module-home-header { margin-bottom: 28px; }
.module-selector-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.module-selector-card { position: relative; display: flex; min-width: 0; min-height: 420px; flex-direction: column; padding: 26px; overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.module-selector-card::after { content: ""; position: absolute; inset: auto -45px -75px auto; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, rgba(215,161,58,.14), transparent 68%); pointer-events: none; }
.module-selector-card:hover { transform: translateY(-3px); border-color: #e3c37f; transition: .18s ease; }
.module-card-icon, .module-hero-icon, .module-header-icon, .module-mini-icon { display: grid; place-items: center; color: var(--brand-navy); background: linear-gradient(145deg, #fff5d9, #e9b850); box-shadow: 0 10px 26px rgba(169,111,18,.18); }
.module-card-icon { width: 54px; height: 54px; margin-bottom: 24px; border-radius: 15px; font-size: 25px; }
.module-selector-card h2 { margin: 7px 0 10px; color: var(--brand-navy); font-size: 24px; line-height: 1.15; letter-spacing: -.035em; }
.module-selector-card > p { min-height: 74px; margin: 0; color: var(--muted); line-height: 1.6; }
.module-card-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 24px 0; }
.module-card-stats span { padding: 12px; border-radius: 12px; color: var(--muted); background: var(--surface-soft); font-size: 10px; }
.module-card-stats strong { display: block; margin-bottom: 3px; color: var(--brand-navy); font-size: 17px; }
.module-card-actions { display: flex; gap: 9px; margin-top: auto; }
.module-card-actions .button { flex: 1; }
.module-separation-note { display: flex; align-items: center; gap: 13px; margin-top: 20px; padding: 16px 18px; border: 1px solid #d7e7df; border-radius: 15px; background: #f5fcf8; }
.module-note-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; color: #fff; background: #1c936b; }
.module-separation-note strong { color: var(--brand-navy); }
.module-separation-note p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.module-hero { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; padding: 28px; border: 1px solid rgba(215,161,58,.22); border-radius: 22px; background: linear-gradient(135deg, #071a38, #0b2a55); box-shadow: 0 20px 50px rgba(6,22,47,.14); }
.module-hero-icon { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 20px; font-size: 34px; }
.module-hero-copy { min-width: 0; }
.module-hero-copy h1 { margin: 5px 0 8px; color: #fff; font-size: clamp(30px,3vw,46px); letter-spacing: -.045em; }
.module-hero-copy p { max-width: 820px; margin: 0; color: #b9c5d8; line-height: 1.6; }
.module-hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.module-hero .button.ghost { color: #fff; border-color: rgba(255,255,255,.18); }
.module-hero .button.ghost:hover { background: rgba(255,255,255,.08); }
.module-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.module-overview-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.75fr); gap: 18px; }
.module-prompt-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.module-prompt-list a { display: flex; min-width: 0; gap: 11px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.module-prompt-list a:hover { border-color: #e1bd73; background: #fffaf0; }
.module-prompt-list a > span { color: var(--brand-gold-dark); font-weight: 900; }
.module-prompt-list a > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.module-prompt-list strong { color: var(--brand-navy); font-size: 12px; }
.module-prompt-list small { display: -webkit-box; overflow: hidden; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.module-filter-summary, .facet-preview > div { display: flex; flex-wrap: wrap; gap: 7px; }
.module-filter-summary span, .facet-preview span { padding: 7px 10px; border: 1px solid #ead19a; border-radius: 999px; color: #805710; background: #fff8e8; font-size: 10px; font-weight: 800; }
.facet-preview { margin-top: 18px; }
.facet-preview > strong { display: block; margin-bottom: 8px; color: var(--brand-navy); font-size: 11px; }
.facet-preview span { color: var(--muted); border-color: var(--border); background: var(--surface-soft); font-weight: 650; }

.module-chat-content { height: 100vh; }
.module-chat-shell { display: grid; grid-template-columns: 276px minmax(0,1fr); width: 100%; height: 100vh; overflow: hidden; background: #fff; }
.module-conversation-panel { display: flex; min-width: 0; height: 100%; flex-direction: column; padding: 18px 14px; overflow: hidden; border-right: 1px solid var(--border); background: #f7f9fc; }
.module-chat-identity { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; padding: 3px 4px 12px; border-bottom: 1px solid var(--border); }
.module-mini-icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; font-size: 18px; }
.module-chat-identity > div:last-child { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.module-chat-identity span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.module-chat-identity strong { overflow: hidden; color: var(--brand-navy); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.chat-filter-box { margin: 13px 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.chat-filter-box summary { padding: 11px 12px; color: var(--brand-navy); cursor: pointer; font-size: 11px; font-weight: 800; }
.chat-filter-fields { display: grid; gap: 9px; padding: 0 11px 11px; }
.chat-filter-fields label span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 750; }
.chat-filter-fields select { padding: 8px 9px; border-radius: 9px; font-size: 10px; }
.module-conversation-panel .conversation-list { flex: 1; min-height: 0; overflow-y: auto; }
.module-library-shortcut { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding: 11px; border: 1px solid #e7cf98; border-radius: 11px; background: #fff9ea; }
.module-library-shortcut > span { color: var(--brand-gold-dark); font-size: 18px; }
.module-library-shortcut > div { display: flex; min-width: 0; flex-direction: column; }
.module-library-shortcut strong { color: var(--brand-navy); font-size: 10px; }
.module-library-shortcut small { font-size: 9px; }
.module-chat-workspace { display: grid; min-width: 0; height: 100vh; grid-template-rows: auto minmax(0,1fr) auto; background: #fff; }
.module-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.module-header-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; font-size: 18px; }
.module-messages-area { min-height: 0; padding: 28px clamp(22px,5vw,76px); overflow-y: auto; }
.module-chat-welcome { max-width: 940px; margin: 0 auto; padding: 24px 0 34px; text-align: center; }
.module-assistant-orb { display: grid; width: 66px; height: 66px; margin: 0 auto 16px; place-items: center; border: 1px solid #e5c16f; border-radius: 20px; color: var(--brand-navy); background: linear-gradient(145deg,#fff6de,#e7b449); box-shadow: 0 13px 32px rgba(169,111,18,.18); font-size: 28px; }
.module-chat-welcome h1 { margin: 8px 0 10px; color: var(--brand-navy); font-size: clamp(28px,3vw,42px); letter-spacing: -.045em; }
.module-chat-welcome > p { max-width: 720px; margin: 0 auto 22px; color: var(--muted); line-height: 1.6; }
.module-prompt-grid { grid-template-columns: repeat(2,minmax(0,1fr)); max-width: 850px; margin: 0 auto; }
.module-prompt-grid button { min-height: 118px; text-align: left; }
.module-composer-wrap { padding: 12px clamp(22px,5vw,76px) 13px; border-top: 1px solid var(--border); background: rgba(255,255,255,.96); }
.module-message-avatar { color: var(--brand-navy); border: 1px solid #e4bd65; background: #f6d889; font-weight: 900; }

.page-header-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.module-library-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.module-library-filter-panel { margin-bottom: 18px; padding: 15px 17px; }
.module-library-filters { display: grid; grid-template-columns: minmax(240px,1.6fr) repeat(2,minmax(130px,.7fr)) auto; gap: 10px; align-items: end; }
.module-library-filters label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; }
.module-document-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.module-document-card { display: flex; min-width: 0; min-height: 228px; flex-direction: column; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); }
.document-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.document-type { display: inline-flex; padding: 5px 7px; border-radius: 7px; color: var(--brand-navy); background: #f2dca9; font-size: 9px; font-weight: 900; }
.module-document-card h3 { margin: 16px 0 5px; overflow-wrap: anywhere; color: var(--brand-navy); font-size: 14px; line-height: 1.35; }
.module-document-card > p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.document-meta-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0; }
.document-meta-list span { padding: 5px 7px; border-radius: 999px; color: #58677e; background: #eaf0f6; font-size: 9px; }
.document-card-actions { display: flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.document-card-actions > a { color: var(--brand-navy-2); font-size: 10px; font-weight: 800; }
.module-empty-state { grid-column: 1 / -1; min-height: 250px; display: grid; place-items: center; align-content: center; }
.module-empty-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 15px; color: var(--brand-navy); background: #f2d99e; font-size: 24px; }
.module-empty-state h3 { margin: 13px 0 5px; color: var(--brand-navy); }
.module-empty-state p { max-width: 570px; margin: 0; }
.module-upload-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.module-file-drop, .full-field { grid-column: 1 / -1; }
.module-upload-dialog { width: min(720px,calc(100vw - 30px)); }

@media (max-width: 1180px) {
    .module-selector-grid { grid-template-columns: 1fr; }
    .module-selector-card { min-height: 0; }
    .module-card-stats { max-width: 430px; }
    .module-metrics, .module-library-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .module-overview-grid { grid-template-columns: 1fr; }
    .module-document-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .module-chat-shell { grid-template-columns: 220px minmax(0,1fr); }
    .module-library-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .module-library-filters label:first-child { grid-column: 1 / -1; }
    .module-prompt-list { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .module-hero { align-items: flex-start; flex-direction: column; padding: 22px; }
    .module-metrics, .module-library-metrics { grid-template-columns: 1fr 1fr; }
    .module-chat-shell { grid-template-columns: 1fr; }
    .module-conversation-panel { display: none; }
    .module-chat-header { padding-inline: 15px; }
    .module-messages-area, .module-composer-wrap { padding-inline: 15px; }
    .module-prompt-grid { grid-template-columns: 1fr; }
    .module-document-grid { grid-template-columns: 1fr; }
    .module-upload-grid { grid-template-columns: 1fr; }
    .module-file-drop, .full-field { grid-column: auto; }
}
@media (max-width: 500px) {
    .module-metrics, .module-library-metrics { grid-template-columns: 1fr; }
    .module-card-actions, .module-hero-actions { flex-direction: column; }
    .module-library-filters { grid-template-columns: 1fr; }
    .module-library-filters label:first-child { grid-column: auto; }
}


/* Lambda brand assets */
.sidebar-brand-mark, .mobile-brand img { object-fit: contain; background: transparent; }
.auth-logo img { width: min(420px, 88vw); height: auto; object-fit: contain; }
