:root {
    --bg: #080b12;
    --panel: rgba(255, 255, 255, 0.055);
    --panel-strong: rgba(255, 255, 255, 0.09);
    --text: #f5f7fb;
    --muted: #9aa6b7;
    --soft: #c8d2e1;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #8be9d1;
    --accent-2: #7aa7ff;
    --warning: #ffd166;
    --danger: #ff7f9c;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 14%, rgba(122, 167, 255, 0.18), transparent 30%),
        radial-gradient(circle at 86% 12%, rgba(139, 233, 209, 0.13), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(139, 233, 209, 0.07), transparent 35%),
        linear-gradient(135deg, #080b12 0%, #101727 50%, #080a10 100%);
}

/* Login / 2FA pages */

.page {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page header {
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.page main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 42px 0 78px;
}

.wrap {
    width: min(480px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--panel-strong), var(--panel));
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.top-link {
    color: var(--soft);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.045);
}

/* Workspace app layout */

.app {
    display: none;
    min-height: 100vh;
}

body.ready .app {
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    border-right: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(18px);
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 34px;
    white-space: nowrap;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: block;
    flex: 0 0 auto;
    filter: drop-shadow(0 14px 28px rgba(139, 233, 209, 0.14));
}

.brand-text {
    display: flex;
    align-items: baseline;
    gap: 5px;
    font-weight: 760;
    font-size: 17px;
    letter-spacing: 0.005em;
}

.brand-text .muted {
    color: var(--accent);
}

.nav-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 740;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 22px 12px 10px;
}

.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--soft);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 6px;
    font-size: 14px;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--line);
    color: var(--text);
}

.nav small {
    color: var(--muted);
    font-size: 11px;
}

.account-box {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.045);
    border-radius: 18px;
    padding: 16px;
}

.account-name {
    color: var(--text);
    font-size: 14px;
    font-weight: 680;
    margin-bottom: 4px;
}

.account-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.main {
    padding: 30px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 30px;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 720;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

.wrap .eyebrow {
    display: inline-flex;
    border: 1px solid rgba(139, 233, 209, 0.28);
    background: rgba(139, 233, 209, 0.08);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    font-size: clamp(36px, 4vw, 56px);
    line-height: 1.08;
    letter-spacing: -0.025em;
    font-weight: 720;
}

.wrap h1 {
    font-size: 42px;
    line-height: 1.1;
}

.subtitle,
.lead,
p {
    color: var(--muted);
}

.subtitle {
    margin: 16px 0 0;
    font-size: 16px;
    line-height: 1.68;
    max-width: 760px;
}

.wrap p {
    margin: 16px 0 26px;
    line-height: 1.68;
    font-size: 15px;
}

/* Buttons and forms */

button,
.button {
    border: 0;
    border-radius: 999px;
    padding: 11px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #071017;
    font-weight: 730;
    text-decoration: none;
    cursor: pointer;
    font-size: 13px;
}

button.secondary,
.button.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--line);
}

button:disabled,
.button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wrap button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
}

input {
    width: 100%;
    padding: 15px 16px;
    margin-bottom: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.26);
    color: var(--text);
    font-size: 15px;
    outline: none;
}

input:focus {
    border-color: rgba(139, 233, 209, 0.45);
    box-shadow: 0 0 0 4px rgba(139, 233, 209, 0.08);
}

/* Shared cards */

.metric,
.card,
.panel,
.traffic-panel,
.project-card,
.upload-card,
.queue-panel,
.output-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--panel-strong), var(--panel));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.metric {
    border-radius: 22px;
    padding: 18px;
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 720;
    letter-spacing: -0.01em;
}

.metric-note {
    color: var(--muted);
    font-size: 12px;
    margin-top: 8px;
}

.card,
.project-card,
.output-card {
    border-radius: 24px;
    padding: 22px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.upload-card,
.queue-panel,
.panel {
    border-radius: 24px;
    padding: 22px;
}

.card h3,
.panel h3,
.project-card h3,
.upload-card h3,
.queue-panel h3,
.output-card h3 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 19px;
    line-height: 1.28;
    letter-spacing: -0.005em;
    font-weight: 680;
}

.card p,
.panel p,
.project-card p,
.upload-card p,
.queue-panel p,
.output-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.64;
    font-size: 14px;
}

.card-footer,
.project-footer,
.output-footer {
    margin-top: 22px;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-footer,
.output-footer {
    display: grid;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(139, 233, 209, 0.1);
    color: #bff8ea;
    font-size: 12px;
    font-weight: 680;
}

.pill.blue {
    background: rgba(122, 167, 255, 0.12);
    color: #c7d8ff;
}

.pill.warn {
    background: rgba(255, 209, 102, 0.12);
    color: #ffe7a6;
}

.pill.gray {
    background: rgba(255, 255, 255, 0.08);
    color: var(--soft);
}

.project-card .pill,
.output-card .pill,
.upload-card .pill {
    margin-bottom: 14px;
}

/* Grids */

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.workspace-grid,
.project-grid,
.output-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.upload-grid,
.queue-grid,
.grid,
.lower-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.upload-grid,
.queue-grid,
.lower-grid {
    grid-template-columns: 1.35fr 0.85fr;
}

.grid {
    grid-template-columns: 1.15fr 0.85fr;
}

/* Tables and rows */

.table {
    margin-top: 16px;
    border-top: 1px solid var(--line);
}

.row {
    display: grid;
    grid-template-columns: 1.35fr 0.75fr 0.75fr 0.75fr;
    gap: 14px;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
    color: var(--soft);
    font-size: 14px;
}

.row:last-child {
    border-bottom: 0;
}

.file-name,
.job-name,
.item-name {
    color: var(--text);
    font-weight: 680;
}

/* Lists and notes */

.info-list {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.info-item {
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.16);
    border-radius: 18px;
    padding: 15px;
}

.info-item strong {
    display: block;
    color: var(--text);
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 680;
}

.info-item span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

/* Traffic widget */

.traffic-panel {
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 18px;
}

.traffic-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.traffic-head h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 19px;
    line-height: 1.28;
    letter-spacing: -0.005em;
    font-weight: 680;
}

.traffic-head p {
    margin: 0;
    color: var(--muted);
    line-height: 1.64;
    font-size: 14px;
}

.traffic-time {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    padding-top: 4px;
}

.traffic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.traffic-card {
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.16);
    border-radius: 18px;
    padding: 16px;
}

.traffic-label {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--soft);
    font-size: 14px;
    margin-bottom: 10px;
}

.traffic-value {
    color: var(--text);
    font-weight: 720;
}

.traffic-bar {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
}

.traffic-bar span {
    display: block;
    height: 100%;
    min-width: 2%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Upload page */

.drop-zone {
    margin-top: 18px;
    border: 1px dashed rgba(139, 233, 209, 0.35);
    background: rgba(139, 233, 209, 0.05);
    border-radius: 22px;
    padding: 28px;
    text-align: center;
}

.drop-zone strong {
    display: block;
    font-size: 18px;
    margin-bottom: 8px;
}

.drop-zone span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

/* Render queue progress */

.progress-card {
    margin-top: 18px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.16);
    border-radius: 20px;
    padding: 18px;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    color: var(--soft);
    font-size: 14px;
}

.progress-bar {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.10);
}

.progress-bar span {
    display: block;
    height: 100%;
    width: 68%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* API Keys */

.status-box {
    margin-top: 18px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.16);
    border-radius: 20px;
    padding: 18px;
}

.status-box strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 15px;
}

.status-box span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

/* Errors */

.error {
    display: none;
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 127, 156, 0.12);
    color: #ffd0dc;
    border: 1px solid rgba(255, 127, 156, 0.34);
}

.small {
    margin-top: 20px;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

.small a {
    color: var(--accent);
    text-decoration: none;
}

.small a:hover {
    text-decoration: underline;
}

/* Responsive */

@media (max-width: 1050px) {
    body.ready .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .account-box {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        margin-top: 18px;
    }

    .metrics,
    .workspace-grid,
    .project-grid,
    .upload-grid,
    .queue-grid,
    .output-grid,
    .lower-grid,
    .traffic-grid,
    .grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .traffic-head {
        flex-direction: column;
    }

    .top-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .main {
        padding: 22px 14px;
    }

    .sidebar {
        padding: 22px 14px;
    }

    .row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    h1 {
        font-size: 36px;
        line-height: 1.1;
        letter-spacing: -0.015em;
    }
}

@media (max-width: 620px) {
    .page {
        width: min(100% - 24px, 1180px);
    }

    .page header {
        min-height: auto;
        padding: 22px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .wrap {
        padding: 26px;
        border-radius: 24px;
    }

    .wrap h1 {
        font-size: 36px;
    }

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