:root {
    --bg: #080b13;
    --bg-soft: #0d1220;
    --panel: #111827;
    --panel-2: #151d2e;
    --border: #1f2a3d;
    --border-strong: #2b3a52;
    --text: #e8edf7;
    --muted: #94a3b8;
    --dim: #64748b;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-soft: rgba(99, 102, 241, .14);
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, .12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, .12);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(900px 480px at 12% -10%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(760px 420px at 92% 0%, rgba(139, 92, 246, .14), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -.02em;
}

h1 {
    font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.05rem);
    font-weight: 650;
}

h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

p {
    margin: 0;
}

a,
.link {
    color: #a5b4fc;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid rgba(165, 180, 252, .35);
}

a:hover,
.link:hover {
    color: #c7d2fe;
}

code {
    font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
    font-size: .85em;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .1em .38em;
    color: #cbd5e1;
}

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

.tiny {
    font-size: .8rem;
}

/* ---------------------------------------------------------------- layout */
.centered {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.shell {
    width: min(920px, 100% - 32px);
    margin: 0 auto;
    padding: 28px 0 56px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0 26px;
}

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

.topbar__actions form {
    margin: 0;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px 2px 2px;
}

.hero .muted {
    max-width: 62ch;
}

.footer {
    padding-top: 8px;
    text-align: center;
}

/* ----------------------------------------------------------------- brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand--center {
    justify-content: center;
    margin-bottom: 22px;
}

.brand__mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 26px -12px rgba(99, 102, 241, .9);
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand__text strong {
    font-size: 1rem;
    letter-spacing: -.01em;
}

.brand__text small {
    color: var(--muted);
    font-size: .76rem;
}

/* ------------------------------------------------------------------ card */
.card {
    width: 100%;
    background: linear-gradient(180deg, rgba(21, 29, 46, .92), rgba(17, 24, 39, .96));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 34px;
    box-shadow: var(--shadow);
}

.card--narrow {
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card h1 {
    font-size: 1.4rem;
}

/* ----------------------------------------------------------------- alert */
.alert {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .88rem;
    line-height: 1.5;
    background: var(--panel-2);
}

.alert--info {
    border-color: rgba(99, 102, 241, .35);
    background: var(--accent-soft);
    color: #c7d2fe;
}

.alert--warning {
    border-color: rgba(245, 158, 11, .35);
    background: var(--warning-soft);
    color: #fcd34d;
}

.alert--error {
    border-color: rgba(239, 68, 68, .4);
    background: var(--danger-soft);
    color: #fca5a5;
}

.alert code {
    background: rgba(0, 0, 0, .25);
    border-color: transparent;
    color: inherit;
}

/* ---------------------------------------------------------------- inputs */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.field span {
    font-size: .82rem;
    color: var(--muted);
    font-weight: 550;
}

input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: #0b1120;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

input[type="password"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .22);
}

/* --------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    font: inherit;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
    background: var(--panel-2);
    cursor: pointer;
    transition: transform .08s, background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

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

.btn--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 12px 28px -14px rgba(99, 102, 241, .95);
}

.btn--primary:hover:not(:disabled) {
    filter: brightness(1.07);
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--muted);
}

.btn--ghost:hover:not(:disabled) {
    color: var(--text);
    border-color: #3b4b66;
    background: rgba(255, 255, 255, .03);
}

.btn--danger:hover:not(:disabled) {
    color: #fecaca;
    border-color: rgba(239, 68, 68, .5);
    background: var(--danger-soft);
}

.btn--sm {
    padding: 7px 11px;
    font-size: .8rem;
    border-radius: 8px;
}

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

.pill {
    font-size: .76rem;
    color: var(--muted);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .02);
    padding: 6px 11px;
    border-radius: 999px;
    white-space: nowrap;
}

/* -------------------------------------------------------------- dropzone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 46px 24px;
    text-align: center;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background:
        radial-gradient(420px 200px at 50% 0%, rgba(99, 102, 241, .08), transparent 70%),
        rgba(17, 24, 39, .45);
    cursor: pointer;
    outline: none;
    transition: border-color .18s, background .18s, transform .18s;
}

.dropzone:hover,
.dropzone:focus-visible {
    border-color: rgba(99, 102, 241, .65);
    background-color: rgba(99, 102, 241, .05);
}

.dropzone--over {
    border-color: var(--accent);
    background-color: rgba(99, 102, 241, .12);
    transform: scale(1.006);
}

.dropzone__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border-radius: 18px;
    color: #c7d2fe;
    background: rgba(99, 102, 241, .12);
    border: 1px solid rgba(99, 102, 241, .28);
}

.dropzone__title {
    font-size: 1.06rem;
    font-weight: 600;
}

/* ----------------------------------------------------------------- queue */
.queue {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(17, 24, 39, .72);
    overflow: hidden;
}

.queue__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .015);
}

.queue__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
}

.item:first-child {
    border-top: 0;
}

.item__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.item__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.item__name {
    font-weight: 600;
    font-size: .94rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: .78rem;
    color: var(--dim);
}

.item__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.progress {
    position: relative;
    height: 7px;
    margin-top: 12px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .16);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .22s ease;
}

.item--done .progress__bar {
    background: linear-gradient(90deg, #059669, var(--success));
}

.item--error .progress__bar {
    background: linear-gradient(90deg, #b91c1c, var(--danger));
}

.item__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 7px;
    font-size: .78rem;
    color: var(--muted);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .01em;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.badge--ok {
    color: #6ee7b7;
    background: var(--success-soft);
    border-color: rgba(16, 185, 129, .3);
}

.badge--warn {
    color: #fcd34d;
    background: var(--warning-soft);
    border-color: rgba(245, 158, 11, .3);
}

.badge--err {
    color: #fca5a5;
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, .32);
}

.badge--busy {
    color: #c7d2fe;
    background: var(--accent-soft);
    border-color: rgba(99, 102, 241, .3);
}

.result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, .45);
    border: 1px solid var(--border);
    font-size: .78rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result code {
    word-break: break-all;
    font-size: .74rem;
}

/* -------------------------------------------------------------- spinner */
.spinner {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid rgba(199, 210, 254, .35);
    border-top-color: #c7d2fe;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------- notice */
.notice {
    position: sticky;
    bottom: 18px;
    align-self: center;
    max-width: min(560px, 100%);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: rgba(17, 24, 39, .96);
    box-shadow: var(--shadow);
    font-size: .87rem;
    backdrop-filter: blur(8px);
}

.notice--success {
    border-color: rgba(16, 185, 129, .45);
    color: #a7f3d0;
}

.notice--error {
    border-color: rgba(239, 68, 68, .45);
    color: #fecaca;
}

.notice--info {
    border-color: rgba(99, 102, 241, .45);
    color: #c7d2fe;
}

/* --------------------------------------------------------------- utils */
.code {
    background: #05080f;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: .85rem;
    color: #cbd5e1;
    overflow-x: auto;
    margin: 0;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .shell {
        width: min(100%, calc(100% - 24px));
        padding-top: 16px;
    }

    .card {
        padding: 24px;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .dropzone {
        padding: 34px 16px;
    }

    .item__row {
        flex-direction: column;
    }

    .item__actions {
        width: 100%;
    }

    .item__actions .btn {
        flex: 1;
    }
}
