:root {
    --outpost-bg: #05080c;
    --outpost-text: #e9f2ff;
    --outpost-muted: #a9bece;
    --outpost-surface: rgba(9, 14, 20, 0.78);
    --outpost-surface-strong: rgba(6, 11, 17, 0.92);
    --outpost-line: rgba(117, 170, 201, 0.28);
    --outpost-primary: #ffa654;
    --outpost-primary-hover: #ff8b3d;
    --outpost-danger: #c43b45;
    --outpost-danger-hover: #a82f38;
    --outpost-warning: #f2c14e;
    --outpost-success: #4bd09a;
    --outpost-cyan: #61cdff;
    --muted: var(--outpost-muted);
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    color: var(--outpost-text);
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.58)),
        url("../bg.jpg") center center / cover no-repeat fixed,
        radial-gradient(circle at 18% 82%, rgba(255, 166, 84, 0.2), transparent 38%),
        radial-gradient(circle at 78% 22%, rgba(97, 205, 255, 0.14), transparent 35%),
        linear-gradient(165deg, #04070b 0%, #070d14 52%, #05080c 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.22;
    mix-blend-mode: screen;
    background: repeating-linear-gradient(to bottom,
            rgba(255, 255, 255, 0.03) 0px,
            rgba(255, 255, 255, 0.03) 1px,
            transparent 2px,
            transparent 4px);
}

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

a:hover,
a:focus {
    color: #a8e4ff;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin-top: 0;
}

code,
pre {
    color: #d4e7f9;
    background: rgba(3, 8, 13, 0.76);
    border: 1px solid rgba(116, 169, 201, 0.18);
    border-radius: 8px;
}

code {
    padding: 0.1rem 0.35rem;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

.container,
.main-wrapper {
    width: min(1180px, 92vw);
    margin: 0 auto;
}

.container {
    padding: 1.2rem 0 2.5rem;
    display: grid;
    gap: 1rem;
}

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

.app-main {
    flex: 1;
}

.main-wrapper {
    padding: 1.4rem 0 2.5rem;
    display: grid;
    gap: 1rem;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(6, 10, 16, 0.76);
    border-bottom: 1px solid var(--outpost-line);
    backdrop-filter: blur(10px);
}

.app-header-inner,
.header-wrapper {
    width: min(1180px, 92vw);
    min-height: 70px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.brand,
.header-branding,
.app-title a {
    color: var(--outpost-text);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 166, 84, 0.36));
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text span {
    margin-top: 0.16rem;
    color: var(--outpost-muted);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    font-weight: 500;
}

.app-title {
    margin: 0;
    font-size: 1.1rem;
}

.env-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    color: #1b0d03;
    background: var(--outpost-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.nav,
.header-nav ul,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav a,
.header-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0.48rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--outpost-muted);
    font-weight: 600;
}

.nav a:hover,
.nav a.active,
.header-nav a:hover {
    color: var(--outpost-text);
    background: rgba(7, 17, 28, 0.88);
    border-color: rgba(97, 205, 255, 0.28);
}

.logout-form {
    margin: 0;
}

.page-title,
.card-header.split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title h1,
.hero-content h2 {
    margin-bottom: 0.25rem;
    font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.page-title p,
.card-header p,
.hero-content p,
.muted,
.empty,
.card-subtitle,
.download-info,
.footer-text,
.footer-links a {
    color: var(--outpost-muted);
}

.card,
.download-card,
.checksum-detail,
details summary,
[style*="background: #f9f9f9"],
[style*="background: #f0f9f0"],
[style*="background: #fffbf0"],
[style*="background: #fdf0f0"] {
    background: var(--outpost-surface) !important;
    border: 1px solid var(--outpost-line);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.34),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 0 24px rgba(97, 205, 255, 0.08);
    backdrop-filter: blur(8px);
}

.card {
    padding: 1rem;
    overflow: hidden;
}

.card + .card,
.stats-grid + .card,
.danger-zone {
    margin-top: 1rem;
}

.card-header {
    margin: -1rem -1rem 1rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(116, 169, 201, 0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.card-header h2,
.card-header h3,
.card-title {
    margin: 0;
    font-size: 1.15rem;
}

.card-body {
    padding: 0;
}

.card-footer {
    margin: 1rem -1rem -1rem;
    padding: 1rem;
    border-top: 1px solid rgba(116, 169, 201, 0.18);
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.stats-grid,
.grid {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.grid--cols-sm-1 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid--cols-md-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

.stat-card {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card span {
    color: var(--outpost-muted);
    font-size: 0.9rem;
}

.stat-card strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--outpost-primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.detail-grid span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--outpost-muted);
    font-size: 0.88rem;
}

.detail-grid strong {
    display: block;
    overflow-wrap: anywhere;
}

.auth-shell,
.login-container,
.error-page {
    min-height: min(64vh, 720px);
    display: grid;
    place-items: center;
}

.auth-card,
.login-card {
    width: min(560px, 100%);
}

.login-header,
.login-body,
.login-footer {
    padding: 1rem;
}

.form-stack {
    display: grid;
    gap: 0.9rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.form-grid .wide,
.span-2 {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
    width: 100%;
    border: 1px solid rgba(110, 171, 211, 0.35);
    border-radius: 8px;
    padding: 0.6rem 0.7rem;
    font: inherit;
    color: var(--outpost-text);
    background: rgba(5, 10, 16, 0.92);
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(97, 205, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(97, 205, 255, 0.14);
}

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

input::placeholder,
textarea::placeholder {
    color: var(--outpost-muted);
}

.form-actions,
.actions,
.table-toolbar,
.table-footer,
.pager {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.actions form {
    display: inline-flex;
    gap: 0.6rem;
    margin: 0;
}

.table-footer {
    margin-top: 0.7rem;
    justify-content: space-between;
}

.checkbox-grid {
    display: grid;
    gap: 0.65rem;
    padding: 0;
    border: 0;
}

.checkbox-grid label {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    margin: 0;
}

.btn,
.btn--primary,
.btn--secondary {
    border-radius: 8px;
    padding: 0.52rem 0.8rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    transition: filter 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn-primary,
.btn--primary {
    background: linear-gradient(135deg, var(--outpost-primary) 0%, var(--outpost-primary-hover) 100%);
    color: #140a04;
    border-color: rgba(255, 194, 140, 0.45);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.22) inset,
        0 8px 22px rgba(255, 140, 61, 0.34);
}

.btn-primary:hover,
.btn--primary:hover {
    filter: brightness(1.06) saturate(1.08);
    color: #140a04;
}

.btn-secondary,
.btn--secondary {
    background: rgba(7, 17, 28, 0.88);
    color: var(--outpost-text);
    border-color: rgba(97, 205, 255, 0.28);
}

.btn-secondary:hover,
.btn--secondary:hover {
    background: rgba(15, 30, 45, 0.95);
    color: var(--outpost-text);
}

.btn-danger {
    background: var(--outpost-danger);
    color: #fff;
    border-color: rgba(255, 177, 177, 0.25);
}

.btn-danger:hover {
    background: var(--outpost-danger-hover);
    color: #fff;
}

.btn-warning {
    background: var(--outpost-warning);
    color: #1b1203;
    border-color: rgba(255, 220, 128, 0.45);
}

.btn-sm,
.btn--small {
    padding: 0.36rem 0.58rem;
    font-size: 0.88rem;
}

.btn-block,
.btn--block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge-success {
    color: #b9f1da;
    background: rgba(50, 122, 95, 0.22);
    border-color: rgba(120, 212, 177, 0.3);
}

.badge-warning {
    color: #ffd8a1;
    background: rgba(124, 84, 35, 0.24);
    border-color: rgba(242, 193, 78, 0.28);
}

.badge-danger {
    color: #ffb8bf;
    background: rgba(140, 40, 45, 0.24);
    border-color: rgba(231, 146, 151, 0.3);
}

.badge-secondary {
    color: #c5d6e3;
    background: rgba(20, 40, 56, 0.48);
    border-color: rgba(117, 170, 201, 0.24);
}

.alert {
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(119, 179, 231, 0.46);
    background: rgba(24, 66, 110, 0.24);
}

.alert-success {
    background: rgba(50, 122, 95, 0.22);
    border-color: rgba(120, 212, 177, 0.5);
}

.alert-error,
.alert-danger {
    background: rgba(140, 40, 45, 0.24);
    border-color: rgba(231, 146, 151, 0.44);
}

.alert-warning {
    background: rgba(145, 101, 26, 0.24);
    border-color: rgba(242, 193, 78, 0.46);
}

.alert-link {
    margin-left: 0.5rem;
    color: var(--outpost-cyan);
    font-weight: 700;
    word-break: break-all;
}

.error {
    display: block;
    margin-top: 0.35rem;
    color: #ffb7bd;
}

small,
.small {
    color: var(--outpost-muted) !important;
    font-size: 0.86rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--outpost-line);
    margin: 1.25rem 0;
}

.table-responsive,
.downloads-table {
    overflow-x: auto;
}

.table,
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
    background: rgba(4, 10, 16, 0.36);
    border-radius: 10px;
    overflow: hidden;
}

.table th,
.table td,
th,
td {
    border-top: 1px solid rgba(116, 169, 201, 0.18);
    padding: 0.65rem;
    text-align: left;
    vertical-align: top;
}

.table th,
th {
    background: rgba(9, 22, 34, 0.9);
    color: #d4e7f9;
    font-weight: 700;
}

tbody tr:hover {
    background: rgba(97, 205, 255, 0.06);
}

.table-sort {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.table-toolbar {
    margin-bottom: 0.8rem;
    justify-content: space-between;
}

.table-toolbar .form-control {
    width: auto;
    min-width: 160px;
}

.table-footer [data-table-info],
.table-footer [data-table-page-label] {
    color: var(--outpost-muted);
}

.log-box,
.code-box {
    max-height: 420px;
    white-space: pre-wrap;
}

.danger-zone {
    padding: 1rem;
    border: 1px solid rgba(231, 146, 151, 0.44);
    border-radius: 12px;
    background: rgba(140, 40, 45, 0.16);
}

.hero {
    text-align: center;
    padding: 2.2rem 0 1.5rem;
}

.download-card {
    padding: 1rem;
    text-align: center;
}

.download-icon,
.card-icon {
    font-size: 2rem;
}

.download-note,
.help-steps,
.faq-item p {
    color: var(--outpost-muted);
}

details {
    margin-bottom: 0.8rem;
}

details summary {
    padding: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.app-footer {
    border-top: 1px solid var(--outpost-line);
    background: rgba(6, 10, 16, 0.68);
}

.footer-wrapper {
    width: min(1180px, 92vw);
    margin: 0 auto;
    padding: 1rem 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 820px) {
    .app-header-inner,
    .header-wrapper {
        min-height: 56px;
        flex-wrap: wrap;
        padding: 0.5rem 0;
    }

    .brand-text span {
        display: none;
    }

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

    .table-toolbar {
        align-items: stretch;
    }

    .table-toolbar .form-control,
    .table-toolbar label {
        width: 100%;
    }
}
