:root {
    color-scheme: dark;
    --bg: #080d13;
    --panel: #0e1721;
    --panel-raised: #111d28;
    --line: #2a3948;
    --line-strong: #3a4c5d;
    --text: #edf4f4;
    --muted: #a7b4bc;
    --faint: #8798a4;
    --mint: #7bddc3;
    --mint-deep: #193d39;
    --amber: #edb870;
    --danger: #f4a28e;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", "PingFang SC", ui-sans-serif, system-ui, sans-serif; }
body { min-width: 320px; }
button, input { font: inherit; }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
h1:focus { outline: none; }
code { overflow-wrap: anywhere; color: #c3eee5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.knowledge-console { min-height: 100vh; background: radial-gradient(ellipse 70% 38% at 50% -12%, #1f615c42, transparent 70%), var(--bg); }
.console-header { min-height: 68px; padding: 0 clamp(18px, 3vw, 40px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; }
.wordmark { min-height: 44px; display: flex; gap: 10px; align-items: center; font-size: 12px; font-weight: 760; letter-spacing: .13em; white-space: nowrap; }
.wordmark em { color: var(--mint); font-style: normal; font-weight: 650; }
.wordmark-mark { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid var(--mint); border-radius: 7px; color: var(--mint); font-family: Georgia, serif; font-size: 18px; letter-spacing: 0; }
.environment-badge { margin-left: 3px; padding: 5px 7px; border: 1px solid #edb87080; border-radius: 4px; background: #edb87018; color: var(--amber); font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.header-nav { margin-left: auto; display: flex; align-self: stretch; gap: 6px; }
.header-nav a { min-height: 44px; padding: 0 12px; display: flex; align-items: center; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; }
.header-nav a:hover { color: var(--text); }
.header-nav a[aria-current="page"] { border-color: var(--mint); color: var(--text); }
.header-nav form { display: flex; align-items: center; margin: 0; }
.header-nav .secondary-button { margin: 0 0 0 6px; }
.state-panel a.secondary-button { display: inline-flex; align-items: center; text-decoration: none; }

.browser-shell { width: min(1460px, 100%); margin: 0 auto; padding: 32px clamp(18px, 3vw, 40px) 56px; }
.browser-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.eyebrow { color: #9babb4; font-size: 11px; font-weight: 760; letter-spacing: .11em; }
.browser-heading h1 { margin: 7px 0 8px; font-size: clamp(27px, 3vw, 40px); line-height: 1.08; letter-spacing: -.035em; }
.browser-heading p { max-width: 72ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.scope-state { min-height: 40px; padding: 9px 12px; display: flex; align-items: center; gap: 9px; border: 1px solid #315c56; border-radius: 6px; background: #12312e9c; color: #c5e7df; font-size: 12px; white-space: nowrap; }
.status-dot, .claim-state { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px #7bddc31c; }

.state-panel { min-height: 220px; padding: clamp(24px, 5vw, 54px); display: flex; align-items: flex-start; gap: 17px; border: 1px solid var(--line); border-radius: 9px; background: #0d151ecf; }
.state-panel h2 { margin: 1px 0 8px; font-size: 19px; }
.state-panel p { max-width: 66ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.state-panel.error-state { border-color: #6c493e; background: #24171466; }
.state-icon { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #9b5d4d; border-radius: 50%; color: var(--danger); font-weight: 800; }
.state-icon.quiet { border-color: var(--line-strong); color: var(--muted); }
.spinner { flex: 0 0 auto; width: 30px; height: 30px; border: 3px solid #31504d; border-top-color: var(--mint); border-radius: 50%; animation: spin .8s linear infinite; }
.correlation { margin-top: 9px !important; font-size: 12px !important; }
.secondary-button { min-height: 44px; margin-top: 18px; padding: 0 16px; border: 1px solid #49756e; border-radius: 6px; background: var(--mint-deep); color: #d7f2ec; font-size: 13px; font-weight: 700; }

.scope-summary { min-height: 72px; margin-bottom: 14px; padding: 12px 16px; display: grid; grid-template-columns: auto minmax(220px, 1fr) auto; gap: 24px; border: 1px solid var(--line); border-radius: 7px; background: #0d161f; }
.scope-summary div { min-width: 0; display: grid; align-content: center; gap: 4px; }
.scope-summary span { color: var(--faint); font-size: 11px; }
.scope-summary strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.scope-summary div:first-child strong { color: var(--mint); font-size: 20px; }
.scope-summary code { font-size: 11px; }

.workspace-grid { min-height: 600px; display: grid; grid-template-columns: minmax(340px, .85fr) minmax(440px, 1.4fr); overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.claim-list { min-width: 0; border-right: 1px solid var(--line); background: #0c141d; }
.list-header { min-height: 82px; padding: 18px 20px 13px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.list-header h2 { margin: 5px 0 0; font-size: 20px; }
.list-header > span { color: var(--faint); font-size: 12px; }
.search-box { min-height: 44px; margin: 0 18px 15px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: #080e15; color: var(--muted); }
.search-box:focus-within { border-color: var(--mint); box-shadow: 0 0 0 2px #7bddc338; }
.search-box input { min-width: 0; width: 100%; min-height: 42px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: #8596a2; opacity: 1; }
.claim-items { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.claim-items li { margin: 0; padding: 0; }
.claim-row { width: 100%; min-height: 88px; padding: 15px 17px; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: start; gap: 11px; border: 0; border-bottom: 1px solid #273645; background: transparent; text-align: left; }
.claim-row:hover { background: var(--panel-raised); }
.claim-row.selected { background: linear-gradient(90deg, #1c4d488c, #111d28); box-shadow: inset 3px 0 var(--mint); }
.claim-state { margin-top: 5px; box-shadow: none; }
.claim-copy { min-width: 0; display: grid; gap: 7px; }
.claim-copy strong { display: -webkit-box; overflow: hidden; color: #e3eeee; font-size: 13px; font-weight: 620; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.claim-copy small, .claim-row time { color: var(--faint); font-size: 11px; line-height: 1.4; }
.claim-row time { white-space: nowrap; }
.no-results { min-height: 180px; padding: 42px 20px; display: grid; align-content: start; justify-items: center; gap: 7px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }
.no-results strong { color: var(--text); font-size: 14px; }

.claim-detail { min-width: 0; padding: clamp(26px, 4vw, 54px); background: linear-gradient(140deg, #111d29e8, #080d13fa 68%); }
.detail-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.active-label { color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.active-label span { margin-right: 5px; font-size: 8px; }
.space-badge { max-width: 50%; overflow: hidden; padding: 5px 8px; border: 1px solid #3d5967; border-radius: 5px; color: #b8ccd4; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.claim-detail > h2 { max-width: 850px; margin: 22px 0 28px; font-size: clamp(24px, 2.6vw, 38px); line-height: 1.22; letter-spacing: -.035em; overflow-wrap: anywhere; }
.claim-metadata { margin: 0 0 30px; display: grid; grid-template-columns: auto auto minmax(180px, 1fr); border-block: 1px solid var(--line); }
.claim-metadata div { min-width: 0; padding: 14px 16px 14px 0; }
.claim-metadata div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.claim-metadata dt { margin-bottom: 5px; color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.claim-metadata dd { margin: 0; color: #c8d7db; font-size: 12px; overflow-wrap: anywhere; }
.claim-metadata code { font-size: 11px; }
.evidence-section { max-width: 820px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h3 { margin: 0; font-size: 15px; }
.section-heading span { color: var(--faint); font-size: 11px; }
.evidence-list { margin-top: 10px; border-top: 1px solid var(--line); }
.evidence-row { min-height: 68px; padding: 12px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 11px; border-bottom: 1px solid var(--line); }
.source-icon { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid #416171; border-radius: 6px; background: #132837; color: #a9d4e3; font-size: 11px; font-weight: 800; }
.evidence-row strong, .evidence-row small { display: block; overflow-wrap: anywhere; }
.evidence-row strong { color: #dce8ea; font-size: 13px; }
.evidence-row small { margin-top: 4px; color: var(--faint); font-size: 11px; }
.evidence-empty { color: var(--muted); font-size: 13px; }
.detail-footer { max-width: 820px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; line-height: 1.5; }
.detail-placeholder { min-height: 360px; display: grid; align-content: center; justify-items: center; color: var(--muted); text-align: center; }
.detail-placeholder > span { color: var(--mint); font-size: 24px; }
.detail-placeholder h2 { margin: 13px 0 7px; color: var(--text); font-size: 18px; }
.detail-placeholder p { max-width: 42ch; margin: 0; font-size: 13px; line-height: 1.5; }

.skip-link, .sr-only { position: absolute; }
.skip-link { z-index: 20; top: -60px; left: 14px; padding: 10px 13px; border-radius: 5px; background: var(--mint); color: #05201c; font-size: 13px; font-weight: 750; }
.skip-link:focus { top: 12px; }
.sr-only { width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
#blazor-error-ui { display: none; }

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

@media (max-width: 840px) {
    .browser-heading { align-items: flex-start; flex-direction: column; }
    .scope-summary { grid-template-columns: auto 1fr; }
    .scope-summary div:last-child { grid-column: 1 / -1; }
    .workspace-grid { grid-template-columns: minmax(300px, .8fr) minmax(380px, 1.2fr); }
    .claim-detail { padding: 30px 25px; }
    .claim-metadata { grid-template-columns: 1fr 1fr; }
    .claim-metadata div:last-child { grid-column: 1 / -1; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 680px) {
    .console-header { min-height: 62px; padding: 0 14px; }
    .environment-badge { display: none; }
    .header-nav a { padding-inline: 9px; font-size: 12px; }
    .header-nav a:first-child { display: none; }
    .browser-shell { padding: 24px 14px 42px; }
    .browser-heading h1 { font-size: 29px; }
    .scope-state { white-space: normal; }
    .scope-summary { grid-template-columns: 1fr; gap: 12px; }
    .scope-summary div:last-child { grid-column: auto; }
    .workspace-grid { display: block; min-height: 0; overflow: visible; }
    .claim-list { border-right: 0; border-bottom: 1px solid var(--line); }
    .claim-items { max-height: 390px; overflow: auto; }
    .claim-row { grid-template-columns: 8px minmax(0, 1fr); }
    .claim-row time { grid-column: 2; }
    .claim-detail { min-height: 460px; padding: 26px 18px; }
    .claim-detail > h2 { font-size: 26px; }
    .browser-heading p, .state-panel p, .detail-placeholder p, .evidence-empty { font-size: 16px; }
    .search-box input { font-size: 16px; }
    .claim-metadata { grid-template-columns: 1fr; }
    .claim-metadata div, .claim-metadata div + div, .claim-metadata div:last-child { grid-column: auto; padding: 12px 0; border-top: 1px solid var(--line); border-left: 0; }
    .claim-metadata div:first-child { border-top: 0; }
}

@media (max-width: 380px) {
    .console-header { flex-wrap: wrap; gap: 0 10px; padding-block: 6px; }
    .header-nav { width: 100%; margin-left: 0; justify-content: flex-end; }
    .header-nav a { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
