:root {
    --bg: #f3efe7;
    --bg-accent: #e4f0e7;
    --panel: rgba(255, 252, 246, 0.84);
    --panel-strong: rgba(255, 252, 246, 0.95);
    --ink: #192126;
    --muted: #5c656b;
    --line: rgba(25, 33, 38, 0.12);
    --sea: #0f766e;
    --ember: #c2410c;
    --moss: #3f6212;
    --dusk: #1d4ed8;
    --danger: #b42318;
    --shadow: 0 24px 70px rgba(37, 44, 52, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(194, 65, 12, 0.16), transparent 30%),
        linear-gradient(135deg, var(--bg) 0%, var(--bg-accent) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
.ghost-button {
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.2rem;
    background: linear-gradient(135deg, #192126, #33414b);
    color: #fff;
    font: inherit;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(25, 33, 38, 0.18);
}

button.secondary,
.ghost-button {
    background: rgba(25, 33, 38, 0.08);
    color: var(--ink);
}

button.danger {
    background: linear-gradient(135deg, #b42318, #dc6803);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink);
    font: inherit;
}

textarea {
    resize: vertical;
}

label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 2rem 1.5rem;
    background: rgba(21, 28, 33, 0.9);
    color: #f7f4ed;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(20px);
}

.sidebar h1,
.login-card h1,
.page-head h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 0.95;
}

.page-head h2 {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.eyebrow {
    margin: 0 0 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: rgba(247, 244, 237, 0.68);
}

.content .eyebrow,
.login-card .eyebrow {
    color: var(--sea);
}

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

.mono {
    font-family: "IBM Plex Mono", monospace;
}

.small {
    font-size: 0.84rem;
}

.nav {
    display: grid;
    gap: 0.65rem;
    margin: 2rem 0;
}

.nav a {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    color: rgba(247, 244, 237, 0.82);
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(3px);
}

.sidebar-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: rgba(247, 244, 237, 0.7);
}

.content {
    padding: 2rem;
}

.page-head {
    margin-bottom: 1.5rem;
}

.page-head.split {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

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

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1.2rem;
}

.stat-card,
.panel,
.login-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.stat-card {
    padding: 1.3rem;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card strong {
    font-size: clamp(2rem, 6vw, 4rem);
}

.stat-card span {
    color: rgba(25, 33, 38, 0.72);
}

.stat-card.sea { background: linear-gradient(135deg, rgba(161, 229, 223, 0.95), rgba(241, 252, 251, 0.92)); }
.stat-card.ember { background: linear-gradient(135deg, rgba(253, 213, 183, 0.95), rgba(255, 247, 239, 0.92)); }
.stat-card.moss { background: linear-gradient(135deg, rgba(219, 244, 177, 0.95), rgba(250, 255, 240, 0.92)); }
.stat-card.dusk { background: linear-gradient(135deg, rgba(191, 219, 254, 0.95), rgba(243, 247, 255, 0.92)); }

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

.panel {
    padding: 1.4rem;
}

.single-panel {
    max-width: 820px;
}

.accounts-layout,
.downloader-layout,
.automation-layout {
    align-items: start;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-head h3,
.account-group h4 {
    margin: 0;
    font-size: 1.1rem;
}

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

.narrow-form {
    max-width: 560px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.checkbox-row input {
    width: auto;
}

.inline-actions,
.inline-form-row {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form-row > div {
    flex: 1 1 220px;
}

.section-gap {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.flash-stack {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.flash-stack.compact {
    margin-top: 1rem;
}

.flash {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid transparent;
}

.flash.success {
    background: rgba(63, 98, 18, 0.12);
    border-color: rgba(63, 98, 18, 0.18);
}

.flash.error {
    background: rgba(180, 35, 24, 0.12);
    border-color: rgba(180, 35, 24, 0.18);
}

.table-wrap,
.list-stack {
    display: grid;
    gap: 0.8rem;
}

.list-item,
.account-group,
.info-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--panel-strong);
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.list-item.align-start {
    align-items: start;
}

.list-item p,
.account-group p,
.info-card p {
    margin: 0.3rem 0 0;
    color: var(--muted);
}

.account-group header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    background: rgba(25, 33, 38, 0.08);
}

.badge.done {
    background: rgba(63, 98, 18, 0.12);
    color: var(--moss);
}

.badge.downloading,
.badge.processing,
.badge.queued {
    background: rgba(29, 78, 216, 0.12);
    color: var(--dusk);
}

.badge.error,
.badge.cancelled {
    background: rgba(180, 35, 24, 0.12);
    color: var(--danger);
}

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

.stacked-meta {
    display: grid;
    gap: 0.45rem;
    justify-items: end;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.meta-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.empty-state {
    color: var(--muted);
    margin: 0;
    padding: 1rem 0;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card {
    width: min(100%, 460px);
    padding: 2rem;
}

@media (max-width: 1080px) {
    .shell,
    .stats-grid,
    .panel-grid,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 1.5rem;
    }
}

@media (max-width: 720px) {
    .content,
    .sidebar {
        padding: 1.25rem;
    }

    .page-head.split,
    .panel-head,
    .list-item,
    .account-group header,
    .sidebar-footer {
        display: grid;
    }
}