:root{font-family:"Segoe UI",system-ui,sans-serif;color:#172033;background:#f6f7fa;font-size:14px;line-height:1.5;--accent:#315ec9;--accent-dark:#21479f;--accent-soft:#eaf0ff;--line:#dfe4ed;--muted:#637086;--surface:#fff;--danger:#b02a3c;--warning:#8b5b13}*{box-sizing:border-box}html{background:#f6f7fa}body{margin:0 auto;padding:18px;max-width:680px;min-width:0}button,input,textarea,select{font:inherit}button{width:100%;min-height:42px;border:0;border-radius:10px;padding:10px 14px;background:var(--accent);color:#fff;cursor:pointer;font-weight:650;transition:background .15s ease,transform .15s ease,box-shadow .15s ease}button:hover{background:var(--accent-dark)}button:active{transform:translateY(1px)}button:disabled{opacity:.55;cursor:not-allowed;transform:none}.secondary{background:#eef1f6;color:#263a5e}.secondary:hover{background:#e0e6f0}.icon-button,.help-button{width:auto;min-height:34px;margin:0;padding:6px 11px;background:transparent;color:#40506a;border:1px solid var(--line)}.icon-button{border:0;font-size:24px;line-height:1;padding:2px 7px}.help-button:hover,.icon-button:hover{background:#eef2f8;color:#172033}input,textarea,select{width:100%;border:1px solid #bcc7d8;background:#fff;color:inherit;border-radius:10px;padding:11px 12px;min-width:0}input:hover,textarea:hover,select:hover{border-color:#93a3bb}textarea{min-height:112px;resize:vertical}label{display:block;margin:17px 0 6px;font-weight:650;color:#28354b}small,.note{display:block;font-size:12px;color:var(--muted);overflow-wrap:anywhere}small{margin-top:6px}p{color:#56637a;overflow-wrap:anywhere}a{display:inline-block;color:#2855bd;font-size:12px;margin-top:8px;text-underline-offset:2px}h1,h2,h3{color:#172033;letter-spacing:-.02em}h1{font-size:24px;line-height:1.15;margin:5px 0 0}h2{font-size:20px;line-height:1.25;margin:5px 0 8px}h3{font-size:16px;margin:0}.app-header{padding:4px 1px 13px}.app-header>p{font-size:13px;margin:8px 0 0}.brand-row,.dialog-head,.result-heading,.progress-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.badge,.eyebrow,.step-label,.result-label{font-size:10px;letter-spacing:1.45px;font-weight:750;color:#4165b6}.brand-mark{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:var(--accent);color:#fff;font-size:18px;font-weight:750}.status-bar{position:sticky;top:0;z-index:10;display:flex;align-items:flex-start;gap:8px;margin:0 -6px 12px;padding:10px 12px;border:1px solid #cfe0d5;border-radius:10px;background:#f4fbf6;color:#285e3f;font-size:12px;box-shadow:0 4px 14px rgba(25,39,62,.07);overflow-wrap:anywhere}.status-dot{flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:#3a9b62;margin-top:5px}.status-bar.error{border-color:#efd0d5;background:#fff5f6;color:var(--danger)}.status-bar.error .status-dot{background:#d4465b}fieldset{border:0;padding:0;margin:0;min-width:0}.tabs{position:relative;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin:0 -4px 16px;padding:5px;background:rgba(246,247,250,.96);border:1px solid var(--line);border-radius:13px}.tabs button{display:flex;align-items:center;justify-content:center;gap:6px;min-height:40px;margin:0;padding:7px 5px;background:transparent;color:#58657a;font-size:12px}.tabs button span{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#e5e9f0;color:#59677c;font-size:11px}.tabs button[aria-pressed=true]{background:#fff;color:#21499f;box-shadow:0 2px 8px rgba(29,52,92,.11)}.tabs button[aria-pressed=true] span{background:var(--accent);color:#fff}.section-heading{margin:4px 0 18px}.section-heading p{font-size:13px;margin:0}.setup-card{border-style:dashed;background:#fbfcfe}.setup-card summary{display:flex;align-items:center;justify-content:space-between;gap:10px}.setup-card summary small{margin:0;font-weight:400}details{background:var(--surface);border:1px solid var(--line);padding:14px;border-radius:12px;margin:14px 0}summary{cursor:pointer;font-weight:650;color:#29364c}summary::marker{color:#6d7b90}details>button,#useSelection,#loadSource,#clearHistory,#apply,#discard{margin-top:10px}.privacy{background:#eff5ff;border-left:3px solid #7092dd;padding:10px 11px;border-radius:0 8px 8px 0}.primary-action{margin-top:14px;box-shadow:0 5px 12px rgba(49,94,201,.2)}.actions{display:flex;gap:8px;margin-top:10px}.actions>*{flex:1;min-width:0}.date-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.date-grid label{margin-top:12px}.reference-controls{display:grid;grid-template-columns:minmax(90px,1fr) 2fr;gap:8px;align-items:end}.reference-controls button{margin:0}.progress-panel{background:#fff;border:1px solid #bfd0f2;border-radius:12px;padding:14px;margin:8px 0 16px;box-shadow:0 8px 22px rgba(35,49,69,.1)}.progress-heading span{color:var(--muted);font-variant-numeric:tabular-nums}.progress-panel progress{width:100%;height:8px;margin:12px 0 4px;accent-color:var(--accent)}.progress-panel p{font-size:12px;margin:5px 0}.progress-panel button{margin-top:8px}.source-card{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px;margin:10px 0;overflow-wrap:anywhere}.source-card h3{font-size:14px;margin:0 0 6px}.source-card .excerpt{white-space:pre-wrap;font-size:13px}.output{white-space:pre-wrap;overflow-wrap:anywhere;background:#fbfcfe;border:1px solid var(--line);border-radius:10px;padding:14px;margin:12px 0;max-height:52vh;overflow-y:auto}.result-card{margin:18px 0;padding:16px;background:#fff;border:1px solid #b9c9eb;border-radius:14px;box-shadow:0 8px 26px rgba(32,57,104,.1)}.result-heading{align-items:center}.review-chip{font-size:10px;white-space:nowrap;color:var(--warning);background:#fff5df;border-radius:999px;padding:5px 8px}.check{display:flex;align-items:flex-start;gap:9px;font-size:12px}.check input{width:auto;margin-top:4px}#caseText{min-height:190px}.chat-turn{border-left:3px solid #c8d5ef;padding:2px 0 2px 11px;white-space:pre-wrap;overflow-wrap:anywhere;margin:14px 0}.chat-turn strong{display:block;color:#2855bd}.error{color:var(--danger)!important}nav,section{min-width:0}#answer{white-space:pre-wrap;overflow-wrap:anywhere;padding:14px;background:#fbfcfe;border:1px solid var(--line);border-radius:10px}#original{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:8px}footer{font-size:11px;text-align:center;color:#778398;margin:26px 0 10px}#previewBanner{border:1px solid #deb451;padding:10px;background:#fff8df;font-size:12px;margin-bottom:12px}dialog{width:min(420px,calc(100% - 28px));border:0;border-radius:18px;padding:20px;box-shadow:0 24px 70px rgba(17,31,57,.3);color:#172033}dialog::backdrop{background:rgba(16,25,42,.55);backdrop-filter:blur(2px)}dialog h2{font-size:23px}.welcome-steps{list-style:none;padding:0;margin:20px 0}.welcome-steps li{display:flex;gap:12px;margin:14px 0}.welcome-steps li>span{display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;border-radius:50%;background:var(--accent-soft);color:var(--accent-dark);font-weight:750}.welcome-steps p{margin:2px 0;font-size:12px}.welcome-steps strong{font-size:13px}dialog>button{margin-top:8px}dialog>small{text-align:center;margin-top:10px}input:focus-visible,textarea:focus-visible,select:focus-visible,button:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid #a8c0fa;outline-offset:2px}[hidden]{display:none!important}@media(max-width:380px){body{padding:12px}.actions,.date-grid,.reference-controls{display:block}.actions button,.reference-controls button{margin-top:8px}.tabs button{font-size:11px}.tabs button span{display:none}.setup-card summary{display:block}.setup-card summary small{margin-top:2px}.result-heading{align-items:flex-start;display:block}.review-chip{display:inline-block;margin-top:7px}}
.markdown-body{white-space:normal;overflow-wrap:anywhere}.markdown-body>:first-child{margin-top:0}.markdown-body>:last-child{margin-bottom:0}.markdown-body p{margin:8px 0;color:inherit}.markdown-body h1{font-size:21px}.markdown-body h2{font-size:18px}.markdown-body h3{font-size:16px}.markdown-body h4{font-size:14px}.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4{margin:16px 0 7px}.markdown-body ul,.markdown-body ol{padding-left:22px;margin:8px 0}.markdown-body li{margin:4px 0}.markdown-body blockquote{margin:10px 0;padding:8px 12px;border-left:3px solid #7795d8;background:#f0f4fc;color:#42516a}.markdown-body code{font-family:Consolas,monospace;background:#eef1f5;border-radius:4px;padding:1px 4px;font-size:.92em}.markdown-body pre{overflow:auto;background:#202938;color:#eef3ff;border-radius:8px;padding:12px}.markdown-body pre code{background:transparent;padding:0;color:inherit}.markdown-body hr{border:0;border-top:1px solid var(--line);margin:14px 0}.markdown-body a{font-size:inherit;margin:0}.chat-turn.user .markdown-body{color:#3d4b61}.chat-turn.assistant{border-left-color:#557bd3}
.source-strip{position:sticky;top:100px;z-index:12;display:flex;align-items:center;gap:8px;min-height:42px;padding:7px 10px;background:#fff;border:1px solid var(--line);border-radius:11px;box-shadow:0 5px 16px rgba(25,39,62,.09)}.source-strip a{margin:0;font-size:12px;font-weight:650;flex:1}.source-strip span{font-size:12px;color:var(--muted);flex:1}.source-strip button{flex:0 0 auto}.source-loader{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;margin:8px 0}.source-loader button{width:auto}.chat-workspace{box-shadow:0 6px 20px rgba(32,57,104,.07)}.chat-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.text-button{width:auto;min-height:30px;padding:4px 8px;background:transparent;color:#315ec9}.text-button:hover{background:var(--accent-soft)}.chat-history{margin:14px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:4px 0}.chat-empty{font-size:12px;color:var(--muted);margin:12px 0}.chat-turn.pending{opacity:.78}.chat-utilities{margin-top:8px}.case-tools{position:fixed;left:50%;bottom:8px;transform:translateX(-50%);z-index:30;width:min(calc(100% - 24px),644px);display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:0;padding:5px;background:#e9edf4;border:1px solid #d6dce7;border-radius:13px;box-shadow:0 8px 28px rgba(25,39,62,.2)}.case-tools button{min-height:44px;padding:6px 3px;background:transparent;color:#56647a;font-size:11px;line-height:1.2}.case-tools button[aria-pressed=true]{background:#fff;color:#21499f;box-shadow:0 2px 7px rgba(29,52,92,.11)}.tool-panel{background:#fff;border:1px solid var(--line);border-radius:12px;padding:15px;margin:12px 0 84px}.tool-panel h3{margin-bottom:12px}@media(max-width:380px){.source-loader{grid-template-columns:1fr}.source-loader button{width:100%}.case-tools{width:calc(100% - 16px)}.case-tools button{font-size:10px}}
.heading-with-tip{display:flex;align-items:center;gap:8px}.heading-with-tip h2{margin:0}.info-tip{display:inline-grid;place-items:center;width:18px;height:18px;border-radius:50%;background:#e2e8f0;color:#64748b;font-size:11px;font-weight:700;cursor:help;position:relative;user-select:none;flex-shrink:0;transition:all .15s ease}.info-tip:hover,.info-tip:focus{background:var(--accent);color:#fff}.info-tip:hover::after,.info-tip:focus::after{content:attr(aria-label);position:absolute;top:calc(100% + 6px);left:50%;transform:translateX(-50%);z-index:100;width:max(180px,min(240px,70vw));background:#1e293b;color:#f8fafc;font-size:11.5px;font-weight:400;line-height:1.4;padding:8px 10px;border-radius:8px;box-shadow:0 6px 18px rgba(0,0,0,.22);pointer-events:none;white-space:normal}.info-tip:hover::before,.info-tip:focus::before{content:"";position:absolute;top:calc(100% + 1px);left:50%;transform:translateX(-50%);border:5px solid transparent;border-bottom-color:#1e293b;z-index:101}.brand-title h1{font-size:22px;font-weight:750;letter-spacing:-.03em;color:#172033;margin:0}.app-header{padding:2px 0 10px}.help-button{border-radius:50%;width:28px;height:28px;min-height:28px;padding:0;display:grid;place-items:center;font-weight:700;font-size:13px;border:1px solid var(--line);background:#fff;color:#64748b}.help-button:hover{border-color:#cbd5e1;color:var(--accent);background:#f8fafc}
.status-bar{display:block;margin:0 -6px 14px;padding:8px 12px;transition:all .2s ease}
.status-bar.searching{background:#ffffff;border-color:#bfdbfe;box-shadow:0 3px 12px rgba(37,99,235,.1);padding:6px 10px 5px}
.status-main{display:flex;align-items:center;gap:8px}
.status-bar .progress-panel{background:transparent;border:0;padding:0;margin:0;box-shadow:none}
.progress-compact-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.progress-left{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.search-spinner{width:16px;height:16px;border:2px solid #dbeafe;border-top-color:#2563eb;border-right-color:#38bdf8;border-radius:50%;animation:searchSpin .65s linear infinite;flex-shrink:0}
@keyframes searchSpin{to{transform:rotate(360deg)}}
.progress-text-block{min-width:0;flex:1}
.progress-title-row{display:flex;align-items:center;gap:6px;line-height:1.2}
.progress-title-row strong{font-size:12px;font-weight:700;color:#1e293b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.progress-time-pill{font-size:10.5px;font-weight:600;color:#2563eb;background:#eff6ff;padding:1px 5px;border-radius:999px;font-variant-numeric:tabular-nums;flex-shrink:0}
.status-bar #progressDetail{font-size:11px;color:#64748b;margin:1px 0 0;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cancel-search-btn{width:auto;min-height:24px;height:24px;padding:2px 8px;font-size:11px;font-weight:600;border-radius:6px;background:#f1f5f9;color:#475569;border:1px solid #cbd5e1;flex-shrink:0;transition:all .15s ease;cursor:pointer}
.cancel-search-btn:hover{background:#fee2e2;color:#dc2626;border-color:#fca5a5}
.progress-bar-wrapper{margin-top:5px;position:relative;overflow:hidden;border-radius:999px;height:3px;background:#e2e8f0}
.status-bar .progress-panel progress{display:block;width:100%;height:3px;margin:0;border:none;background:transparent;accent-color:#2563eb;-webkit-appearance:none;appearance:none}
.status-bar .progress-panel progress::-webkit-progress-bar{background:transparent}
.status-bar .progress-panel progress::-webkit-progress-value{background:linear-gradient(90deg,#2563eb,#38bdf8,#2563eb);background-size:200% 100%;animation:barShimmer 1.5s infinite linear;border-radius:999px;transition:width .35s ease}
.status-bar .progress-panel progress::-moz-progress-bar{background:linear-gradient(90deg,#2563eb,#38bdf8);border-radius:999px;transition:width .35s ease}
@keyframes barShimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
.progress-live-feed{display:none}
.results-area{margin-top:20px;padding-top:14px;border-top:2px solid var(--line);scroll-margin-top:60px}
.results-heading-row h3{font-size:16px;font-weight:700;color:#1e293b;margin:0 0 6px}
.search-count-text{font-size:12.5px;font-weight:600;color:#475569;margin:6px 0 12px}
.load-more-container{margin:14px 0 12px;text-align:center}
.load-more-btn{display:flex!important;align-items:center;justify-content:center;gap:8px;width:100%!important;min-height:42px!important;padding:10px 16px!important;font-size:13.5px!important;font-weight:650!important;color:#1e3a8a!important;background:#f0f7ff!important;border:1.5px solid #bfdbfe!important;border-radius:9px!important;cursor:pointer;transition:all .2s ease;box-shadow:0 1px 4px rgba(37,99,235,.08)}
.load-more-btn:hover{background:#dbeafe!important;color:#1d4ed8!important;border-color:#93c5fd!important;box-shadow:0 3px 8px rgba(37,99,235,.15);transform:translateY(-1px)}
.load-more-btn:active{transform:translateY(0)}
.load-more-btn:disabled{opacity:.65;cursor:not-allowed;background:#f8fafc!important;color:#64748b!important;border-color:#e2e8f0!important;box-shadow:none!important;transform:none!important}
.clean-refs-check{margin:12px 0 6px;padding:6px 9px;background:#f8fafc;border:1px solid var(--line);border-radius:8px;cursor:pointer;font-weight:600;color:#334155}
.clean-refs-check input{cursor:pointer}
.turn-actions{display:flex;gap:6px;margin-top:8px}
.turn-actions button{width:auto;min-height:30px;padding:4px 10px;font-size:11.5px;border-radius:7px}
.turn-actions .secondary{background:#eef2f8;color:#273b5e}
.chat-turn details{background:rgba(240,244,250,.5);border:1px solid var(--line);padding:8px 10px;border-radius:8px;margin:8px 0;font-size:12px}
.chat-turn details summary{font-size:11.5px;color:#475569}
.editor-controls-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:6px}
.editor-controls-row label{margin-top:6px}

/* Auth & Plans UI */
.header-actions{display:flex;align-items:center;gap:6px}
.user-profile-button{display:inline-flex;align-items:center;justify-content:center;gap:5px;width:auto;min-height:28px;height:28px;padding:3px 12px;font-size:12px;font-weight:600;border-radius:999px;background:#eef2fa;color:#284b96;border:1px solid #ccd8ec;cursor:pointer;transition:all .15s ease}
.user-profile-button:hover{background:#dfe9f8;color:#183575;border-color:#b4c7e7}
.user-profile-icon{font-size:12px;line-height:1}
.plans-user-account-card{display:flex;align-items:center;gap:10px;background:#ffffff;border:1px solid #cbd5e1;border-radius:12px;padding:10px 14px;margin:12px 0 14px;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.user-avatar-circle{width:36px;height:36px;border-radius:50%;background:#2563eb;color:#ffffff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px;flex-shrink:0}
.user-account-details{display:flex;flex-direction:column;overflow:hidden;flex:1}
.user-account-details strong{font-size:13.5px;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.plans-user-email{font-size:12px;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user-status-pill{font-size:11px;font-weight:700;color:#059669;background:#ecfdf5;border:1px solid #a7f3d0;border-radius:999px;padding:2px 8px;flex-shrink:0}
.usage-badge{display:inline-block;font-size:11px;font-weight:650;color:#2563eb;background:#eff6ff;border:1px solid #bfdbfe;border-radius:999px;padding:2px 8px;margin-left:6px;vertical-align:middle}
.usage-badge-container{display:inline-flex;align-items:center;flex-wrap:wrap;gap:5px;margin-top:4px}
.usage-pill{display:inline-flex;align-items:center;font-size:11px;font-weight:700;border-radius:999px;padding:2.5px 8px;line-height:1.2;cursor:default}
.plan-pill{background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe}
.stat-pill{background:#f8fafc;color:#334155;border:1px solid #cbd5e1}
.stat-pill:hover{background:#f1f5f9;border-color:#94a3b8}
.app-dialog{max-width:440px;width:92vw}
.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;background:#f1f5f9;padding:4px;border-radius:10px;margin:14px 0 16px}
.auth-tab{min-height:34px;height:34px;background:transparent;color:#64748b;font-size:13px;border-radius:8px;padding:0}
.auth-tab[aria-selected=true]{background:#fff;color:#1e293b;box-shadow:0 1px 4px rgba(0,0,0,.08)}
.google-auth-section{margin:10px 0 14px}
.google-btn-wrapper{margin-bottom:12px}
.google-sign-in-btn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:42px;padding:8px 16px;font-size:13.5px;font-weight:600;color:#1f2937;background:#ffffff;border:1.5px solid #d1d5db;border-radius:9px;cursor:pointer;transition:all .2s ease;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.google-sign-in-btn[hidden]{display:none!important}
.google-sign-in-btn:hover{background:#f9fafb;border-color:#9ca3af;box-shadow:0 2px 6px rgba(0,0,0,.1);transform:translateY(-1px)}
.google-sign-in-btn:active{transform:translateY(0)}
.google-icon{flex-shrink:0}
.auth-divider{display:flex;align-items:center;text-align:center;margin:12px 0 6px;color:#64748b;font-size:11.5px;font-weight:500}
.auth-divider::before,.auth-divider::after{content:'';flex:1;border-bottom:1px solid #e2e8f0}
.auth-divider span{padding:0 10px}
.auth-form{display:flex;flex-direction:column;gap:4px}
.auth-form input{margin-bottom:8px}
.error-text{color:#dc2626;font-size:12px;font-weight:600;margin-top:10px;text-align:center}
.current-plan-card{background:#ffffff;border:1.5px solid #cbd5e1;border-radius:14px;padding:15px;margin:12px 0 16px;box-shadow:0 2px 8px rgba(0,0,0,.04)}
.current-plan-top-row{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #f1f5f9}
.current-plan-title-block strong{font-size:16px;font-weight:800;color:#0f172a;display:block}
.plan-meta-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:14px}
@media(max-width:360px){.plan-meta-grid{grid-template-columns:1fr}}
.meta-box{background:#f8fafc;border:1px solid #e2e8f0;border-radius:9px;padding:8px 10px}
.meta-box-label{display:block;font-size:10.5px;font-weight:600;color:#64748b;margin-bottom:3px}
.meta-box-value{display:block;font-size:12px;font-weight:700;color:#1e293b}
.usage-bars-container{display:flex;flex-direction:column;gap:10px}
.usage-bar-row{display:flex;flex-direction:column;gap:4px}
.usage-bar-labels{display:flex;justify-content:space-between;font-size:11.5px;color:#475569}
.usage-bar-labels strong{color:#0f172a}
.custom-progress-track{height:6px;background:#e2e8f0;border-radius:999px;overflow:hidden}
.custom-progress-fill{height:100%;background:#2563eb;border-radius:999px;transition:width .3s ease}
.plans-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0}
@media(max-width:400px){.plans-grid{grid-template-columns:1fr}}
.plan-card{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:14px 12px;display:flex;flex-direction:column;position:relative}
.plan-card.featured{border-color:#3b82f6;background:#fbfdff;box-shadow:0 4px 14px rgba(59,130,246,.12)}
.plan-badge{position:absolute;top:-9px;right:10px;background:#2563eb;color:#fff;font-size:10px;font-weight:700;padding:2px 7px;border-radius:999px;letter-spacing:.3px}
.plan-card h4{margin:0 0 6px;font-size:14px;color:#0f172a}
.plan-price{font-size:18px;font-weight:800;color:#1e293b;margin-bottom:10px}
.plan-price small{font-size:11px;font-weight:500;color:#64748b}
.plan-features{list-style:none;padding:0;margin:0 0 14px;font-size:11.5px;color:#334155;line-height:1.4;display:flex;flex-direction:column;gap:5px;flex:1}
.plan-card button{min-height:36px;height:36px;font-size:12px;padding:4px 8px;border-radius:8px;margin-top:auto}
.plan-card button.plan-active-btn{background:#ecfdf5!important;color:#065f46!important;border:1.5px solid #a7f3d0!important;cursor:default!important;opacity:1!important;font-weight:700!important;box-shadow:none!important;transform:none!important}
.plan-card button.plan-active-btn:hover{background:#ecfdf5!important;color:#065f46!important;cursor:default!important}
.dialog-actions-footer{margin-top:16px;padding-top:10px;border-top:1px solid #e2e8f0;text-align:right}
.danger-text{color:#dc2626!important}

/* Pantallas completas de Onboarding / Bienvenida y Planes */
.view-screen{display:flex;flex-direction:column;min-height:100vh;padding:24px 18px;background:#fcfdff;box-sizing:border-box}
.welcome-hero{text-align:center;margin:18px 0 24px}
.brand-badge{width:56px;height:56px;margin:0 auto 12px;background:linear-gradient(135deg,#2563eb,#1d4ed8);color:#fff;border-radius:16px;display:flex;align-items:center;justify-content:center;font-size:28px;font-weight:800;box-shadow:0 6px 18px rgba(37,99,235,.28);letter-spacing:-.5px}
.brand-badge.small{width:40px;height:40px;font-size:20px;border-radius:12px;margin-bottom:8px}
.welcome-hero h1{font-size:24px;font-weight:800;color:#0f172a;margin:0 0 6px;letter-spacing:-.5px}
.hero-tagline{font-size:13px;color:#64748b;margin:0 0 10px;line-height:1.4}
.welcome-card-list{display:flex;flex-direction:column;gap:12px;margin:10px 0 24px}
.welcome-feature-card{display:flex;align-items:flex-start;gap:12px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:12px 14px;box-shadow:0 1px 3px rgba(0,0,0,.03)}
.feat-icon{font-size:22px;line-height:1;margin-top:2px}
.welcome-feature-card strong{display:block;font-size:13px;color:#1e293b;margin-bottom:2px}
.welcome-feature-card p{font-size:11.5px;color:#64748b;margin:0;line-height:1.35}
.welcome-actions{margin-top:auto;padding-top:14px;display:flex;flex-direction:column;gap:8px;text-align:center}
.hero-cta-btn{min-height:44px;height:44px;font-size:14px;font-weight:700;border-radius:10px;box-shadow:0 4px 12px rgba(37,99,235,.25)}

/* Vista de selección de Planes */
.plans-hero{text-align:center;margin:8px 0 16px}
.plans-hero h2{font-size:20px;font-weight:800;color:#0f172a;margin:0 0 4px}
.plans-container{display:flex;flex-direction:column;gap:12px;margin-bottom:18px}
.plan-header{margin-bottom:8px}
.plan-header h4{margin:0 0 4px;font-size:15px;color:#0f172a}
.plans-footer-actions{display:flex;justify-content:space-between;align-items:center;padding-top:10px;border-top:1px solid #e2e8f0;margin-top:auto}

/* Pantalla de carga y detección inicial (anti-parpadeos) */
.app-splash-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fc;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

body.landing-mode .app-splash-loader,
html.preload-dark .app-splash-loader {
  background: #090d16;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.splash-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
  animation: splashPulse 1.6s ease-in-out infinite;
}

.splash-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: splashSpin 0.75s linear infinite;
}

.splash-text {
  font-size: 13px;
  font-weight: 600;
  color: #556987;
  letter-spacing: 0.2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.landing-mode .splash-text,
html.preload-dark .splash-text {
  color: #94a3b8;
}

.app-splash-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes splashSpin {
  to { transform: rotate(360deg); }
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Enhanced Source Card & Sumarios Forenses */
.source-card {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 14px 15px;
  margin: 14px 0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  overflow-wrap: anywhere;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.source-card:hover {
  border-color: #b8c8dc;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}
.card-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 11px;
  color: #475569;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid #f1f5f9;
}
.meta-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meta-label {
  font-weight: 750;
  text-transform: uppercase;
  color: #2563eb;
  letter-spacing: 0.3px;
  font-size: 10px;
}
.meta-val {
  font-weight: 600;
  color: #1e293b;
}
.card-title {
  font-size: 14px;
  font-weight: 750;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.35;
}
.card-sintesis-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #005a9c;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 0 10px;
  max-height: 155px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}
.card-sintesis-box::-webkit-scrollbar {
  width: 5px;
}
.card-sintesis-box::-webkit-scrollbar-track {
  background: #f8fafc;
}
.card-sintesis-box::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 3px;
}
.card-sintesis-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #005a9c;
  margin-bottom: 5px;
}
.card-sintesis {
  font-size: 12px;
  line-height: 1.55;
  color: #1e293b;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.card-voces-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 10px;
}
.voce-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.voce-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}
.no-doctrinas-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 5px 8px;
  margin: 4px 0 10px;
}
.no-doctrinas-hint span {
  font-weight: 500;
}
.btn-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  vertical-align: middle;
}
.source-card-toolbar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0 4px;
  padding-top: 9px;
  border-top: 1px solid #eef2f6;
}
.toolbar-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.toolbar-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}
.toolbar-btn {
  width: 100% !important;
  box-sizing: border-box;
  min-height: 28px !important;
  height: 28px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 6px !important;
  border-radius: 6px !important;
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px;
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toolbar-btn:hover {
  background: #edf2f7;
  color: #0f172a;
  border-color: #94a3b8;
}
.toolbar-btn.primary {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.toolbar-btn.primary:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.toolbar-btn.ai-btn {
  background: #faf5ff;
  color: #6b21a8;
  border-color: #e9d5ff;
}
.toolbar-btn.ai-btn:hover {
  background: #f3e8ff;
  color: #581c87;
  border-color: #d8b4fe;
}
.inline-ai-actions .toolbar-btn {
  width: auto !important;
  padding: 0 12px !important;
}
.doctrinas-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 10px 0 4px;
  padding: 0;
  overflow: hidden;
}
.doctrinas-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 650;
  color: #1e40af;
  cursor: pointer;
  background: #f1f5f9;
  user-select: none;
  list-style: none;
}
.doctrinas-summary::-webkit-details-marker {
  display: none;
}
.doctrinas-summary:hover {
  background: #e2e8f0;
}
.doctrinas-count-pill {
  background: #dbeafe;
  color: #1e40af;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 750;
}
.doctrinas-list {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #fff;
}
.doctrina-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 9px;
  border-left: 3px solid #2563eb;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}
.doctrina-text {
  font-size: 12px;
  line-height: 1.45;
  color: #1e293b;
  margin: 0;
}
.doctrina-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.mini-btn {
  width: auto !important;
  min-height: 24px !important;
  height: 24px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 8px !important;
  border-radius: 5px !important;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mini-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.mini-btn.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.mini-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.inline-ai-box {
  background: #fbfbfe;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
}
.inline-ai-loading {
  font-size: 12px;
  color: #4f46e5;
  font-weight: 600;
  padding: 6px 0;
}
.inline-ai-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.toolbar-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 6px;
}
.secondary-toolbar-btn {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}
.secondary-toolbar-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* Modal Visor de Fallo Judicial / PDF */
.case-modal-dialog {
  max-width: 620px;
  width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  background: #fff;
}
.case-modal-body {
  overflow-y: auto;
  max-height: calc(88vh - 90px);
  margin-top: 10px;
  padding-right: 4px;
}
.case-modal-title {
  font-size: 15px;
  font-weight: 750;
  margin: 0 0 10px;
  line-height: 1.35;
  color: #0f172a;
}
.case-modal-section {
  margin: 14px 0;
}
.case-modal-section h4 {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.case-modal-text {
  font-size: 13px;
  line-height: 1.55;
  color: #1e293b;
  margin: 0;
}
.case-modal-section ul {
  margin: 4px 0 0;
  padding-left: 20px;
  color: #334155;
  font-size: 12.5px;
  line-height: 1.5;
}
.case-modal-section li {
  margin-bottom: 4px;
}
.case-modal-scrollable {
  font-size: 12.5px;
  line-height: 1.55;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.case-modal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

/* Haisslex brand system */
:root {
  --accent: #174a96;
  --accent-dark: #102d70;
  --accent-soft: #e8f7fb;
  --line: #d7e2ee;
  --muted: #607087;
  --surface: #ffffff;
  --brand-navy: #10245f;
  --brand-indigo: #2d1d74;
  --brand-cyan: #16c9d6;
  --brand-orange: #f68a32;
  --brand-magenta: #ed4e82;
}

html,
.view-screen { background: #f5f8fc; }

button,
.primary-action,
.mini-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}

button:hover,
.primary-action:hover,
.mini-btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

a,
.text-button,
.chat-turn strong { color: var(--accent); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px rgba(22, 201, 214, .14);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible,
a:focus-visible { outline-color: rgba(22, 201, 214, .55); }

.brand-mark,
.brand-badge,
.splash-logo,
.app-brand-logo {
  overflow: hidden;
  background: var(--brand-navy);
  border: 1px solid rgba(22, 201, 214, .45);
}

.brand-mark img,
.brand-badge img,
.splash-logo img,
.app-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark { padding: 0; }
.splash-logo { padding: 0; border-radius: 20px; }
.brand-badge { padding: 0; border-radius: 16px; box-shadow: 0 8px 22px rgba(16, 36, 95, .2); }
.brand-badge.small { border-radius: 12px; }

.brand-title-with-logo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.app-brand-logo {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.brand-title-copy { min-width: 0; }
.brand-title h1 { color: var(--brand-navy); }

.tabs button[aria-pressed=true],
.case-tools button[aria-pressed=true] { color: var(--accent-dark); }

.tabs button[aria-pressed=true] span,
.custom-progress-fill,
.plan-badge,
.user-avatar-circle { background: var(--accent); }

.privacy,
.doctrina-row { border-left-color: var(--brand-cyan); }

.status-bar.searching {
  border-color: #a9e6eb;
  box-shadow: 0 3px 12px rgba(22, 201, 214, .12);
}

.search-spinner {
  border-color: #cbeff2;
  border-top-color: var(--accent);
  border-right-color: var(--brand-cyan);
}

.status-bar .progress-panel progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--brand-cyan), var(--accent));
}

.status-bar .progress-panel progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--brand-cyan));
}

.plan-card.featured {
  border-color: #7ddce4;
  background: #f7fdfe;
  box-shadow: 0 4px 16px rgba(22, 201, 214, .12);
}

.review-chip {
  color: #8d4716;
  background: #fff3e8;
}


