/* Unified cyberpunk UI theme */
:root {
    --bg: #070912;
    --bg-radial: #10172a;
    --panel: #0d1324;
    --panel-strong: #111a2f;
    --soft: #111827;
    --text: #e5f7ff;
    --muted: #8ea4bd;
    --line: rgba(64, 224, 255, 0.22);
    --line-strong: rgba(139, 92, 246, 0.42);
    --brand: #22d3ee;
    --brand-dark: #0891b2;
    --blue: #38bdf8;
    --violet: #8b5cf6;
    --magenta: #f472b6;
    --danger: #fb7185;
    --ok: #34d399;
    --warn: #facc15;
    --orange: #fb923c;
    --disabled: #64748b;
    --shadow: 0 0 28px rgba(34, 211, 238, 0.12);
    --shadow-strong: 0 0 34px rgba(139, 92, 246, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at 14% 0%, rgba(34, 211, 238, 0.12), transparent 30rem),
        radial-gradient(circle at 86% 6%, rgba(244, 114, 182, 0.1), transparent 28rem),
        linear-gradient(180deg, var(--bg-radial) 0%, var(--bg) 36rem);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 72%);
}

a {
    color: var(--brand);
    text-decoration: none;
    transition: color 140ms ease, text-shadow 140ms ease;
}

a:hover,
a:focus-visible {
    color: #a5f3fc;
    text-decoration: none;
    text-shadow: 0 0 14px rgba(34, 211, 238, 0.52);
}

h1,
h2,
h3 {
    color: #f8fdff;
    line-height: 1.15;
    letter-spacing: 0;
}

h1 {
    margin: 0 0 18px;
    font-size: clamp(28px, 4vw, 42px);
}

h2 {
    font-size: 22px;
}

h3 {
    font-size: 18px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: rgba(7, 9, 18, 0.88);
    border-bottom: 1px solid var(--line);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
}

.topbar strong {
    color: #f8fdff;
    font-size: 24px;
    font-weight: 800;
    text-shadow: 0 0 18px rgba(34, 211, 238, 0.28);
}

.topbar-brand,
.primary-navigation,
.primary-navigation > *,
.nav-links,
.shell,
.panel,
.case-hero > *,
.grid > *,
.responsive-grid > *,
.next-step-body > *,
.section-heading > *,
.action-row > *,
.metadata-row > *,
.processing-log-line > * {
    min-width: 0;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.topbar nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #dffbff;
    cursor: pointer;
    margin-left: 0;
    outline: none;
    text-shadow: 0 0 0 rgba(34, 211, 238, 0);
    transition:
        color 180ms ease,
        opacity 180ms ease,
        text-shadow 180ms ease,
        transform 180ms ease;
}

.topbar nav a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -4px;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.88), rgba(244, 114, 182, 0.58), transparent);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.44);
    opacity: 0;
    transform: scaleX(0.35);
    transform-origin: center;
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(34, 211, 238, 0.62),
        0 0 18px rgba(244, 114, 182, 0.24);
    transform: translateY(-1px);
}

.topbar nav a:active {
    color: #a5f3fc;
    transform: translateY(0);
}

.topbar nav a:hover::after,
.topbar nav a:focus-visible::after,
.topbar nav a:active::after {
    opacity: 1;
    transform: scaleX(1);
    box-shadow:
        0 0 10px rgba(34, 211, 238, 0.58),
        0 0 18px rgba(244, 114, 182, 0.18);
}

.shell {
    width: min(1180px, 100%);
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.panel,
.case-hero,
.metric,
.report-card {
    background: linear-gradient(180deg, rgba(17, 26, 47, 0.92), rgba(10, 16, 31, 0.94));
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
    min-width: 0;
    position: relative;
}

.case-hero {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
    padding: 22px;
    margin-bottom: 18px;
    border-color: var(--line-strong);
    box-shadow: var(--shadow-strong);
}

.case-hero h1 {
    margin: 4px 0 8px;
}

.case-workspace-header {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    min-width: 0;
}

.case-workspace-back {
    width: fit-content;
    color: var(--muted);
    font-size: 14px;
}

.case-workspace-heading {
    min-width: 0;
}

.case-workspace-heading h1 {
    margin: 0;
    font-size: clamp(26px, 3.2vw, 36px);
    overflow-wrap: anywhere;
}

.case-workspace-heading p {
    max-width: 72rem;
    margin: 7px 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.case-workspace-tabs {
    display: flex;
    gap: 4px;
    max-width: 100%;
    margin: 0 0 22px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.case-workspace-tabs a {
    flex: 0 0 auto;
    padding: 9px 12px 10px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    white-space: nowrap;
}

.case-workspace-tabs a:hover,
.case-workspace-tabs a:focus-visible {
    color: var(--text);
}

.case-workspace-tabs a.active {
    border-bottom-color: var(--brand);
    color: #f8fdff;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.38);
}

.case-workspace-placeholder {
    min-height: 180px;
    padding: 28px;
}

.case-workspace-placeholder h2 {
    margin-top: 0;
}

.case-workspace-placeholder p {
    max-width: 48rem;
}

.eyebrow {
    margin: 0;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

.notice,
.breadcrumbs,
.hero-meta,
.report-meta {
    color: var(--muted);
}

.breadcrumbs,
.hero-meta,
.report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.breadcrumbs {
    margin-bottom: 16px;
}

.next-step {
    display: block;
}

.next-step h2,
.section-heading h2 {
    margin: 0 0 6px;
}

.next-step-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    margin-top: 16px;
}

.next-step-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 80px;
    gap: 8px;
}

.next-step-stats .metric {
    min-height: 0;
    padding: 10px 12px;
    gap: 4px;
}

.next-step-stats .metric strong {
    font-size: 18px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-bottom: 18px;
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 34px;
}

.activity-terminal {
    position: relative;
    overflow: hidden;
    border-color: rgba(34, 211, 238, 0.42);
    background:
        linear-gradient(135deg, rgba(6, 10, 20, 0.97), rgba(12, 16, 34, 0.96)),
        radial-gradient(circle at 14% 12%, rgba(34, 211, 238, 0.14), transparent 14rem),
        radial-gradient(circle at 88% 4%, rgba(139, 92, 246, 0.12), transparent 12rem);
    box-shadow: var(--shadow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.activity-terminal-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.activity-terminal-header h2 {
    margin: 3px 0 6px;
}

.activity-list {
    display: grid;
    gap: 0;
    max-height: 440px;
    overflow: auto;
    padding: 8px 4px 8px 0;
    border-top: 1px solid rgba(64, 224, 255, 0.16);
    border-bottom: 1px solid rgba(64, 224, 255, 0.12);
}

.activity-item {
    display: grid;
    grid-template-columns: 54px 74px minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    min-height: 32px;
    padding: 7px 10px;
    border-left: 2px solid transparent;
    color: inherit;
    text-decoration: none;
    background: rgba(4, 8, 18, 0.28);
}

.activity-item:nth-child(even) {
    background: rgba(4, 8, 18, 0.46);
}

.activity-item:hover {
    border-left-color: rgba(34, 211, 238, 0.65);
    background: rgba(34, 211, 238, 0.07);
}

.activity-time,
.activity-kind,
.activity-message,
.activity-case-title,
.terminal-prompt,
.terminal-line {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    letter-spacing: 0;
}

.activity-time {
    color: #8fbfd0;
    font-size: 12px;
    white-space: nowrap;
}

.activity-kind {
    color: var(--brand);
    font-size: 11px;
    text-transform: uppercase;
}

.activity-kind-source {
    color: var(--violet);
}

.activity-kind-report {
    color: var(--ok);
}

.activity-kind-analysis {
    color: var(--magenta);
}

.activity-message {
    color: #e6fbff;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.activity-case-title {
    color: #fef08a;
}

.case-created-at {
    color: #a8d8ea;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.terminal-empty {
    display: grid;
    align-content: center;
    min-height: 220px;
    gap: 10px;
}

.terminal-empty h2 {
    margin: 0;
}

.terminal-line,
.terminal-prompt {
    color: #bff7ff;
    font-size: 13px;
}

.terminal-prompt {
    margin-top: 8px;
    color: var(--brand);
}

.chart-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 8px;
    color: var(--muted);
}

.chart-label strong {
    color: #f8fdff;
    font-size: 24px;
    text-shadow: 0 0 16px rgba(34, 211, 238, 0.28);
}

.dashboard-create-case-panel h2 {
    margin: 0 0 16px;
}

.dashboard-create-case-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    padding: 3px;
    font-size: 22px;
    line-height: 1;
}

.dashboard-create-case-panel {
    position: relative;
}

.dashboard-create-case-panel > summary {
    list-style: none;
    cursor: pointer;
}

.dashboard-create-case-panel > summary::-webkit-details-marker {
    display: none;
}

.dashboard-create-case-body {
    position: absolute;
    z-index: 5;
    right: 0;
    top: calc(100% + 10px);
    width: min(420px, calc(100vw - 48px));
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(8, 13, 25, 0.98);
    box-shadow: var(--shadow-strong);
}

.case-row__description {
    display: block;
    max-width: 48rem;
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.dashboard-empty-state {
    padding: 38px 20px;
    text-align: center;
}

.dashboard-delete-alert-stack {
    display: grid;
    gap: 10px;
    width: 100%;
    margin: 0 0 16px;
}

.dashboard-delete-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid rgba(52, 211, 153, 0.42);
    border-radius: 8px;
    background: rgba(6, 78, 59, 0.28);
    color: #a7f3d0;
}

.dashboard-delete-alert__message {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-delete-alert__icon {
    flex: 0 0 auto;
    color: #6ee7b7;
    font-weight: 700;
}

.dashboard-delete-alert__close {
    flex: 0 0 auto;
    align-self: flex-start;
    width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #a7f3d0;
    font-size: 22px;
    line-height: 1;
}

.dashboard-delete-alert__close:hover,
.dashboard-delete-alert__close:focus-visible {
    border-color: rgba(167, 243, 208, 0.5);
    background: rgba(167, 243, 208, 0.1);
}

.activity-terminal-secondary .activity-list {
    max-height: 260px;
}

.dashboard-create-form {
    display: grid;
    gap: 8px;
}

.dashboard-create-form input,
.dashboard-create-form select,
.dashboard-create-form textarea {
    margin-bottom: 8px;
}

.dashboard-create-form button {
    justify-self: start;
    margin-top: 4px;
}

.dashboard-stats {
    margin-bottom: 34px;
}

.section-gap {
    margin-top: 28px;
}

.workspace-shortcut {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    background: rgba(8, 13, 25, 0.58);
    box-shadow: none;
}

.workspace-shortcut h2,
.case-archive h2 {
    margin: 0 0 6px;
}

.case-archive {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-strong), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.case-archive table {
    margin-top: 12px;
}

.muted-help {
    margin: 0;
    color: var(--muted);
}

.metric {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    min-height: 108px;
    padding: 16px;
    color: var(--muted);
    line-height: 1.25;
}

.metric strong {
    display: block;
    margin-top: auto;
    color: #f8fdff;
    font-size: 28px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 18px rgba(34, 211, 238, 0.22);
}

table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: rgba(8, 13, 25, 0.62);
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    margin: 0;
}

.break-anywhere,
.notice,
.error,
td,
.summary-content,
.tg-working-doc,
.raw-message,
.li-card,
.report-card {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.technical-value,
td[data-source-field="title"] {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.case-archive-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}

.case-archive-col-space {
    width: 16%;
}

.case-archive-col-title {
    width: auto;
}

.case-archive-col-date {
    width: 150px;
}

.case-archive-col-status {
    width: 140px;
}

.case-archive-col-actions {
    width: 224px;
}

.case-archive-space,
.case-archive-title {
    overflow-wrap: anywhere;
}

.case-row__main,
.case-row__meta,
.case-row__actions {
    min-width: 0;
}

.case-row__title {
    display: inline;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(64, 224, 255, 0.14);
    text-align: left;
    vertical-align: top;
}

th {
    color: #a8d8ea;
    font-weight: 650;
    font-size: 13px;
    background: rgba(34, 211, 238, 0.06);
}

tbody tr {
    transition: background 140ms ease;
}

tbody tr:hover {
    background: rgba(34, 211, 238, 0.055);
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 999px;
    padding: 3px 9px;
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.status.processed,
.status.completed,
.status.ready_for_report,
.status.source_analysis_completed,
.status.report_generated,
.status.generated {
    border-color: rgba(52, 211, 153, 0.48);
    background: rgba(52, 211, 153, 0.13);
    color: #a7f3d0;
}

.status.active {
    border-color: rgba(52, 211, 153, 0.72);
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.54), rgba(16, 185, 129, 0.18));
    color: #bbf7d0;
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.28), inset 0 0 12px rgba(52, 211, 153, 0.08);
}

.status.pending,
.status.queued,
.status.pending_analysis {
    border-color: rgba(250, 204, 21, 0.5);
    background: rgba(250, 204, 21, 0.14);
    color: #fde68a;
}

.status.processing,
.status.waiting_provider,
.status.source_analysis_in_progress,
.status.report_generation_in_progress,
.status.in_progress {
    position: relative;
    gap: 7px;
    border-color: rgba(139, 92, 246, 0.56);
    background: rgba(59, 130, 246, 0.14);
    color: #c4b5fd;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.18);
}

.status.processing::before,
.status.source_analysis_in_progress::before,
.status.report_generation_in_progress::before,
.status.in_progress::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.72);
    animation: status-pulse 1.15s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% {
        opacity: 0.42;
        transform: scale(0.82);
    }
    50% {
        opacity: 1;
        transform: scale(1.12);
    }
}

.status.failed,
.status.error {
    border-color: rgba(244, 114, 182, 0.58);
    background: rgba(251, 113, 133, 0.14);
    color: #fecdd3;
}

.status.excluded,
.status.disabled,
.status.archived {
    border-color: rgba(100, 116, 139, 0.56);
    background: rgba(100, 116, 139, 0.16);
    color: #cbd5e1;
}

.status.needs_review {
    border-color: rgba(251, 146, 60, 0.58);
    background: rgba(251, 146, 60, 0.14);
    color: #fed7aa;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid rgba(34, 211, 238, 0.66);
    border-radius: 6px;
    padding: 8px 13px;
    border-color: rgba(34, 211, 238, 0.66);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.96), rgba(79, 70, 229, 0.94));
    color: #f8fdff;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.22);
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover,
.button:focus-visible,
button:hover,
button:focus-visible {
    border-color: rgba(165, 243, 252, 0.86);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.98), rgba(168, 85, 247, 0.96));
    color: #fff;
    text-decoration: none;
    text-shadow: none;
    box-shadow: 0 0 26px rgba(34, 211, 238, 0.34), 0 0 18px rgba(244, 114, 182, 0.18);
    transform: translateY(-1px);
}

.button.primary {
    border-color: rgba(244, 114, 182, 0.7);
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.95), rgba(37, 99, 235, 0.96));
}

.button.secondary,
button.secondary {
    background: rgba(7, 12, 24, 0.72);
    border-color: rgba(34, 211, 238, 0.42);
    color: #bff7ff;
    box-shadow: none;
}

.button.secondary:hover,
.button.secondary:focus-visible,
button.secondary:hover,
button.secondary:focus-visible {
    background: rgba(34, 211, 238, 0.12);
    color: #f8fdff;
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.18);
}

.button.danger,
button.danger {
    border-color: rgba(251, 113, 133, 0.76);
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.96), rgba(190, 18, 60, 0.9));
    color: #fff1f2;
    box-shadow: 0 0 18px rgba(251, 113, 133, 0.22);
}

.button.danger:hover,
.button.danger:focus-visible,
button.danger:hover,
button.danger:focus-visible {
    border-color: rgba(254, 205, 211, 0.92);
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.98), rgba(244, 63, 94, 0.96));
    color: #fff;
    box-shadow: 0 0 24px rgba(251, 113, 133, 0.42), 0 0 18px rgba(244, 114, 182, 0.2);
}

.inline-delete-form {
    display: inline-flex;
    margin: 0;
}

.case-action-cell {
    min-width: 224px;
    white-space: nowrap;
}

.case-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.case-action-row .button,
.case-action-row button,
.case-action-row .inline-delete-form {
    flex: 0 0 auto;
}

.case-action-row .button,
.case-action-row button {
    min-width: 92px;
}

.notice.success {
    border-color: rgba(52, 211, 153, 0.42);
    background: rgba(52, 211, 153, 0.1);
    color: #a7f3d0;
}

.live-update-note {
    color: var(--muted);
    font-size: 13px;
}

.live-update-note.is-active {
    color: #bff7ff;
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.34);
}

button.small,
.button.small {
    min-height: 28px;
    padding: 3px 9px;
    font-size: 13px;
}

.button.large {
    min-height: 44px;
    padding: 10px 16px;
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 14px;
}

.mobile-stack {
    min-width: 0;
}

.details-link {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 9px;
    margin-right: 10px;
    background: rgba(34, 211, 238, 0.09);
    border: 1px solid rgba(34, 211, 238, 0.32);
    border-radius: 999px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.02em;
    transition: background 0.15s, border-color 0.15s;
}

.details-link:hover {
    background: rgba(34, 211, 238, 0.18);
    border-color: rgba(34, 211, 238, 0.55);
}

.form {
    max-width: 420px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px 0 42px;
}

.login-card {
    width: min(100%, 440px);
    margin: 0 auto;
    padding: 28px;
}

.login-title {
    margin-bottom: 10px;
    font-size: 40px;
}

.login-subtitle {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 17px;
}

.wide-form {
    max-width: 720px;
}

.admin-module-selector {
    margin-bottom: 24px;
}

.admin-module-list {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.admin-module-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
    font-weight: 500;
    line-height: 1.35;
}

.admin-module-option .admin-module-checkbox {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    padding: 0;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #a8d8ea;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-color: rgba(64, 224, 255, 0.28);
    border: 1px solid rgba(64, 224, 255, 0.28);
    border-radius: 6px;
    margin-bottom: 14px;
    background: rgba(7, 12, 24, 0.84);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea {
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #6f8399;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(34, 211, 238, 0.86);
    background: rgba(9, 16, 31, 0.98);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14), 0 0 18px rgba(34, 211, 238, 0.16);
}

select {
    color-scheme: dark;
}

input[type="radio"],
.dashboard-create-form input[type="radio"] {
    width: auto;
    min-height: unset;
    padding: 0;
    margin-bottom: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    transition: none;
}

.subject-type-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 14px 0;
}

.subject-type-fieldset legend {
    display: block;
    margin-bottom: 8px;
    color: #a8d8ea;
    font-weight: 600;
    padding: 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: normal;
    color: var(--text);
    cursor: pointer;
}

pre,
code {
    color: #d9f5ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

pre.report,
pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.55;
    background: rgba(6, 10, 20, 0.86);
    border: 1px solid rgba(64, 224, 255, 0.2);
    border-radius: 8px;
    padding: 14px;
    color: #d7e7f0;
}

pre.preview {
    max-height: 360px;
    overflow: hidden;
}

pre.full {
    font-size: 15px;
}

.report-card {
    padding: 14px;
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline-item {
    border-left: 3px solid rgba(34, 211, 238, 0.42);
    border-left-color: rgba(34, 211, 238, 0.42);
    padding: 9px 0 9px 12px;
    background: rgba(6, 10, 20, 0.45);
}

.timeline-item time {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.timeline-item p {
    margin: 6px 0 0;
}

.success {
    color: #a7f3d0;
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.42);
}

.panel-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    color: inherit;
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
    width: 26px;
    height: 26px;
    min-height: auto;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, background 0.15s;
}

.panel-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: none;
}

.success .panel-close {
    background: transparent;
    border: 1px solid rgba(52, 211, 153, 0.42);
    color: #a7f3d0;
    opacity: 1;
}

.success .panel-close:hover {
    background: transparent;
    border-color: rgba(52, 211, 153, 0.75);
    color: #6ee7b7;
    box-shadow: none;
    transform: none;
}

.error {
    color: #fecdd3;
}

.panel.error,
section.error {
    background: rgba(76, 5, 25, 0.34);
    border-color: rgba(244, 114, 182, 0.44);
}

.hidden {
    display: none;
}

.type-help {
    margin-top: 12px;
}

@media (max-width: 768px) {
    .topbar {
        align-items: center;
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .topbar-brand {
        flex: 1 0 100%;
    }

    .topbar strong {
        display: block;
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .primary-navigation {
        display: flex;
        flex: 1 0 100%;
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 8px;
    }

    .nav-links {
        order: 1;
        justify-content: flex-start;
        gap: 8px;
    }

    .nav-user {
        order: 2;
        display: flex;
        align-items: center;
        min-height: 40px;
        padding: 6px 2px;
    }

    .nav-links a {
        min-height: 44px;
        padding: 9px 13px;
        border: 1px solid rgba(34, 211, 238, 0.42);
        border-radius: 6px;
        background: rgba(34, 211, 238, 0.1);
        color: #e6fbff;
    }

    .nav-links a:hover,
    .nav-links a:focus-visible {
        border-color: rgba(165, 243, 252, 0.78);
        background: rgba(34, 211, 238, 0.18);
    }

    .shell {
        padding: 20px 14px 36px;
    }

    .login-page {
        min-height: 100vh;
        padding: 8px 0 28px;
    }

    .login-card {
        width: 100%;
        padding: 22px 18px;
    }

    .login-title {
        font-size: 32px;
    }

    .login-subtitle {
        font-size: 16px;
    }

    .dashboard-top-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        margin-bottom: 26px;
    }

    .dashboard-create-case-body {
        position: fixed;
        left: 14px;
        right: 14px;
        top: 96px;
        width: auto;
    }

    .activity-terminal-header {
        display: block;
    }

    .activity-item {
        grid-template-columns: 48px minmax(58px, auto) minmax(0, 1fr);
        gap: 8px;
    }

    .dashboard-create-form button {
        width: 100%;
    }

    .case-hero,
    .next-step,
    .section-heading,
    .workspace-shortcut {
        display: block;
    }

    .next-step-body {
        grid-template-columns: 1fr;
    }

    .next-step-stats {
        grid-auto-rows: 72px;
    }

    .hero-meta,
    .actions {
        margin-top: 12px;
    }

    .actions {
        align-items: stretch;
    }

    .actions .button,
    .actions button {
        width: 100%;
    }

    .action-row {
        align-items: stretch;
    }

    .action-row .button,
    .action-row button,
    .action-row form {
        min-height: 44px;
    }

    .case-action-row {
        flex-wrap: wrap;
        white-space: normal;
    }

    .case-action-cell {
        min-width: 0;
        white-space: normal;
    }

    .responsive-case-table,
    .responsive-case-table tbody,
    .responsive-case-table .case-row,
    .responsive-case-table .case-row > td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .responsive-case-table {
        min-width: 0;
        background: transparent;
    }

    .responsive-case-table colgroup,
    .responsive-case-table thead {
        display: none;
    }

    .responsive-case-table .case-row {
        display: grid;
        gap: 8px;
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid rgba(64, 224, 255, 0.18);
        border-radius: 8px;
        background: rgba(8, 13, 25, 0.62);
    }

    .responsive-case-table .case-row > td {
        padding: 0;
        border: 0;
        white-space: normal;
        text-align: left;
    }

    .responsive-case-table .case-row__main {
        font-size: 16px;
        line-height: 1.45;
    }

    .responsive-case-table .case-row__meta {
        color: var(--muted);
    }

    .responsive-case-table .case-row__actions {
        padding-top: 4px;
    }

    .responsive-case-table .case-row__actions .action-row {
        justify-content: flex-start;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .panel {
        padding: 16px;
    }

    table {
        min-width: 680px;
    }
}

@media (max-width: 480px) {
    .shell {
        padding: 16px 10px 30px;
    }

    .panel,
    .case-hero {
        padding: 14px;
    }

    .case-workspace-tabs {
        margin-right: -10px;
        margin-left: -10px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .case-workspace-tabs a {
        padding-right: 10px;
        padding-left: 10px;
    }

    .next-step-stats,
    .compact-grid,
    .grid,
    .responsive-grid {
        grid-template-columns: 1fr;
    }

    .breadcrumbs {
        font-size: 13px;
    }
}

dialog,
.modal-dialog {
    width: min(calc(100% - 24px), 640px);
    max-width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
}

.processing-log {
    display: grid;
    gap: 0;
    max-height: 360px;
    overflow: auto;
    padding: 8px 0;
    border: 1px solid rgba(64, 224, 255, 0.18);
    border-radius: 6px;
    background: rgba(3, 7, 18, 0.78);
}

.processing-log-line {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    align-items: baseline;
    padding: 7px 12px;
    border-left: 3px solid rgba(34, 211, 238, 0.42);
    color: #e6fbff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    transition: background 420ms ease, border-color 420ms ease;
}

.processing-log-line:nth-child(even) {
    background: rgba(15, 23, 42, 0.34);
}

.processing-log-line time {
    color: #8fbfd0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.processing-log-line.info,
.processing-log-line.processing,
.processing-log-line.running,
.processing-log-line.queued {
    border-left-color: rgba(34, 211, 238, 0.68);
}

.processing-log-line.success,
.processing-log-line.completed,
.processing-log-line.processed,
.processing-log-line.ready_for_report {
    border-left-color: rgba(52, 211, 153, 0.78);
}

.processing-log-line.warning,
.processing-log-line.needs_review {
    border-left-color: rgba(250, 204, 21, 0.82);
}

.processing-log-line.error,
.processing-log-line.failed {
    border-left-color: rgba(251, 113, 133, 0.82);
}

.processing-log-line.is-new {
    background: rgba(34, 211, 238, 0.13);
}

/* Raw messages tabs */
.raw-tab-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.msg-group-name {
    font-weight: 600;
    color: var(--text);
}
.msg-group-link {
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}
.msg-group-link:hover {
    text-decoration: underline;
}
.msg-group-muted {
    color: var(--muted);
    font-size: 0.85em;
}
.msg-date {
    color: var(--muted);
    font-size: 0.85em;
}

.raw-message {
    background: rgba(6, 10, 20, 0.55);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.raw-message-meta {
    margin-bottom: 8px;
}
.raw-message pre {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

.raw-message-type-line {
    color: var(--muted);
    font-size: 0.85em;
    margin-bottom: 6px;
}

/* LinkedIn profile panel */
.li-header { margin-bottom: 20px; }
.li-name { font-size: 1.4em; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.li-headline { font-size: 1em; color: var(--text); margin-bottom: 6px; }
.li-meta { font-size: 0.85em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.li-profile-link { font-size: 0.85em; color: var(--brand); text-decoration: none; }
.li-profile-link:hover { text-decoration: underline; }
.li-about-block { margin-bottom: 20px; }
.li-about { font-size: 0.95em; white-space: pre-wrap; }
.li-section-title { font-weight: 600; font-size: 0.9em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 0 8px; }
.li-card { background: rgba(6,10,20,0.45); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; }
.li-card-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.li-card-sub { font-size: 0.9em; color: var(--text); margin-bottom: 2px; }
.li-card-meta { font-size: 0.82em; color: var(--muted); margin-bottom: 2px; }
.li-card-desc { font-size: 0.88em; color: var(--text); margin-top: 6px; white-space: pre-wrap; }
.li-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.li-tag { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); border-radius: 4px; padding: 2px 10px; font-size: 0.85em; color: var(--text); }

/* Accumulative Telegram: working doc */
.tg-working-doc { line-height: 1.65; }
.tg-section-heading { margin: 1.2rem 0 0.4rem; font-size: 0.95rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.04em; }
.tg-doc-line { margin: 0.25rem 0; }
.tg-doc-gap { height: 0.5rem; }

/* Confidence badges */
.conf-badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 6px; border-radius: 3px; vertical-align: middle; margin: 0 2px; text-transform: lowercase; }
.conf-ok { background: rgba(52,211,153,0.15); color: var(--ok); border: 1px solid rgba(52,211,153,0.35); }
.conf-warn { background: rgba(250,204,21,0.12); color: var(--warn); border: 1px solid rgba(250,204,21,0.30); }
.conf-muted { background: rgba(142,164,189,0.10); color: var(--muted); border: 1px solid rgba(142,164,189,0.25); }

/* Hard facts list */
.tg-hard-facts-list { margin: 0.5rem 0; padding-left: 1.5rem; line-height: 1.7; }
.tg-hard-facts-list li { padding: 0.1rem 0; }

.entity-summary { white-space: pre-wrap; }
.entity-mention {
    --entity-color: 34, 211, 238;
    display: inline;
    padding: 0 0.08em;
    border: 0;
    border-bottom: 1px dotted rgb(var(--entity-color));
    border-radius: 2px;
    background: rgba(var(--entity-color), 0.07);
    color: inherit;
    font: inherit;
    line-height: inherit;
    cursor: pointer;
}
.entity-mention--physical-person { --entity-color: 129, 140, 248; }
.entity-mention--company { --entity-color: 167, 139, 250; }
.entity-mention--inn { --entity-color: 148, 163, 184; }
.entity-mention--inn-company { --entity-color: 148, 163, 184; }
.entity-mention--inn-person { --entity-color: 244, 114, 182; }
.entity-mention--phone { --entity-color: 45, 212, 191; }
.entity-mention--email { --entity-color: 96, 165, 250; }
.entity-mention--account { --entity-color: 56, 189, 248; }
.entity-mention--telegram-account { --entity-color: 56, 189, 248; }
.entity-mention--vk-account { --entity-color: 59, 130, 246; }
.entity-mention--address { --entity-color: 251, 191, 36; }
.entity-mention:hover, .entity-mention:focus-visible {
    background: rgba(var(--entity-color), 0.16);
    outline: 1px solid rgba(var(--entity-color), 0.45);
    outline-offset: 1px;
}
.source-summary-heading { margin: 0 0 0.75rem; font-size: 1rem; color: var(--muted); }
.entity-selection-menu { position: fixed; z-index: 50; max-width: min(28rem, calc(100vw - 1rem)); padding: 0.6rem; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); box-shadow: 0 8px 24px rgba(0,0,0,0.28); }
.entity-selection-title { margin-bottom: 0.45rem; font-size: 0.85rem; color: var(--muted); }
.entity-selection-options { display: flex; flex-wrap: wrap; gap: 0.3rem; min-width: 0; }
.entity-picker-control,
.entity-search-control {
    margin: 0;
    border: 1px solid rgba(56, 189, 248, 0.48);
    border-radius: 6px;
    background: transparent;
    background-image: none;
    color: #bae6fd;
    box-shadow: none;
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.2;
}
.entity-picker-control { padding: 0.28rem 0.48rem; }
.entity-picker-control:hover,
.entity-picker-control:focus-visible,
.entity-search-control--available:hover,
.entity-search-control--available:focus-visible {
    border-color: rgba(56, 189, 248, 0.82);
    background: rgba(14, 165, 233, 0.12);
    color: #e0f2fe;
    box-shadow: none;
}
.entity-picker-control:focus-visible,
.entity-search-control:focus-visible,
.entity-popover-close:focus-visible,
.entity-popover-delete:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.entity-mention-popover { position: fixed; z-index: 55; width: min(24rem, calc(100vw - 1rem)); padding: 0.85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 24px rgba(0,0,0,0.28); }
.entity-popover-close { float: right; min-width: 1.65rem; min-height: 1.65rem; margin: -0.2rem -0.2rem 0 0; padding: 0.05rem 0.35rem; border-color: transparent; background: transparent; background-image: none; color: var(--muted); box-shadow: none; font-size: 1rem; line-height: 1; }
.entity-popover-label { margin-top: 0.55rem; color: var(--muted); font-size: 0.78rem; }
.entity-popover-value { overflow-wrap: anywhere; font-weight: 600; }
.entity-search-module-item { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; min-width: 0; margin-top: 0.45rem; padding: 0.55rem 0.6rem; border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 7px; background: rgba(15, 23, 42, 0.18); }
.entity-search-module-content { flex: 1 1 auto; min-width: 0; }
.entity-search-module { color: var(--text); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.045em; line-height: 1.25; text-transform: uppercase; overflow-wrap: anywhere; }
.entity-search-description { margin-top: 0.18rem; color: var(--muted); font-size: 0.76rem; line-height: 1.35; overflow-wrap: anywhere; }
.entity-search-control { flex: 0 1 auto; max-width: 100%; padding: 0.3rem 0.52rem; white-space: normal; }
.entity-search-control:disabled { opacity: 1; cursor: default; }
.entity-search-control--existing,
.entity-search-control--added,
.entity-search-control--excluded_existing,
.entity-search-control--loading { border-color: rgba(148, 163, 184, 0.3); background: rgba(148, 163, 184, 0.08); color: var(--muted); }
.entity-search-control--added { border-color: rgba(45, 212, 191, 0.35); color: #99f6e4; }
.entity-search-control--excluded_existing { border-color: rgba(251, 191, 36, 0.3); color: #fde68a; }
.entity-search-control--unavailable { border-color: rgba(148, 163, 184, 0.3); background: transparent; color: var(--muted); }
.entity-popover-delete { margin-top: 0.7rem; padding: 0.28rem 0.5rem; border: 1px solid rgba(248, 113, 113, 0.35); border-radius: 6px; background: transparent; background-image: none; color: #fca5a5; box-shadow: none; font-size: 0.75rem; font-weight: 500; }
.entity-popover-delete:hover { border-color: rgba(248, 113, 113, 0.62); background: rgba(127, 29, 29, 0.12); box-shadow: none; }
@media (max-width: 420px) {
    .entity-selection-menu, .entity-mention-popover { max-width: calc(100vw - 1rem); }
    .entity-search-module-item { align-items: stretch; flex-direction: column; gap: 0.4rem; }
    .entity-search-control { align-self: flex-start; }
}

/* Case Research feed */
.research-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 1.15rem;
}
.research-heading h1 { margin: 0 0 0.25rem; font-size: clamp(1.45rem, 3vw, 1.85rem); }
.research-stats { display: flex; flex-wrap: wrap; gap: 0; margin: 0; color: var(--muted); }
.research-stats span:not(:last-child)::after { content: " · "; white-space: pre; }
.new-search-panel { margin-bottom: 1.25rem; }
.new-search-panel[hidden] { display: none; }
.research-feed { display: grid; gap: 0.85rem; }
.report-selection-list { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.research-card {
    min-width: 0;
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(10, 18, 34, 0.68);
}
.report-selection-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.report-selection-control {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    min-width: 0;
    cursor: pointer;
}
.report-selection-card:hover { border-color: rgba(56, 189, 248, 0.46); }
.report-selection-card:has(.report-selection-checkbox:checked) {
    border-color: var(--brand);
    background: rgba(14, 165, 233, 0.12);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18);
}
.report-selection-card:has(.report-selection-checkbox:focus-visible) {
    outline: 2px solid rgba(56, 189, 248, 0.55);
    outline-offset: 2px;
}
.report-selection-checkbox { width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; accent-color: var(--brand); }
.report-selection-content, .report-selection-title { display: block; min-width: 0; }
.report-selection-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.report-selection-input { display: block; margin-top: 0.12rem; font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.report-selection-preview { display: -webkit-box; margin-top: 0.65rem; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.report-selection-meta { display: block; margin-top: 0.55rem; }
.report-summary-details { grid-column: 1 / -1; min-width: 0; border-top: 1px solid rgba(148, 163, 184, 0.14); padding-top: 0.7rem; }
.report-summary-details > summary { width: fit-content; max-width: 100%; color: var(--brand); cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.report-summary-full { margin-top: 0.7rem; padding: 0.8rem; border-radius: 7px; background: rgba(15, 23, 42, 0.4); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.reports-history h3 { margin-top: 0; }
.research-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.research-card-title { min-width: 0; }
.research-card-title h2 { margin: 0.15rem 0 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.source-type { margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.research-card-time { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.82rem; }
.research-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.research-section-heading h3, .research-card-section h3 { margin: 0; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; }
.research-section-heading > span { color: var(--brand); font-size: 0.82rem; font-weight: 700; }
.research-progress, .research-card-section, .research-statistics, .research-card-actions { border-top: 1px solid rgba(148, 163, 184, 0.14); }
.research-progress { margin-top: 0.9rem; padding-top: 0.8rem; }
.research-phase { margin: 0.25rem 0 0; color: var(--brand); font-size: 0.8rem; }
.research-progress-track { height: 3px; margin-top: 0.65rem; overflow: hidden; border-radius: 999px; background: rgba(148, 163, 184, 0.2); }
.research-progress-track::before { content: ""; display: block; width: var(--research-progress); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #2dd4bf); }
.research-progress--failed .research-progress-track::before { background: var(--danger, #fb7185); }
.research-progress--review .research-progress-track::before { background: #fbbf24; }
.research-progress--muted .research-progress-track::before { background: var(--muted); }
.research-progress-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin: 0.45rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.72rem; }
.research-progress-steps--report { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.research-progress-steps--report li:nth-child(2) { text-align: center; }
.research-progress-steps--report li:last-child { text-align: right; }
.research-progress-steps li { position: relative; min-width: 0; overflow-wrap: anywhere; }
.research-progress-steps li::before { content: ""; display: inline-block; width: 0.42rem; height: 0.42rem; margin-right: 0.35rem; border: 1px solid currentColor; border-radius: 50%; vertical-align: 0.05em; }
.research-progress-steps .is-complete, .research-progress-steps .is-current { color: var(--brand); }
.research-progress--failed .research-progress-steps .is-current { color: var(--danger, #fb7185); }
.research-progress--review .research-progress-steps .is-current { color: #fbbf24; }
.research-card-section { margin-top: 0.85rem; padding-top: 0.8rem; }
.research-summary-preview { margin: 0.45rem 0 0; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.research-safe-error { margin: 0.8rem 0 0; color: var(--danger, #fb7185); }
.research-entity-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.55rem 0 0; padding: 0; list-style: none; }
.research-entity-chip { padding: 0.25rem 0.55rem; border: 1px solid rgba(34, 211, 238, 0.23); border-radius: 999px; background: rgba(34, 211, 238, 0.07); color: #b8edf4; font-size: 0.78rem; }
.research-statistics { display: flex; flex-wrap: wrap; gap: 0; margin: 0.85rem 0 0; padding: 0.75rem 0 0; color: var(--muted); font-size: 0.8rem; list-style: none; }
.research-statistics li:not(:last-child)::after { content: " · "; white-space: pre; }
.research-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.55rem; margin-top: 0.85rem; padding-top: 0.8rem; }
.research-card-actions form { margin: 0; }
.research-secondary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-left: auto; }
.research-start-action {
    border-color: rgba(56, 189, 248, 0.48);
    background: rgba(8, 145, 178, 0.2);
    color: #e0f7ff;
    box-shadow: none;
}
.research-start-action:hover,
.research-start-action:focus-visible {
    border-color: rgba(56, 189, 248, 0.72);
    background: rgba(14, 165, 233, 0.28);
    color: #f8fdff;
    box-shadow: none;
}
.research-start-action:focus-visible {
    outline: 2px solid rgba(56, 189, 248, 0.42);
    outline-offset: 2px;
}
button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
button.quiet:hover, button.quiet:focus-visible { border-color: var(--line); color: var(--text); }
.research-empty { padding: 2.5rem 1rem; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.research-empty h2 { margin-top: 0; }
.research-pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.research-secondary-panel { margin-top: 1rem; }
.research-secondary-panel > summary { cursor: pointer; font-weight: 600; }
.research-secondary-panel[open] > summary { margin-bottom: 1rem; }
@media (max-width: 640px) {
    .research-heading, .research-card-header { flex-direction: column; align-items: stretch; }
    .research-heading button { align-self: flex-start; }
    .research-card { padding: 1rem; }
    .research-card-header .status { align-self: flex-start; }
    .report-selection-header { flex-direction: column; gap: 0.45rem; }
    .research-progress-steps:not(.research-progress-steps--report) { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 0.4rem; }
    .research-card-actions { align-items: stretch; }
}

@media (max-width: 480px) {
    .research-heading { margin-top: 0.75rem; }
    .research-card-actions > .button { width: 100%; text-align: center; }
    .research-secondary-actions { width: 100%; margin-left: 0; }
    .research-statistics li { width: 100%; }
    .research-statistics li:not(:last-child)::after { content: ""; }
    .processing-log-line {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
