:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --border: #e3e8ef;
    --text: #10233f;
    --muted: #5c6b80;
    --primary: #1f6feb;
    --primary-dark: #1659bf;
    --primary-soft: #eaf2ff;
    --sidebar-start: #0f3f84;
    --sidebar-end: #0b336b;
    --success-bg: #eaf8ef;
    --success-text: #18794e;
    --success-border: #b6e2c3;
    --danger-bg: #fff1f1;
    --danger-text: #b42318;
    --danger-border: #f1c3c3;
    --neutral-bg: #eef3f8;
    --neutral-text: #41536d;
    --neutral-border: #d8e1ec;
    --shadow: 0 10px 30px rgba(16, 35, 63, 0.06);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --sidebar-width: 274px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

.app-body {
    min-height: 100vh;
}

.layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.5px;
}

.brand-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}

.brand-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.86);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: block;
    padding: 14px 16px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-weight: 600;
    transition: 0.18s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.16);
}

.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.page-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 30px 40px;
}

.page-shell-chat {
    padding-bottom: 80px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    font-weight: 700;
    color: #0d2550;
}

.page-subtitle {
    margin: 10px 0 0 0;
    color: var(--muted);
    font-size: 15px;
}

.user-chip {
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 22px 24px;
}

.card-header {
    margin-bottom: 16px;
}

.card-header h2 {
    margin: 0;
    font-size: 18px;
    color: #0d2550;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stat-card {
    min-height: 136px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label {
    font-size: 14px;
    color: var(--muted);
}

.stat-value {
    font-size: 46px;
    font-weight: 700;
    color: #0d4ea3;
    line-height: 1;
}

.content-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1f6;
}

.info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-key {
    color: var(--muted);
    font-size: 14px;
    min-width: 180px;
}

.info-value {
    text-align: right;
    font-size: 14px;
    color: var(--text);
    word-break: break-word;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f1f5fb;
    color: #173055;
    border-color: #dce6f2;
}

.btn-secondary:hover {
    background: #e9f0f8;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-ok {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.status-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.status-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
    border: 1px solid var(--neutral-border);
}

.body-text,
.muted-text {
    margin: 0;
    line-height: 1.7;
    font-size: 15px;
}

.muted-text {
    color: var(--muted);
}

/* SEARCH PAGE */

.search-sticky-wrap {
    position: sticky;
    top: 0;
    z-index: 50;
    padding-bottom: 18px;
    background: linear-gradient(180deg, var(--bg) 70%, rgba(245, 247, 251, 0));
    margin-bottom: 6px;
}

.search-sticky-card {
    padding: 18px 18px 16px;
    border-radius: 22px;
}

.search-form-chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chat-query-input {
    width: 100%;
    min-height: 120px;
    max-height: 240px;
    resize: vertical;
    border: 1px solid #d9e3ef;
    border-radius: 18px;
    background: #fff;
    color: var(--text);
    font-size: 16px;
    line-height: 1.55;
    padding: 18px 18px;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(16, 35, 63, 0.02);
}

.chat-query-input:focus {
    border-color: #bdd0ea;
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.08);
}

.search-form-footer {
    display: flex;
    justify-content: flex-end;
}

.chat-flow {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-card {
    padding-top: 18px;
    padding-bottom: 18px;
}

.message-role {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.message-bubble {
    border-radius: 18px;
    padding: 18px 18px;
    line-height: 1.7;
    white-space: pre-wrap;
    font-size: 15px;
}

.message-user {
    background: #eef4ff;
    border: 1px solid #d8e5fb;
}

.message-assistant {
    background: #fbfcfe;
    border: 1px solid #e7edf5;
}

.source-list,
.match-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.source-card,
.match-card {
    background: var(--panel-soft);
    border: 1px solid #e6ebf2;
    border-radius: 18px;
    padding: 16px 18px;
}

.source-title,
.match-title {
    font-size: 15px;
    font-weight: 700;
    color: #14325d;
    margin-bottom: 8px;
}

.source-path,
.match-path,
.match-score {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
    word-break: break-word;
}

.match-text {
    white-space: pre-wrap;
    line-height: 1.65;
    font-size: 14px;
    color: #16304f;
}

/* AUDIT */

.audit-table-wrap {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.audit-table th,
.audit-table td {
    border: 1px solid var(--border);
    padding: 12px;
    vertical-align: top;
    text-align: left;
}

.audit-table th {
    background: #f3f7fc;
    color: #14325d;
}

.audit-json {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    color: #334155;
}

/* LOGIN */

.auth-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f7f9fc 0%, #edf3f9 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
}

.auth-left {
    background: linear-gradient(135deg, #0f3f84 0%, #1a5dbe 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 24px;
}

.hero-card h1 {
    margin: 0 0 14px 0;
    font-size: 42px;
    line-height: 1.1;
}

.hero-card p {
    max-width: 640px;
    line-height: 1.65;
    font-size: 18px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.mini-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px;
}

.mini-label {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.mini-value {
    font-size: 16px;
    font-weight: 700;
}

.login-card {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    padding: 30px;
}

.login-header h2 {
    margin: 0 0 8px 0;
    color: #0d2550;
}

.login-header p {
    margin: 0 0 24px 0;
    color: var(--muted);
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #d8e2ee;
    font-size: 15px;
    margin-bottom: 14px;
}

.btn-full {
    width: 100%;
}

.login-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: 100%;
        border-radius: 0;
    }

    .main {
        margin-left: 0;
    }

    .layout {
        display: block;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-left {
        display: none;
    }

    .page-shell {
        padding: 20px 16px 28px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-sticky-wrap {
        position: static;
        background: transparent;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-row {
        flex-direction: column;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .brand-title {
        font-size: 20px;
    }

    .page-title {
        font-size: 26px;
    }

    .stat-value {
        font-size: 38px;
    }
}

/* REASONING SEARCH UI */

.reasoning-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.reasoning-main {
    min-width: 0;
}

.reasoning-side {
    position: sticky;
    top: 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.side-card {
    padding: 18px;
}

.side-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mode-tab {
    border: 1px solid #dce6f2;
    background: #f7faff;
    border-radius: 16px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    color: #15345f;
    transition: 0.18s ease;
}

.mode-tab span {
    display: block;
    font-size: 16px;
    font-weight: 800;
}

.mode-tab small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.mode-tab:hover {
    background: #eef5ff;
    border-color: #c8d9ef;
}

.mode-tab.active {
    background: var(--primary-soft);
    border-color: #9dc3ff;
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.08);
}

.reasoning-footer {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mode-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.status-panel {
    margin-bottom: 18px;
}

.status-panel.hidden,
.hidden {
    display: none;
}

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.status-title {
    font-weight: 800;
    color: #12315d;
}

.status-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.loader-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--primary);
    animation: pulseDot 1s infinite ease-in-out;
}

@keyframes pulseDot {
    0% { transform: scale(0.7); opacity: 0.35; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.7); opacity: 0.35; }
}

.mode-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mode-info {
    padding: 12px 12px;
    border-radius: 14px;
    background: var(--panel-soft);
    border: 1px solid #e6ebf2;
}

.mode-info strong {
    display: block;
    color: #12315d;
    margin-bottom: 4px;
}

.mode-info span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.small-btn {
    border: 1px solid #dce6f2;
    background: #f5f8fc;
    color: #173055;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.small-btn:hover {
    background: #edf4fc;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    width: 100%;
    border: 1px solid #e6ebf2;
    background: var(--panel-soft);
    border-radius: 14px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
}

.history-item:hover {
    background: #eef5ff;
}

.history-question {
    display: block;
    color: #12315d;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.45;
}

.history-meta {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf1f6;
    font-size: 13px;
}

.meta-row span {
    color: var(--muted);
}

.meta-row strong {
    color: #12315d;
    text-align: right;
    word-break: break-word;
}

.meta-plan {
    margin-top: 8px;
}

.meta-plan-title {
    font-weight: 800;
    color: #12315d;
    margin-bottom: 8px;
}

.meta-plan-item {
    padding: 8px 10px;
    background: #f7faff;
    border: 1px solid #e2ebf7;
    border-radius: 12px;
    color: #243b5a;
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 8px;
}

button:disabled {
    opacity: 0.65;
    cursor: wait;
}

@media (max-width: 1200px) {
    .reasoning-grid {
        grid-template-columns: 1fr;
    }

    .reasoning-side {
        position: static;
    }
}

@media (max-width: 720px) {
    .mode-tabs {
        grid-template-columns: 1fr;
    }

    .reasoning-footer {
        align-items: stretch;
        flex-direction: column;
    }
}

/* SOURCE CARDS + MANUAL UPLOADS */

.source-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.zip-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.enhanced-source-list {
    gap: 14px;
}

.enhanced-source-card {
    padding: 16px;
}

.source-topline {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.source-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.source-badges span {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d8e6f8;
    background: #f2f7ff;
    color: #183b68;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
}

.source-details-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 14px;
    color: #243b5a;
    font-size: 12px;
    line-height: 1.45;
}

.source-details-grid b {
    color: #112f58;
}

.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.source-actions a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border: 1px solid #b9d2f3;
    background: #eef6ff;
    color: #0e4d9d;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
}

.source-actions a:hover {
    background: #dfeeff;
}

.upload-card {
    overflow: hidden;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dce6f2;
    background: #f7faff;
    border-radius: 14px;
    padding: 10px;
    font-size: 12px;
}

.upload-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #243b5a;
    font-size: 12px;
    cursor: pointer;
}

.upload-btn {
    align-self: flex-start;
}

.upload-status {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.45;
}

.upload-list {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-item {
    border: 1px solid #e1ebf6;
    background: #f8fbff;
    border-radius: 14px;
    padding: 10px;
}

.upload-name {
    font-weight: 800;
    color: #12315d;
    font-size: 12px;
    word-break: break-word;
}

.upload-meta {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.upload-error {
    margin-top: 7px;
    color: #9b1c1c;
    font-size: 11px;
    line-height: 1.4;
}

/* UI/UX STAGE 1: DASHBOARD + SOURCE TIMELINE */

.eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #0f4c97;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.25px;
    text-transform: uppercase;
}

.dashboard-hero {
    padding: 22px 24px;
    border: 1px solid #dfe8f5;
    border-radius: 28px;
    background: linear-gradient(135deg, #ffffff 0%, #edf5ff 100%);
    box-shadow: var(--shadow);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-stats-grid .stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card-primary {
    background: linear-gradient(135deg, #0f3f84 0%, #1766c7 100%);
    color: #fff;
    border-color: rgba(255,255,255,0.16);
}

.stat-card-primary .stat-label,
.stat-card-primary .stat-foot,
.stat-card-primary .stat-value {
    color: #fff;
}

.stat-foot {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.stat-value-warning {
    font-size: 34px;
    color: #b45309;
}

.card-header-spread {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.card-header-spread p {
    margin: 6px 0 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.dashboard-card-tall {
    min-height: 430px;
}

.big-progress {
    padding: 18px;
    border-radius: 20px;
    background: #f5f9ff;
    border: 1px solid #dfebf8;
    margin-bottom: 18px;
}

.big-progress-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    margin-bottom: 12px;
}

.big-progress-top strong {
    font-size: 34px;
    color: #0d4ea3;
}

.big-progress-top span {
    color: var(--muted);
    font-size: 13px;
}

.big-progress-track,
.mini-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4ebf5;
}

.big-progress-track span,
.mini-progress span {
    display: block;
    height: 100%;
    min-width: 2px;
    max-width: 100%;
    background: linear-gradient(90deg, #1f6feb, #55a2ff);
    border-radius: 999px;
}

.compact-info-list .info-row {
    gap: 18px;
    padding-bottom: 10px;
}

.worker-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.worker-card {
    padding: 16px;
    border: 1px solid #e1ebf6;
    background: #f8fbff;
    border-radius: 18px;
}

.worker-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.worker-title {
    color: #102f5a;
    font-size: 16px;
    font-weight: 900;
}

.worker-name,
.worker-purpose {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.worker-purpose {
    margin-bottom: 12px;
}

.worker-meta-grid {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 8px 10px;
    align-items: start;
    font-size: 12px;
}

.worker-meta-grid span {
    color: var(--muted);
}

.worker-meta-grid strong {
    color: #183b68;
    word-break: break-word;
}

.worker-error {
    margin-top: 12px;
    padding: 10px;
    border-radius: 12px;
    background: #fff1f1;
    border: 1px solid #f1c3c3;
    color: #9b1c1c;
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.source-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-row {
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #e1ebf6;
    background: #f8fbff;
}

.breakdown-head,
.breakdown-foot,
.upload-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.breakdown-head {
    align-items: baseline;
    margin-bottom: 8px;
}

.breakdown-head strong {
    color: #102f5a;
    font-size: 14px;
}

.breakdown-head span,
.breakdown-foot {
    color: var(--muted);
    font-size: 12px;
}

.breakdown-foot {
    margin-top: 8px;
}

.upload-summary-box {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #edf1f6;
}

.upload-summary-row {
    padding: 8px 0;
    border-bottom: 1px solid #edf1f6;
    font-size: 13px;
}

.upload-summary-row:last-child {
    border-bottom: none;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity-row {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.activity-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 999px;
    background: #1f6feb;
    box-shadow: 0 0 0 4px #eaf2ff;
}

.activity-title {
    color: #102f5a;
    font-weight: 800;
    font-size: 13px;
}

.activity-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.source-summary-line {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.source-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.source-timeline:before {
    content: "";
    position: absolute;
    left: 18px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: #dbe8f8;
}

.source-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 14px;
}

.source-timeline-marker {
    position: relative;
    z-index: 1;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #0f4c97;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 0 0 5px #edf5ff;
}

.source-card-rich {
    background: #ffffff;
    border-color: #dfe8f5;
}

.source-title-wrap {
    min-width: 0;
}

.source-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.source-system-pill,
.source-id-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid transparent;
}

.source-system-bitrix {
    color: #0f4c97;
    background: #eaf3ff;
    border-color: #cfe4ff;
}

.source-system-imap {
    color: #7c3aed;
    background: #f3edff;
    border-color: #ddd0ff;
}

.source-system-manual {
    color: #18794e;
    background: #eaf8ef;
    border-color: #b6e2c3;
}

.source-system-neutral,
.source-id-pill {
    color: #41536d;
    background: #eef3f8;
    border-color: #d8e1ec;
}

.source-title-big {
    font-size: 16px;
    line-height: 1.35;
    margin-bottom: 6px;
}

.source-file-name {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.source-fields {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.source-field {
    padding: 10px 12px;
    border: 1px solid #e4edf7;
    border-radius: 14px;
    background: #f8fbff;
    min-width: 0;
}

.source-field span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 4px;
}

.source-field strong {
    display: block;
    color: #17365f;
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.source-mail-fields {
    grid-template-columns: 1fr;
}

.source-section-title {
    margin-top: 14px;
    margin-bottom: 8px;
    color: #102f5a;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.source-path-rich {
    padding: 12px;
    border-radius: 14px;
    background: #0b1f3a;
    color: #dceaff;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.source-actions-rich {
    align-items: center;
}

.source-no-file {
    display: inline-flex;
    align-items: center;
    border: 1px solid #f1c3c3;
    background: #fff1f1;
    color: #9b1c1c;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 1200px) {
    .worker-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .header-actions,
    .card-header-spread,
    .breakdown-head,
    .breakdown-foot,
    .upload-summary-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .source-fields {
        grid-template-columns: 1fr;
    }

    .source-timeline-item {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 10px;
    }

    .source-timeline-marker {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .source-timeline:before {
        left: 13px;
    }
}

.audit-table-modern th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.audit-table-modern td {
    background: #fff;
}

.audit-action-pill {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 999px;
    background: #eef5ff;
    border: 1px solid #d5e6fb;
    color: #0f4c97;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
