:root {
    --bg: #03070d;
    --surface: #07111d;
    --panel: #0b1725;
    --panel-2: #102236;
    --text: #f4f8ff;
    --muted: #a9b8c8;
    --dim: #7e8fa3;
    --line: rgba(255, 255, 255, 0.11);
    --cyan: #21b7ff;
    --blue: #087bff;
    --mint: #38d39f;
    --amber: #f5b84b;
    --red: #ff657c;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(5, 9, 15, 0.96), rgba(5, 9, 15, 1)),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(to bottom, black, transparent 86%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 12px;
    z-index: 2000;
    padding: 12px 16px;
    background: var(--cyan);
    color: #00121f;
    font-weight: 800;
    text-decoration: none;
}

.skip-link:focus {
    left: 12px;
}

.portal-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 76px;
    padding: 12px min(6vw, 42px);
    display: flex;
    align-items: center;
    gap: 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(1, 5, 10, 0.92);
    backdrop-filter: blur(18px);
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: max-content;
}

.portal-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(33, 183, 255, 0.55);
    border-radius: 8px;
    color: white;
    background: #07111d;
    box-shadow: inset 0 0 20px rgba(33, 183, 255, 0.18);
    font-family: Orbitron, Arial, sans-serif;
    font-weight: 800;
}

.portal-brand strong {
    display: block;
    font-family: Orbitron, Arial, sans-serif;
    font-size: 1.1rem;
}

.portal-brand strong span {
    color: var(--cyan);
}

.portal-brand small {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
}

.portal-nav a {
    color: #dbe8f8;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
}

.portal-nav a:hover,
.portal-nav a:focus {
    color: var(--cyan);
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-menu-toggle,
.portal-menu-button {
    display: none;
}

.user-chip {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.portal-shell {
    width: min(1180px, 90vw);
    margin: 0 auto;
    padding: 38px 0 70px;
}

.portal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 28px;
    align-items: end;
    margin-bottom: 28px;
}

.eyebrow {
    color: var(--cyan);
    text-transform: uppercase;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

h1,
h2,
h3 {
    margin: 0;
}

h1,
h2 {
    font-family: Orbitron, Arial, sans-serif;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.06;
}

.lede {
    max-width: 760px;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.75;
    margin: 14px 0 0;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

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

.panel,
.metric,
.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
}

.panel {
    padding: 22px;
}

.panel h2,
.panel h3 {
    margin-bottom: 12px;
}

.panel p,
.empty {
    color: var(--muted);
    line-height: 1.7;
}

.metric {
    padding: 20px;
}

.metric span {
    display: block;
    color: var(--dim);
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.metric strong {
    display: block;
    font-family: Orbitron, Arial, sans-serif;
    font-size: 1.7rem;
}

.button,
button,
.icon-button {
    min-height: 44px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 8px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: white;
    background: rgba(255,255,255,0.06);
    font: inherit;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

.button.primary,
button.primary {
    color: #00131f;
    border-color: transparent;
    background: linear-gradient(135deg, var(--blue), #31c8ff);
}

.button.success,
button.success {
    color: #061014;
    border-color: transparent;
    background: var(--mint);
}

.button.danger,
button.danger {
    border-color: transparent;
    background: var(--red);
}

.icon-button {
    width: 44px;
    padding: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

form {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 7px;
    color: #dce8f6;
    font-size: 0.88rem;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--text);
    background: rgba(2, 8, 14, 0.8);
    font: inherit;
}

textarea {
    min-height: 122px;
    resize: vertical;
}

input[type="file"] {
    padding: 10px;
}

.help {
    color: var(--dim);
    font-size: 0.82rem;
    line-height: 1.55;
}

.flash {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 15px;
    margin-bottom: 18px;
    color: white;
    background: rgba(255,255,255,0.06);
}

.flash.success {
    border-color: rgba(56, 211, 159, 0.5);
    background: rgba(56, 211, 159, 0.12);
}

.flash.warning {
    border-color: rgba(245, 184, 75, 0.5);
    background: rgba(245, 184, 75, 0.12);
}

.flash.error {
    border-color: rgba(255, 101, 124, 0.5);
    background: rgba(255, 101, 124, 0.12);
}

.table-wrap {
    overflow: auto;
}

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

th,
td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--cyan);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    color: #dce8f6;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge.good {
    color: #061014;
    background: var(--mint);
}

.badge.warn {
    color: #0f0b01;
    background: var(--amber);
}

.badge.danger {
    color: white;
    background: var(--red);
}

.badge.neutral {
    color: #dce8f6;
    background: rgba(255,255,255,0.1);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

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

.photo-tile img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #03070d;
}

.photo-tile div {
    padding: 12px;
}

.photo-tile strong {
    display: block;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.photo-tile span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-top: 5px;
}

.split-panel {
    display: grid;
    grid-template-columns: 0.84fr 1.16fr;
    gap: 18px;
    align-items: start;
}

.split-panel.single {
    grid-template-columns: minmax(0, 560px);
}

.ai-brief {
    white-space: pre-wrap;
    padding: 16px;
    border: 1px solid rgba(33, 183, 255, 0.22);
    border-radius: 8px;
    color: #dce8f6;
    background: rgba(33, 183, 255, 0.07);
    line-height: 1.65;
}

.portal-footer {
    width: min(1180px, 90vw);
    margin: 0 auto;
    padding: 28px 0 42px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    color: var(--dim);
    border-top: 1px solid var(--line);
    font-size: 0.86rem;
}

@media (max-width: 980px) {
    .portal-header {
        align-items: center;
        flex-wrap: wrap;
    }

    .portal-menu-button {
        width: 44px;
        height: 44px;
        margin-left: auto;
        display: grid;
        place-items: center;
        border: 1px solid var(--line);
        border-radius: 8px;
        cursor: pointer;
    }

    .portal-actions {
        order: 3;
        width: 100%;
        justify-content: flex-end;
    }

    .portal-nav {
        order: 4;
        width: 100%;
        display: none;
        grid-template-columns: 1fr;
        gap: 0;
        border-top: 1px solid var(--line);
        padding-top: 12px;
    }

    .portal-menu-toggle:checked ~ .portal-nav {
        display: grid;
    }

    .portal-nav a {
        padding: 12px 0;
    }

    .portal-hero,
    .split-panel,
    .grid.two,
    .grid.three,
    .grid.four,
    .field-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .portal-shell {
        width: min(100% - 28px, 1180px);
        padding-top: 28px;
    }

    .portal-brand strong {
        font-size: 0.98rem;
    }

    .portal-brand small {
        font-size: 0.6rem;
    }

    .portal-footer {
        width: min(100% - 28px, 1180px);
        display: grid;
    }

    .button,
    button {
        width: 100%;
    }
}
