:root {
    --ink: #16181d;
    --ink-soft: #343943;
    --muted: #6d7480;
    --line: #dfe3e8;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --field: #f5f7f9;
    --teal: #087f83;
    --blue: #2f5bea;
    --amber: #b7791f;
    --red: #bd3d2a;
    --green: #207a4a;
    --shadow: 0 18px 50px rgba(19, 26, 36, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Aptos", "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    background:
        linear-gradient(135deg, rgba(8, 127, 131, 0.08), transparent 28%),
        linear-gradient(315deg, rgba(47, 91, 234, 0.08), transparent 26%),
        repeating-linear-gradient(0deg, rgba(22, 24, 29, 0.045) 0 1px, transparent 1px 32px),
        repeating-linear-gradient(90deg, rgba(22, 24, 29, 0.035) 0 1px, transparent 1px 32px),
        #f8fafb;
}

button {
    font: inherit;
}

.icon-sprite {
    display: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 18px;
    border-right: 1px solid var(--line);
    background: rgba(247, 249, 250, 0.78);
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: white;
    background: linear-gradient(135deg, var(--ink), var(--teal));
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(8, 127, 131, 0.22);
}

.brand svg,
.nav-tab svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.brand strong {
    display: block;
    font-size: 15px;
    letter-spacing: 0;
}

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

.nav-tabs {
    display: grid;
    gap: 8px;
    margin-top: 36px;
}

.nav-tab {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    color: var(--ink-soft);
    text-align: left;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.nav-tab:hover,
.nav-tab.active {
    color: var(--ink);
    border-color: #cfd7df;
    background: var(--surface-strong);
}

.workspace {
    width: min(1460px, 100%);
    padding: 34px clamp(20px, 4vw, 56px) 56px;
}

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

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

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.02;
}

h2 {
    font-size: 24px;
}

.run-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 14px;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.pulse {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 0 6px rgba(183, 121, 31, 0.14);
}

.pulse.ok {
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(32, 122, 74, 0.14);
}

.pulse.fail {
    background: var(--red);
    box-shadow: 0 0 0 6px rgba(189, 61, 42, 0.14);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--line);
    box-shadow: var(--shadow);
}

.metric {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.92);
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 9px;
    font-size: 34px;
    line-height: 1;
}

.panel {
    display: none;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: rise 240ms ease-out;
}

.panel.active {
    display: block;
}

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

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #d9dee4;
    border-radius: 8px;
    background: rgba(246, 248, 250, 0.78);
}

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

.date-group label,
.size-select {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.date-group input,
.size-select select {
    min-height: 34px;
    color: var(--ink-soft);
    border: 1px solid #cfd7df;
    border-radius: 6px;
    background: #ffffff;
}

.date-group input {
    width: 144px;
    padding: 0 8px;
}

.size-select select {
    width: 78px;
    padding: 0 8px;
}

.tool-button,
.pager-button {
    min-height: 34px;
    padding: 0 12px;
    color: var(--ink-soft);
    border: 1px solid #cfd7df;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
}

.tool-button:hover,
.tool-button.active,
.pager-button:hover:not(:disabled) {
    color: var(--ink);
    border-color: rgba(8, 127, 131, 0.38);
    background: #eaf6f5;
}

.pager-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 18px;
}

.summary-block {
    min-height: 220px;
    padding: 20px;
    border: 1px solid #d9dee4;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
}

.block-label {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

#summary-text {
    margin: 0;
    color: var(--ink-soft);
    font-size: 17px;
    line-height: 1.8;
    white-space: pre-wrap;
}

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

.timeline-row,
.data-row,
.learning-item {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.timeline-row:first-child,
.data-row:first-child,
.learning-item:first-child {
    border-top: 0;
    padding-top: 0;
}

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

.row-title strong {
    font-size: 15px;
}

.meta-line {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.run-summary {
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.segmented {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef2f5;
}

.segment {
    min-width: 64px;
    min-height: 32px;
    padding: 0 12px;
    color: var(--muted);
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

.segment.active {
    color: var(--ink);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(28, 35, 45, 0.08);
}

.data-list,
.learning-board {
    display: grid;
    gap: 16px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 38px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
}

.pagination strong {
    color: var(--ink-soft);
    font-size: 13px;
}

.data-row {
    display: grid;
    gap: 10px;
}

.severity {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.severity.HIGH {
    color: #8c1f10;
    background: #fde8e2;
}

.severity.MEDIUM {
    color: #7a4d09;
    background: #fff1cf;
}

.severity.LOW,
.severity.INFO {
    color: #1d5f42;
    background: #ddf4e8;
}

.category {
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

.evidence,
.recommendation,
.learning-content {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.7;
    white-space: pre-wrap;
}

.evidence {
    padding: 10px 12px;
    overflow-x: auto;
    color: #24303d;
    border: 1px solid #d8e0e8;
    border-radius: 6px;
    background: #f2f5f7;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 12px;
}

.learning-item h3 {
    margin: 0 0 10px;
    font-size: 21px;
}

.learning-content {
    font-size: 15px;
}

.code-sample {
    margin: 14px 0 0;
    padding: 14px;
    overflow-x: auto;
    color: #f4f7fb;
    border-radius: 8px;
    background: #16181d;
    font-size: 13px;
}

.source-hint {
    margin-top: 12px;
    padding-top: 10px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.compact .data-row {
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.5fr) minmax(180px, 0.8fr);
    align-items: start;
}

.empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border: 1px dashed #c8d0d8;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.54);
}

@keyframes rise {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .rail {
        position: static;
        height: auto;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav-tabs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin-top: 18px;
    }

    .nav-tab {
        grid-template-columns: 1fr;
        justify-items: center;
        min-height: 58px;
        padding: 8px;
        text-align: center;
    }

    .workspace {
        padding: 24px 16px 38px;
    }

    .topbar,
    .panel-heading,
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .metric-strip,
    .summary-grid,
    .compact .data-row {
        grid-template-columns: 1fr;
    }
}

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

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

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

    .date-group input {
        width: min(100%, 180px);
    }

    .pagination {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
