:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #111827;
    --muted: #64748b;
    --subtle: #94a3b8;
    --line: #dbe3ee;
    --line-strong: #cbd5e1;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #15803d;
    --green-bg: #dcfce7;
    --amber: #b45309;
    --amber-bg: #fef3c7;
    --red: #b91c1c;
    --red-bg: #fee2e2;
    --gray-bg: #e2e8f0;
    --sidebar: 236px;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.skip-link {
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 1000;
    transform: translateY(-140%);
    background: #ffffff;
    color: var(--blue);
    border: 2px solid var(--blue);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-weight: 760;
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .55);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #0f172a;
    color: #e5e7eb;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

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

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--blue);
    display: grid;
    place-items: center;
    font-weight: 800;
    color: white;
}

.brand-title { font-size: 15px; font-weight: 750; }
.brand-sub { color: #94a3b8; font-size: 12px; margin-top: 1px; }

.nav-list { display: grid; gap: 6px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 650;
    min-height: 44px;
}
.nav-link svg, .btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.nav-link.active, .nav-link:hover { background: rgba(255,255,255,0.08); color: white; }

.main {
    min-width: 0;
    padding: 24px;
}

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

h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: 0;
}

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

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

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel + .panel { margin-top: 16px; }

.panel-header {
    min-height: 54px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-title { font-size: 15px; font-weight: 780; }
.panel-note, .muted { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; }

.btn {
    height: 36px;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 0 12px;
    background: white;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 720;
    white-space: nowrap;
}

.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: white; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: white; }
.btn.warning { background: var(--amber-bg); border-color: #fde68a; color: var(--amber); }
.btn.success { background: var(--green-bg); border-color: #bbf7d0; color: var(--green); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 760;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge.idle, .badge.ready { color: #475569; background: var(--gray-bg); }
.badge.queued, .badge.warning { color: var(--amber); background: var(--amber-bg); }
.badge.running { color: #1d4ed8; background: #dbeafe; }
.badge.completed, .badge.pass { color: var(--green); background: var(--green-bg); }
.badge.failed, .badge.fail { color: var(--red); background: var(--red-bg); }

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    min-height: 84px;
}
.stat-label { color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-value { margin-top: 8px; font-size: 26px; font-weight: 800; line-height: 1; }

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

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th {
    height: 42px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
    font-weight: 760;
    border-bottom: 1px solid var(--line);
    padding: 0 12px;
}
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    vertical-align: middle;
    font-size: 13px;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #f8fbff; }

.empty-state {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted);
}
.empty-state strong { display: block; color: var(--text); margin-bottom: 5px; }

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--gray-bg);
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
    transition: width .25s ease;
}

.step-list { display: grid; gap: 10px; }
.step-item {
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: white;
}
.step-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: #e2e8f0;
    color: #334155;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}
.step-item.active { border-color: var(--blue); background: #eff6ff; }
.step-item.completed { border-color: #bbf7d0; background: #f0fdf4; }
.step-item.failed { border-color: #fecaca; background: #fef2f2; }
.step-name { font-weight: 760; font-size: 13px; }
.step-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }

.log-area {
    background: #0f172a;
    border-radius: var(--radius);
    padding: 12px;
    max-height: 360px;
    overflow-y: auto;
}
.log-title { color: #cbd5e1; font-weight: 760; font-size: 13px; margin-bottom: 8px; }
.log-content { font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 1.55; }
.log-entry { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.log-time { color: #64748b; margin-right: 8px; }
.log-message { color: #e2e8f0; }
.log-entry.progress .log-message { color: #bfdbfe; }
.log-entry.artifact .log-message, .log-entry.success .log-message { color: #86efac; }
.log-entry.warning .log-message { color: #fcd34d; }
.log-entry.error .log-message { color: #fca5a5; }

.notice {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    padding: 10px 12px;
    font-size: 13px;
    background: var(--surface-muted);
    color: var(--muted);
}
.notice.success { color: var(--green); background: var(--green-bg); border-color: #bbf7d0; }
.notice.error { color: var(--red); background: var(--red-bg); border-color: #fecaca; }
.notice.warning { color: var(--amber); background: var(--amber-bg); border-color: #fde68a; }

.upload-zone {
    min-height: 180px;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-muted);
    display: grid;
    place-items: center;
    text-align: center;
    cursor: pointer;
    padding: 18px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--blue); background: #eff6ff; }
.file-input { display: none; }

.report-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.media-box video, .media-box img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #0f172a;
}
.media-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius);
}
.pre-text {
    white-space: pre-wrap;
    max-height: 360px;
    overflow: auto;
    color: #334155;
    font-size: 13px;
    background: var(--surface-muted);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
}
.analysis-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 10px;
}
.analysis-head {
    width: 100%;
    min-height: 48px;
    border: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
    text-align: left;
}
.analysis-body { display: none; padding: 12px; border-top: 1px solid var(--line); background: var(--surface-muted); }
.analysis-body.open { display: block; }
.module-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}
.criteria-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.criterion {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface-muted);
}
.criterion-title { display: flex; justify-content: space-between; gap: 8px; font-weight: 720; font-size: 13px; }
.criterion-detail { color: #475569; font-size: 12px; margin-top: 8px; }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15,23,42,.55);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.show { display: flex; }
.modal[hidden] { display: none; }
.modal img, .modal video {
    max-width: min(1100px, 96vw);
    max-height: 88vh;
    background: #0f172a;
    border-radius: var(--radius);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

.beian-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 20px 22px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.beian-footer__icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 auto;
}

.beian-footer a {
    color: inherit;
    text-decoration: none;
}

.beian-footer a:hover,
.beian-footer a:focus-visible {
    color: var(--blue);
    text-decoration: underline;
}

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

@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 12px;
    }
    .brand-sub { display: none; }
    .nav-list { display: flex; margin-left: auto; }
    .main { padding: 16px; }
    .topbar { flex-direction: column; }
    .stats-grid, .criteria-grid { grid-template-columns: 1fr; }
}
