:root {
    color-scheme: dark;
    --bg: #0d1014;
    --bg-soft: #121722;
    --panel: #171d27;
    --panel-2: #1e2633;
    --panel-3: #253041;
    --text: #f2f6fb;
    --muted: #9dadc1;
    --line: #303b4d;
    --line-strong: #46556b;
    --cyan: #5ec9ff;
    --green: #65d98b;
    --amber: #ffd166;
    --red: #ff7474;
    --ink: #081016;
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, #0d1014 0%, #10151d 48%, #0b0e12 100%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 96px);
    color: var(--text);
    font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

body.public-page {
    background:
        linear-gradient(180deg, #0d1014 0%, #111923 52%, #0d1014 100%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 92px);
}

header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    min-height: 76px;
    padding: 14px clamp(18px, 4vw, 46px);
    background: rgba(13, 16, 20, 0.9);
    border-bottom: 1px solid rgba(88, 105, 132, 0.42);
    backdrop-filter: blur(14px);
}

header > * {
    min-width: 0;
}

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

.brand div {
    min-width: 0;
}

.brand h1,
.brand span {
    overflow-wrap: anywhere;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--cyan), var(--green));
    color: var(--ink);
    font-weight: 900;
}

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

h1 {
    font-size: 20px;
    line-height: 1.1;
}

h2 {
    font-size: 22px;
    line-height: 1.18;
    margin-bottom: 12px;
}

h3 {
    font-size: 17px;
    line-height: 1.25;
    margin-bottom: 10px;
}

header span,
.muted,
small {
    color: var(--muted);
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.nav-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.hamburger {
    display: none;
}

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

a:hover {
    color: #9be0ff;
}

.nav-button,
.button-link,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    white-space: normal;
}

.button-link.primary,
button {
    border-color: rgba(94, 201, 255, 0.72);
    background: linear-gradient(180deg, #236587, #17475e);
    color: #f5fbff;
    box-shadow: 0 10px 30px rgba(17, 79, 111, 0.34);
}

.button-link.secondary,
.nav-button {
    background: rgba(30, 38, 51, 0.9);
}

button:hover,
.button-link:hover,
.nav-button:hover {
    border-color: var(--cyan);
    color: #ffffff;
}

button:disabled,
input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

main {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 24px clamp(18px, 4vw, 46px) 46px;
}

.public-hero {
    position: relative;
    min-height: min(650px, calc(100vh - 150px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    align-content: center;
    align-items: center;
    gap: 24px;
    padding: clamp(34px, 7vw, 92px) clamp(18px, 5vw, 72px);
    overflow: hidden;
    border: 1px solid rgba(89, 108, 136, 0.34);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(13, 16, 20, 0.96) 0%, rgba(13, 16, 20, 0.84) 48%, rgba(13, 16, 20, 0.28) 100%),
        linear-gradient(140deg, #1b2a36 0%, #16242e 42%, #202019 100%);
}

.public-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 72px 72px;
    opacity: 0.26;
    pointer-events: none;
}

.hero-copy,
.hero-actions,
.release-strip {
    position: relative;
    z-index: 2;
    width: min(720px, 100%);
    grid-column: 1;
    min-width: 0;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--amber);
    font-weight: 800;
}

.hero-copy h2 {
    max-width: 760px;
    font-size: 54px;
    line-height: 1.03;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.hero-copy p:last-child {
    max-width: 680px;
    margin: 0;
    color: #cbd7e6;
    font-size: 17px;
}

.hero-actions,
.button-row,
form.inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.release-strip span {
    min-height: 66px;
    padding: 12px;
    border: 1px solid rgba(94, 201, 255, 0.25);
    border-radius: 8px;
    background: rgba(8, 16, 22, 0.66);
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.release-strip strong {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-visual {
    position: relative;
    z-index: 1;
    grid-column: 2;
    grid-row: 1 / span 3;
    width: 100%;
    min-height: 360px;
    padding: 16px;
    border: 1px solid rgba(132, 151, 176, 0.34);
    border-radius: 8px;
    background: rgba(17, 23, 32, 0.88);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
    min-width: 0;
}

.visual-top {
    display: flex;
    gap: 7px;
    height: 28px;
    align-items: center;
    border-bottom: 1px solid rgba(132, 151, 176, 0.2);
    margin-bottom: 14px;
}

.visual-top span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cyan);
}

.visual-top span:nth-child(2) {
    background: var(--amber);
}

.visual-top span:nth-child(3) {
    background: var(--green);
}

.visual-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr;
    gap: 10px;
}

.visual-panel {
    min-height: 96px;
    padding: 12px;
    border: 1px solid rgba(132, 151, 176, 0.24);
    border-radius: 8px;
    background: #151d28;
    min-width: 0;
}

.visual-panel.wide {
    grid-column: span 2;
}

.visual-panel.tall {
    grid-row: span 2;
}

.visual-panel b {
    display: block;
    margin-bottom: 12px;
}

.visual-panel strong {
    display: block;
    font-size: 34px;
    color: var(--green);
}

.visual-panel em,
.visual-panel i {
    display: block;
    height: 9px;
    margin: 8px 0;
    border-radius: 8px;
    background: linear-gradient(90deg, #5ec9ff, #65d98b);
    opacity: 0.82;
}

.visual-panel em:nth-child(3),
.visual-panel i:nth-child(3) {
    width: 72%;
}

.visual-panel em:nth-child(4),
.visual-panel i:nth-child(4) {
    width: 48%;
}

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

.feature-band article,
.download-panel,
.metric,
.card,
.grid > div,
.empty,
.login-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(23, 29, 39, 0.92);
    min-width: 0;
}

.feature-band article,
.download-panel,
.grid > div,
.empty {
    padding: 18px;
}

.feature-band p,
.download-panel p {
    margin: 0;
    color: #c8d4e3;
}

.download-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    min-width: 0;
}

section {
    margin-bottom: 24px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.metric {
    padding: 15px;
}

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

.metric strong {
    display: block;
    margin-top: 5px;
    font-size: 22px;
}

.grid {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
    gap: 14px;
}

.card {
    padding: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

th {
    color: var(--muted);
    font-weight: 700;
}

form.inline {
    margin: 8px 0;
}

form.inline > *,
form.action-form > * {
    max-width: 100%;
}

form.upload-form {
    display: grid;
    grid-template-columns: minmax(86px, 110px) minmax(116px, 142px) minmax(0, 1fr) auto;
    width: 100%;
}

.version-input {
    width: 100%;
}

.file-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
}

.file-picker input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-picker span {
    pointer-events: none;
}

.file-name {
    min-width: 0;
    align-self: center;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

form.mini {
    display: inline-flex;
    margin: 2px;
}

input,
select {
    min-height: 38px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    padding: 7px 10px;
    font: inherit;
    min-width: 0;
    max-width: 100%;
}

input:focus,
select:focus {
    outline: 2px solid rgba(94, 201, 255, 0.42);
    outline-offset: 1px;
}

code {
    color: #b7e0ff;
    overflow-wrap: anywhere;
}

.perm-list,
.audit-list {
    padding-left: 18px;
}

.perm-list li,
.audit-list li {
    margin: 6px 0;
}

.pill {
    display: inline-block;
    margin: 2px;
    padding: 2px 7px;
    border-radius: 8px;
    background: #243244;
    color: #e0ebf8;
}

.alert,
.result,
#toast {
    padding: 11px 13px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.alert,
.bad,
.deny {
    color: #ffecec;
    background: #3b2025;
    border-color: #7c3945;
}

.ok,
.allow {
    color: #eafff2;
    background: #173526;
    border-color: #36764f;
}

.danger button {
    border-color: #7c3945;
    background: #3b2025;
    box-shadow: none;
}

#toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: 420px;
}

@media (max-width: 1020px) {
    form.upload-form {
        grid-template-columns: 1fr;
    }

    .file-name {
        white-space: normal;
    }

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

    .dashboard-visual {
        grid-column: 1;
        grid-row: auto;
    }

    .hero-copy h2 {
        font-size: 42px;
    }

    .feature-band {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    header {
        align-items: center;
        min-height: 66px;
        padding: 12px 16px;
    }

    .hamburger {
        display: inline-grid;
        place-items: center;
        width: 42px;
        height: 42px;
        margin-left: auto;
        border: 1px solid var(--line-strong);
        border-radius: 8px;
        background: rgba(30, 38, 51, 0.9);
        cursor: pointer;
    }

    .hamburger span {
        display: block;
        width: 20px;
        height: 2px;
        margin: 2px 0;
        border-radius: 2px;
        background: var(--text);
    }

    header nav {
        position: absolute;
        top: calc(100% + 8px);
        right: 16px;
        left: 16px;
        display: none;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(18, 23, 32, 0.98);
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    }

    .nav-toggle:checked ~ nav {
        display: grid;
        grid-template-columns: 1fr;
    }

    header nav a,
    header nav .nav-button {
        width: 100%;
        justify-content: flex-start;
        min-height: 42px;
    }

    main {
        padding: 14px;
    }

    .public-hero {
        min-height: auto;
        padding: 28px 16px;
    }

    .hero-copy h2 {
        font-size: 32px;
    }

    .release-strip,
    .cards,
    .grid.two {
        grid-template-columns: 1fr;
    }

    .download-panel {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .visual-panel.wide,
    .visual-panel.tall {
        grid-column: auto;
        grid-row: auto;
    }

}
