:root {
    color-scheme: dark;
    --bg: #080b10;
    --surface: #0d1117;
    --surface-2: #131920;
    --border: rgba(148, 163, 184, 0.18);
    --border-strong: rgba(0, 212, 255, 0.38);
    --text: #edf4ff;
    --muted: #8b98a9;
    --soft: #c7d2e3;
    --blue: #0066ff;
    --cyan: #00d4ff;
    --danger: #ff6b7a;
    --success: #2dd4bf;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 12%, rgba(0, 102, 255, 0.18), transparent 34%),
        radial-gradient(circle at 82% 0%, rgba(0, 212, 255, 0.12), transparent 30%),
        var(--bg);
    font-family: "Inter", Arial, sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.mono {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar,
.auth-language-bar {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.topbar {
    min-height: 76px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.auth-language-bar {
    min-height: 72px;
    justify-content: flex-end;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    color: var(--text);
    text-decoration: none;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.logo-static {
    pointer-events: none;
}

.logo-mark {
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

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

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.84);
}

.lang-option {
    min-width: 42px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.lang-option.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.user-pill,
.logout-link,
.status-badge {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--soft);
    background: rgba(19, 25, 32, 0.78);
    font-size: 13px;
    font-weight: 600;
}

.user-pill {
    padding: 0 12px;
}

.logout-link {
    padding: 0 14px;
    text-decoration: none;
}

.logout-link:hover {
    border-color: var(--border-strong);
    color: #ffffff;
}

.page {
    width: min(1180px, calc(100% - 32px));
    flex: 1;
    margin: 0 auto;
    padding: 34px 0 42px;
}

.auth-page .page {
    display: grid;
    place-items: center;
    padding-top: 18px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border: 1px solid rgba(255, 107, 122, 0.28);
    border-radius: 8px;
    color: #ffd7dc;
    background: rgba(255, 107, 122, 0.12);
}

.flash-success {
    border-color: rgba(45, 212, 191, 0.28);
    color: #b6fff5;
    background: rgba(45, 212, 191, 0.12);
}

.hero,
.data-panel,
.auth-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(19, 25, 32, 0.96), rgba(13, 17, 23, 0.96));
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    padding: 34px;
}

.scan-form {
    width: min(440px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.scan-form input {
    height: 46px;
    min-width: 0;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: #080b10;
    outline: none;
}

.scan-form input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.scan-status-panel {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-top: 18px;
    padding: 18px 20px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: rgba(0, 102, 255, 0.08);
}

.scan-status-panel[hidden] {
    display: none;
}

.eyebrow {
    display: inline-flex;
    margin-bottom: 10px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero h1,
.auth-heading h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.02;
    letter-spacing: 0;
}

.hero p,
.auth-heading p {
    max-width: 680px;
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.primary-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 14px 36px rgba(0, 102, 255, 0.26);
}

.secondary-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--soft);
    background: rgba(19, 25, 32, 0.78);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.secondary-button:hover {
    border-color: var(--border-strong);
    color: #ffffff;
}

.hero-button {
    min-width: 172px;
}

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

.metric-card {
    min-height: 142px;
    display: grid;
    align-content: space-between;
    gap: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.metric-label {
    color: var(--soft);
    font-size: 14px;
    font-weight: 700;
}

.metric-value {
    font-size: 34px;
    line-height: 1;
}

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

.data-panel {
    margin-top: 18px;
    padding: 24px;
}

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

.panel-header h2 {
    margin: 0;
    font-size: 24px;
}

.status-badge {
    padding: 0 12px;
}

.target-link {
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: rgba(0, 212, 255, 0.05);
}

.state,
.score-badge,
.severity {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.trend {
    margin-left: 6px;
    font-size: 14px;
}

.trend-indicator {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.42);
}

.trend-indicator span {
    font-size: 18px;
    font-weight: 900;
}

.trend-indicator strong,
.trend-indicator em {
    font-size: 13px;
}

.trend-indicator em {
    color: var(--muted);
    font-style: normal;
}

.trend-down,
.change-down {
    color: #9ff7e8;
}

.trend-up,
.change-up {
    color: #ffb3bd;
}

.trend-equal,
.change-equal {
    color: var(--muted);
}

.change {
    font-weight: 800;
}

.state-running,
.state-queued {
    color: #8bdcff;
    background: rgba(0, 212, 255, 0.12);
}

.state-completed,
.score-low,
.severity-low {
    color: #8bdcff;
    background: rgba(0, 212, 255, 0.14);
}

.state-failed,
.score-high,
.severity-high {
    color: #ffbf8a;
    background: rgba(249, 115, 22, 0.18);
}

.severity-critical {
    color: #ffb3bd;
    background: rgba(255, 107, 122, 0.16);
}

.score-medium,
.severity-medium {
    color: #ffe39a;
    background: rgba(245, 158, 11, 0.16);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(19, 25, 32, 0.96), rgba(13, 17, 23, 0.96));
    box-shadow: var(--shadow);
}

.detail-header h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 52px);
    letter-spacing: 0;
}

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

.back-link {
    display: inline-flex;
    margin-bottom: 14px;
    color: var(--soft);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.score-panel,
.findings-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.score-panel {
    display: grid;
    place-items: center;
    min-height: 260px;
}

.score-ring {
    position: relative;
    width: 190px;
    height: 190px;
}

.score-ring svg {
    width: 190px;
    height: 190px;
    transform: rotate(-90deg);
}

.score-ring circle {
    fill: none;
    stroke-width: 10;
}

.ring-bg {
    stroke: rgba(255, 255, 255, 0.08);
}

.ring-fg {
    stroke: var(--cyan);
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    animation: score-draw 1s ease-out forwards;
}

@keyframes score-draw {
    to {
        stroke-dashoffset: var(--score-offset);
    }
}

.score-center {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
}

.score-center strong {
    font-size: 44px;
    line-height: 1;
}

.score-center span {
    color: var(--muted);
}

.findings-panel {
    padding: 22px;
}

.panel-header.compact {
    margin-bottom: 12px;
}

.findings-list {
    display: grid;
    gap: 12px;
}

.finding {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.48);
}

.finding strong {
    display: block;
    margin-top: 10px;
}

.finding p,
.muted {
    color: var(--muted);
}

.report-frame {
    width: 100%;
    height: 760px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
}

.raw-json {
    max-height: 760px;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--soft);
    background: #080b10;
}

.chart-panel {
    height: 320px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.48);
}

.chart-panel h3 {
    margin: 0 0 14px;
    font-size: 16px;
}

.chart-panel canvas {
    width: 100%;
    height: 250px;
}

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

.sentinel-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(8, 11, 16, 0.48);
}

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

.sentinel-card-header strong {
    color: #ffffff;
    font-size: 16px;
}

.sentinel-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.sentinel-facts div {
    min-width: 0;
}

.sentinel-facts dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.sentinel-facts dd {
    margin: 0;
    color: var(--soft);
    overflow-wrap: anywhere;
}

.ports-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.port-chip {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--soft);
    background: rgba(19, 25, 32, 0.72);
    font-size: 12px;
}

.collapsible-panel details {
    display: grid;
    gap: 16px;
}

.collapsible-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
}

.collapsible-panel summary::marker {
    color: var(--cyan);
}

.collapsible-panel .table-wrap {
    margin-top: 16px;
}

.empty-note {
    margin: 16px 0 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--muted);
    background: rgba(8, 11, 16, 0.46);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

td {
    color: var(--soft);
}

tr:last-child td {
    border-bottom: 0;
}

.empty-row td {
    height: 160px;
    text-align: center;
}

.empty-row strong,
.empty-row span {
    display: block;
}

.empty-row strong {
    margin-bottom: 8px;
    color: var(--text);
    font-size: 16px;
}

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

.auth-card {
    width: min(440px, 100%);
    padding: 30px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.auth-heading {
    text-align: center;
}

.auth-heading h1 {
    font-size: 34px;
}

.auth-heading .status-badge {
    margin-top: 18px;
}

.auth-form {
    display: grid;
    gap: 16px;
    margin-top: 26px;
}

.auth-links {
    display: grid;
    gap: 10px;
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: #8bdcff;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.password-hint {
    margin: -2px 0 4px;
    color: var(--muted);
    font-size: 12px;
}

.password-hint.is-valid {
    color: #9ff7e8;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    color: var(--soft);
    font-size: 14px;
    font-weight: 700;
}

.field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    background: #080b10;
    outline: none;
}

.field input::placeholder {
    color: #5f6b7b;
}

.field input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.footer {
    width: min(1180px, calc(100% - 32px));
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0 auto;
    padding: 20px 0 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.footer-version {
    white-space: nowrap;
}

@media (max-width: 860px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        padding: 18px 0;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .scan-form {
        grid-template-columns: 1fr;
    }

    .hero-button {
        width: 100%;
    }

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

    .detail-header,
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

    .sentinel-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .page,
    .topbar,
    .auth-language-bar,
    .footer {
        width: min(100% - 24px, 1180px);
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .panel-header,
    .footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .auth-card {
        padding: 24px;
    }
}
