:root {
    --bg0: #f8fafc;
    --bg1: #eef2ff;
    --text: #0b1220;
    --muted: #4b5563;
    --card: rgba(255,255,255,.72);
    --card2: rgba(255,255,255,.9);
    --border: rgba(15,23,42,.12);
    --accent: #60a5fa;
    --accent2: #a78bfa;
    --success: #34d399;
    --danger: #fb7185;
    --shadow: 0 18px 55px rgba(2,6,23,.12);
    --radius: 16px;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
    color: var(--text);
    background: radial-gradient(1200px 600px at 15% 10%, rgba(96,165,250,.18), transparent 55%), radial-gradient(900px 520px at 85% 25%, rgba(167,139,250,.18), transparent 55%), linear-gradient(180deg, var(--bg0), var(--bg1));
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    inset: auto;
    width: 520px;
    height: 520px;
    filter: blur(70px);
    opacity: .28;
    z-index: -1;
}

.orb-a {
    left: -140px;
    top: -140px;
    background: radial-gradient(circle at 40% 40%, var(--accent), transparent 60%);
}

.orb-b {
    right: -180px;
    bottom: -180px;
    background: radial-gradient(circle at 40% 40%, var(--accent2), transparent 60%);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 20px 56px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.brand-title {
    font-size: 28px;
    font-weight: 850;
    letter-spacing: .2px;
}

.brand-tagline {
    margin-top: 6px;
    color: var(--muted);
    max-width: 52ch;
}

.controls {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.label {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .3px;
}

.input {
    min-width: 170px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
    backdrop-filter: blur(10px);
}

    .input:focus {
        border-color: rgba(96,165,250,.45);
        box-shadow: 0 0 0 4px rgba(96,165,250,.18);
    }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    user-select: none;
    white-space: nowrap;
}

    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 30px rgba(0,0,0,.10);
        background: var(--card2);
    }

    .btn:active {
        transform: translateY(0px);
        box-shadow: none;
    }

    .btn.primary {
        border: none;
        background: linear-gradient(135deg, var(--accent), var(--accent2));
        color: #0b1020;
        font-weight: 800;
    }

    .btn.ghost {
        background: transparent;
    }

.panel {
    margin-top: 22px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(14px);
}

.panel-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.18));
}

.panel-title {
    font-size: 16px;
    font-weight: 850;
}

.panel-sub {
    color: var(--muted);
    font-size: 13px;
}

.grid {
    list-style: none;
    margin: 0;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
}

.file-card {
    grid-column: span 6;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card2);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

@media (max-width: 920px) {
    .file-card {
        grid-column: span 12;
    }

    .input {
        min-width: 220px;
    }
}

.file-left {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}

.file-badge {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    letter-spacing: .5px;
    color: #0b1020;
    background: linear-gradient(135deg, rgba(96,165,250,.95), rgba(167,139,250,.95));
    flex: 0 0 auto;
}

.file-meta {
    min-width: 0;
}

.file-name {
    font-weight: 850;
    line-height: 1.2;
    word-break: break-word;
}

.file-sub {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    opacity: .7;
}

.file-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.empty {
    padding: 22px 18px;
}

.empty-title {
    font-size: 16px;
    font-weight: 850;
}

.empty-sub {
    margin-top: 6px;
    color: var(--muted);
}

code {
    padding: .15rem .4rem;
    border-radius: 10px;
    background: rgba(2,6,23,.06);
    border: 1px solid var(--border);
}

.panel-body {
    padding: 16px 18px;
}

.upload-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 820px) {
    .upload-form {
        grid-template-columns: 1fr;
    }

    .upload-actions {
        justify-content: stretch;
    }

        .upload-actions .btn {
            width: 100%;
        }
}

.flash {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.75);
}

    .flash.success {
        border-color: rgba(52,211,153,.35);
        background: rgba(52,211,153,.12);
    }

    .flash.error {
        border-color: rgba(251,113,133,.35);
        background: rgba(251,113,133,.12);
    }

    .flash.info {
        border-color: rgba(96,165,250,.30);
        background: rgba(96,165,250,.12);
    }

.footer {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
}

.muted {
    color: var(--muted);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(2,6,23,.92);
    color: #fff;
    padding: 10px 12px;
    border-radius: 999px;
    box-shadow: 0 22px 70px rgba(0,0,0,.18);
    transition: opacity .18s ease, transform .18s ease;
}

    .toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0px);
    }

/* --- Diagnostics page helpers --- */
.diag-body {
    display: grid;
    gap: 12px;
}

.diag-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.consent-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

    .consent-row input[type="checkbox"] {
        margin-top: 3px;
    }

.diag-pre {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(2,6,23,.06);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 120px;
}

.iframe-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(2,6,23,.06);
    height: 560px;
}

    .iframe-wrap iframe {
        width: 100%;
        height: 100%;
        border: 0;
        display: block;
    }
