/**
 * ============================================================
 * AI Pro Command - Script Safety Scanner
 * File: assets/css/style.css
 * ============================================================
 */

/* ============================================================
   Variables
   ============================================================ */

:root {
    --bg: #070812;
    --bg-soft: #101225;
    --card: rgba(255, 255, 255, 0.075);
    --card-strong: rgba(255, 255, 255, 0.11);
    --border: rgba(255, 255, 255, 0.13);
    --text: #f5f7ff;
    --muted: #a7aec8;

    --purple: #8b5cf6;
    --purple-strong: #7a00ff;
    --cyan: #00d9ff;

    --danger: #ff4d6d;
    --danger-strong: #ff2f56;
    --danger-soft: rgba(255, 77, 109, 0.10);

    --warning: #ffcc66;
    --warning-soft: rgba(255, 204, 102, 0.10);

    --success: #31d67b;
    --success-soft: rgba(49, 214, 123, 0.10);

    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);

    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

/* ============================================================
   Base
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Tahoma, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 10%, rgba(139, 92, 246, 0.28), transparent 34%),
        radial-gradient(circle at 80% 12%, rgba(0, 217, 255, 0.16), transparent 30%),
        radial-gradient(circle at 50% 100%, rgba(122, 0, 255, 0.20), transparent 42%),
        linear-gradient(145deg, #070812 0%, #0b0d1c 52%, #05060d 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

a {
    color: #dffaff;
}

code {
    color: #dffaff;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    word-break: break-word;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

.muted {
    color: var(--muted);
}

/* ============================================================
   Layout
   ============================================================ */

.page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 64px 0;
}

.hero {
    text-align: center;
    margin-bottom: 34px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid rgba(0, 217, 255, 0.28);
    border-radius: 999px;
    color: #dffaff;
    background: rgba(0, 217, 255, 0.08);
    box-shadow: 0 0 35px rgba(0, 217, 255, 0.12);
    font-size: 13px;
    letter-spacing: 0.3px;
}

h1 {
    margin: 22px 0 12px;
    font-size: clamp(42px, 8vw, 78px);
    line-height: 0.95;
    letter-spacing: -2px;
    text-shadow:
        0 0 24px rgba(139, 92, 246, 0.45),
        0 0 45px rgba(0, 217, 255, 0.16);
}

.subtitle {
    max-width: 790px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

/* ============================================================
   Top Navigation
   ============================================================ */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.top-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.top-nav a,
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: #dffaff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.055);
    font-size: 13px;
    line-height: 1;
    transition: 0.18s ease;
}

.top-nav a:hover,
.nav-link:hover {
    border-color: rgba(0, 217, 255, 0.35);
    background: rgba(0, 217, 255, 0.08);
    transform: translateY(-1px);
}

/* ============================================================
   Cards / Upload
   ============================================================ */

.upload-card {
    position: relative;
    max-width: 680px;
    margin: 0 auto 34px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045)),
        rgba(11, 13, 28, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
}

.upload-card::before {
    content: "";
    position: absolute;
    inset: -2px;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(139, 92, 246, 0.6), transparent 35%, rgba(0, 217, 255, 0.35));
    opacity: 0.18;
}

.upload-card > * {
    position: relative;
    z-index: 1;
}

.upload-card h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

.notice {
    margin: 0 0 22px;
    color: var(--warning);
    font-size: 14px;
}

.file-box {
    display: block;
    width: 100%;
    padding: 26px;
    border: 1px dashed rgba(255, 255, 255, 0.24);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.055);
    cursor: pointer;
    transition: 0.2s ease;
}

.file-box:hover {
    border-color: rgba(0, 217, 255, 0.55);
    background: rgba(0, 217, 255, 0.07);
}

.file-title {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

.file-hint {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 14px;
}

.file-box input {
    width: 100%;
    margin-top: 18px;
    color: var(--muted);
}

.file-box input[type="password"],
.file-box input[type="text"],
.file-box input[type="email"] {
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.24);
    outline: none;
}

.file-box input[type="password"]:focus,
.file-box input[type="text"]:focus,
.file-box input[type="email"]:focus {
    border-color: rgba(0, 217, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 217, 255, 0.08);
}

.file-box input::file-selector-button {
    margin-right: 14px;
    padding: 10px 14px;
    border: 0;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--purple), var(--purple-strong));
    cursor: pointer;
}

.btn {
    width: 100%;
    margin-top: 18px;
    padding: 15px 20px;
    border: 0;
    border-radius: var(--radius-md);
    color: white;
    background:
        linear-gradient(135deg, var(--purple-strong), var(--purple) 55%, var(--cyan));
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow:
        0 14px 34px rgba(122, 0, 255, 0.32),
        0 0 28px rgba(0, 217, 255, 0.15);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.btn:active {
    transform: translateY(0);
}

/* ============================================================
   Info Cards
   ============================================================ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.info-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.info-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    max-width: 760px;
    margin: 24px auto;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.07);
}

.alert.error {
    border-color: rgba(255, 77, 109, 0.38);
    background: var(--danger-soft);
    color: #ffd6de;
}

.alert.success {
    border-color: rgba(49, 214, 123, 0.38);
    background: var(--success-soft);
    color: #d8ffe8;
}

/* ============================================================
   Report Page
   ============================================================ */

.report-page {
    padding-top: 44px;
}

.report-hero {
    margin-bottom: 24px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    max-width: 980px;
    margin: 0 auto 24px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.065);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.report-summary > div {
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.065);
}

.summary-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.report-summary strong {
    display: block;
    font-size: 20px;
    word-break: break-word;
}

.risk-critical {
    border-color: rgba(255, 77, 109, 0.5);
    box-shadow: 0 0 60px rgba(255, 77, 109, 0.16);
}

.risk-high {
    border-color: rgba(255, 143, 77, 0.5);
    box-shadow: 0 0 60px rgba(255, 143, 77, 0.13);
}

.risk-medium {
    border-color: rgba(255, 204, 102, 0.45);
    box-shadow: 0 0 60px rgba(255, 204, 102, 0.11);
}

.risk-low {
    border-color: rgba(0, 217, 255, 0.35);
}

.risk-safe {
    border-color: rgba(49, 214, 123, 0.42);
    box-shadow: 0 0 60px rgba(49, 214, 123, 0.10);
}

.risk-unknown {
    border-color: rgba(255, 255, 255, 0.18);
}

.report-card {
    max-width: 980px;
}

.report-verdict {
    margin: 0;
    color: var(--text);
    font-size: 17px;
    line-height: 1.7;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 22px;
}

.meta-grid > div {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
}

.meta-grid span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}

/* ============================================================
   AI Report
   ============================================================ */

.ai-report-wrap {
    margin-top: 18px;
}

.ai-report {
    position: relative;
    padding: 0;
    border: 1px solid rgba(0, 217, 255, 0.18);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 15% 0%, rgba(139, 92, 246, 0.18), transparent 38%),
        radial-gradient(circle at 90% 10%, rgba(0, 217, 255, 0.12), transparent 34%),
        rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.ai-report::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(139, 92, 246, 0.18), transparent 32%, rgba(0, 217, 255, 0.10)),
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: auto, 34px 34px, 34px 34px;
    opacity: 0.8;
}

.ai-report > * {
    position: relative;
    z-index: 1;
}

.ai-report-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.045);
}

.ai-report-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 999px;
    color: #cfd6f2;
    background: rgba(255, 255, 255, 0.055);
    font-size: 12px;
    line-height: 1.25;
}

.ai-report-meta span:first-child {
    color: #dffaff;
    border-color: rgba(0, 217, 255, 0.28);
    background: rgba(0, 217, 255, 0.08);
    font-weight: 800;
}

.ai-report-meta strong {
    margin-left: 4px;
    color: #ffffff;
}

.ai-report-body {
    padding: 26px;
    color: #eef3ff;
}

.ai-report-body h3 {
    margin: 30px 0 14px;
    padding: 0 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    color: #ffffff;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.5px;
    text-shadow: 0 0 22px rgba(139, 92, 246, 0.20);
}

.ai-report-body h3:first-child {
    margin-top: 0;
}

.ai-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    margin-right: 8px;
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: 999px;
    color: #dffaff;
    background: rgba(0, 217, 255, 0.08);
    font-size: 14px;
    vertical-align: middle;
}

.ai-report-body p {
    margin: 0 0 15px;
    color: #d9def4;
    font-size: 15px;
    line-height: 1.75;
}

.ai-report-body strong {
    color: #ffffff;
    font-weight: 900;
}

.ai-list {
    display: grid;
    gap: 9px;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.ai-list li {
    position: relative;
    padding: 11px 13px 11px 38px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius-md);
    color: #d9def4;
    background: rgba(255, 255, 255, 0.045);
    font-size: 14px;
    line-height: 1.55;
}

.ai-list li::before {
    content: "";
    position: absolute;
    left: 15px;
    top: 19px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--purple), var(--cyan));
    box-shadow: 0 0 14px rgba(0, 217, 255, 0.28);
}

.ai-inline-code,
.ai-report-body code {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid rgba(0, 217, 255, 0.18);
    border-radius: 8px;
    color: #dffaff;
    background: rgba(0, 0, 0, 0.24);
    font-family: Consolas, Monaco, monospace;
    font-size: 0.92em;
    line-height: 1.35;
    word-break: break-word;
}

.ai-report-body a {
    color: #dffaff;
    text-decoration: none;
    border-bottom: 1px dashed rgba(0, 217, 255, 0.35);
}

.ai-report-body a:hover {
    color: #ffffff;
    border-bottom-color: rgba(0, 217, 255, 0.75);
}

/* ============================================================
   Findings
   ============================================================ */

.findings-list {
    display: grid;
    gap: 14px;
}

.finding {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.055);
}

.finding-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.finding-head strong {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.finding-head span {
    color: var(--muted);
    font-size: 13px;
}

.finding p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.finding-meta {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.evidence {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.24);
    color: #dffaff;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.sev-critical {
    border-color: rgba(255, 77, 109, 0.5);
    background: rgba(255, 77, 109, 0.09);
}

.sev-critical .finding-head strong {
    background: rgba(255, 77, 109, 0.2);
    color: #ffd6de;
}

.sev-high {
    border-color: rgba(255, 143, 77, 0.45);
    background: rgba(255, 143, 77, 0.08);
}

.sev-high .finding-head strong {
    background: rgba(255, 143, 77, 0.18);
    color: #ffe1cf;
}

.sev-medium {
    border-color: rgba(255, 204, 102, 0.42);
    background: rgba(255, 204, 102, 0.07);
}

.sev-medium .finding-head strong {
    background: rgba(255, 204, 102, 0.17);
    color: #fff0cb;
}

.sev-low {
    border-color: rgba(0, 217, 255, 0.32);
}

.sev-low .finding-head strong,
.sev-info .finding-head strong {
    background: rgba(0, 217, 255, 0.12);
    color: #dffaff;
}

/* ============================================================
   Tables
   ============================================================ */

.file-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 960px;
}

.file-table th,
.file-table td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    font-size: 13px;
    vertical-align: middle;
}

.file-table th {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-table tr:last-child td {
    border-bottom: 0;
}

.file-table td code {
    display: inline-block;
    max-width: 170px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

/* ============================================================
   Scan History
   ============================================================ */

.risk-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    border: 1px solid var(--border);
}

.risk-pill.risk-critical {
    color: #ffd6de;
    background: rgba(255, 77, 109, 0.16);
    border-color: rgba(255, 77, 109, 0.42);
    box-shadow: none;
}

.risk-pill.risk-high {
    color: #ffe1cf;
    background: rgba(255, 143, 77, 0.14);
    border-color: rgba(255, 143, 77, 0.42);
    box-shadow: none;
}

.risk-pill.risk-medium {
    color: #fff0cb;
    background: rgba(255, 204, 102, 0.13);
    border-color: rgba(255, 204, 102, 0.38);
    box-shadow: none;
}

.risk-pill.risk-low {
    color: #dffaff;
    background: rgba(0, 217, 255, 0.10);
    border-color: rgba(0, 217, 255, 0.32);
    box-shadow: none;
}

.risk-pill.risk-safe {
    color: #d8ffe8;
    background: rgba(49, 214, 123, 0.12);
    border-color: rgba(49, 214, 123, 0.35);
    box-shadow: none;
}

.risk-pill.risk-unknown {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: none;
}

.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-actions form {
    display: inline-flex;
    margin: 0;
}

.table-link,
.file-table a.table-link,
.file-table button.table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 7px 11px;
    border: 0;
    border-radius: 999px;
    color: #ffffff !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, var(--purple), var(--cyan));
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 217, 255, 0.12);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.table-link:hover,
.file-table a.table-link:hover,
.file-table button.table-link:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.table-link-danger,
.file-table button.table-link-danger {
    background: linear-gradient(135deg, var(--danger-strong), var(--danger));
    box-shadow: 0 8px 22px rgba(255, 77, 109, 0.14);
}

.table-link-danger:hover,
.file-table button.table-link-danger:hover {
    box-shadow: 0 10px 28px rgba(255, 77, 109, 0.20);
}

.file-table a:not(.table-link) {
    color: #dffaff;
}

.history-table-wrap {
    overflow-x: visible;
}

.history-table {
    min-width: 0;
    table-layout: auto;
}

.history-table th,
.history-table td {
    padding: 14px 14px;
}

.history-table th:first-child,
.history-table td:first-child {
    width: 34%;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2),
.history-table th:nth-child(3),
.history-table td:nth-child(3),
.history-table th:nth-child(4),
.history-table td:nth-child(4),
.history-table th:nth-child(5),
.history-table td:nth-child(5) {
    white-space: nowrap;
}

.history-table th:last-child,
.history-table td:last-child {
    width: 190px;
    text-align: right;
}

.history-table .table-actions {
    justify-content: flex-end;
}

.history-main-row td {
    background: rgba(255, 255, 255, 0.012);
}

.history-details-row td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.history-verdict {
    padding: 14px !important;
    color: #cfd6f2;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(0, 217, 255, 0.025)),
        rgba(255, 255, 255, 0.025);
    font-size: 12px;
    line-height: 1.5;
}

.history-detail-line {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 12px;
    color: #d9def4;
}

.history-detail-line strong {
    color: #ffffff;
    white-space: nowrap;
}

.history-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.history-detail-grid span {
    display: block;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: #cfd6f2;
    background: rgba(0, 0, 0, 0.14);
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-detail-grid strong {
    color: #ffffff;
}

.history-detail-grid code {
    max-width: 100%;
    font-size: 12px;
    vertical-align: middle;
}

.pagination {
    display: inline-flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #dffaff;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
}

.pagination a:hover {
    border-color: rgba(0, 217, 255, 0.35);
    background: rgba(0, 217, 255, 0.08);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
    .page {
        width: min(100% - 22px, 1120px);
        padding: 34px 0;
    }

    .subtitle {
        font-size: 15px;
    }

    .upload-card {
        padding: 20px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .report-summary {
        grid-template-columns: 1fr;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .finding-meta {
        display: block;
    }

    .finding-meta span {
        display: block;
        margin-bottom: 4px;
    }

    .file-table {
        min-width: 1060px;
    }

    .history-table-wrap {
        overflow-x: auto;
    }

    .history-table {
        min-width: 760px;
    }

    .history-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .top-nav-group {
        justify-content: center;
    }

    .ai-report-body {
        padding: 20px;
    }

    .ai-report-body h3 {
        font-size: 21px;
    }

    .ai-report-meta {
        align-items: stretch;
        flex-direction: column;
    }

    .ai-report-meta span {
        width: 100%;
        justify-content: center;
    }

    h1 {
        letter-spacing: -1px;
    }
}

@media (max-width: 520px) {
    .page {
        width: min(100% - 18px, 1120px);
        padding: 26px 0;
    }

    h1 {
        font-size: clamp(38px, 13vw, 56px);
    }

    .subtitle {
        line-height: 1.55;
    }

    .upload-card h2 {
        font-size: 24px;
    }

    .file-box {
        padding: 20px;
    }

    .btn {
        padding: 14px 18px;
    }

    .badge {
        font-size: 12px;
    }

    .table-actions {
        gap: 6px;
    }

    .table-link,
    .file-table a.table-link,
    .file-table button.table-link {
        min-width: 58px;
        padding: 7px 10px;
    }

    .history-table {
        min-width: 720px;
    }

    .history-table th:last-child,
    .history-table td:last-child {
        width: 150px;
    }

    .history-table .table-actions {
        align-items: flex-end;
        flex-direction: column;
    }

    .history-table .table-link,
    .history-table a.table-link,
    .history-table button.table-link {
        width: 74px;
    }

    .history-detail-grid {
        grid-template-columns: 1fr;
    }

    .history-detail-line {
        display: block;
    }

    .history-detail-line strong {
        display: block;
        margin-bottom: 4px;
    }

    .ai-report-body {
        padding: 16px;
    }

    .ai-report-body h3 {
        font-size: 19px;
    }

    .ai-report-body p {
        font-size: 14px;
    }

    .ai-list li {
        padding: 10px 12px 10px 34px;
        font-size: 13px;
    }

    .ai-list li::before {
        left: 13px;
    }

    .ai-section-number {
        min-width: 30px;
        height: 30px;
        font-size: 13px;
    }
}