:root {
    color-scheme: light;
    --bg: #f5f7f8;
    --surface: #ffffff;
    --text: #1c2228;
    --muted: #64707d;
    --line: #dfe5ea;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --success-bg: #e8f7ef;
    --success-text: #17663a;
    --danger-bg: #fdecec;
    --danger-text: #a82222;
    --warn-bg: #fff6d8;
    --warn-text: #7a5900;
    --shadow: 0 18px 50px rgba(28, 34, 40, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

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

button,
input,
select {
    font: inherit;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.10), transparent 34%),
        linear-gradient(315deg, rgba(19, 164, 111, 0.10), transparent 32%),
        var(--bg);
}

.auth-shell {
    width: min(100%, 430px);
}

.auth-panel,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 28px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-mark,
.brand span {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #101820;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-block h1,
.panel-title h1,
.panel-title h2 {
    margin: 0;
    letter-spacing: 0;
}

.brand-block h1 {
    font-size: 24px;
}

.brand-block p,
.panel-title p {
    margin: 3px 0 0;
    color: var(--muted);
}

.form-stack {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus {
    border-color: rgba(37, 99, 235, 0.75);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.primary-button,
.small-button {
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.primary-button {
    min-height: 44px;
    padding: 11px 16px;
    background: var(--accent);
    color: #ffffff;
}

.primary-button:hover {
    background: var(--accent-strong);
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    background: #101820;
    color: #ffffff;
    white-space: nowrap;
}

.small-button.secondary {
    background: #eef2f5;
    border: 1px solid var(--line);
    color: var(--text);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 12px clamp(16px, 4vw, 42px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 900;
}

.brand span {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.topbar nav a:hover {
    color: var(--text);
}

.user-chip {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--text);
    background: #ffffff;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 48px;
    display: grid;
    gap: 18px;
}

.page.two-col {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
}

.panel {
    padding: 22px;
}

.panel-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.panel-title h1 {
    font-size: 28px;
}

.panel-title h2 {
    font-size: 20px;
}

.panel-title.compact {
    align-items: center;
    margin-bottom: 14px;
}

.panel-title.spaced {
    margin-top: 28px;
}

.upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 14px;
    align-items: stretch;
}

.file-drop {
    min-height: 96px;
    padding: 18px;
    border: 1px dashed #9eb0c2;
    border-radius: 8px;
    background: #f9fbfc;
    color: var(--text);
    cursor: pointer;
    justify-content: center;
}

.file-drop input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-title {
    font-size: 17px;
    font-weight: 900;
}

.file-name {
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.upload-form .primary-button {
    min-height: 96px;
}

.upload-progress {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
}

.upload-progress[hidden] {
    display: none;
}

.progress-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef4;
    border: 1px solid var(--line);
}

.progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: inherit;
    background: transparent;
}

.progress-bar::-webkit-progress-bar {
    background: transparent;
}

.progress-bar::-webkit-progress-value {
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #13a46f);
    transition: width 0.18s ease;
}

.progress-bar::-moz-progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #13a46f);
}

.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.progress-meta strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 7px;
    border: 1px solid var(--line);
    color: var(--text);
    background: #eef6ff;
}

.alert.success {
    border-color: #bfe8d0;
    background: var(--success-bg);
    color: var(--success-text);
}

.alert.danger {
    border-color: #fac7c7;
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert.info {
    border-color: #c8dcff;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #ffffff;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f8fafb;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:last-child td {
    border-bottom: 0;
}

.subrow td {
    background: #fbfcfd;
    padding-top: 8px;
    padding-bottom: 12px;
}

.actions {
    text-align: right;
}

.inline-form {
    display: inline;
}

.reset-form {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.reset-form input {
    max-width: 240px;
    min-height: 34px;
    padding: 6px 10px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 900;
}

.status.done,
.done {
    background: var(--success-bg);
    color: var(--success-text);
}

.status.failed,
.failed {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.status.pending,
.pending {
    background: var(--warn-bg);
    color: var(--warn-text);
}

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

.empty {
    text-align: center;
    padding: 24px;
}

.mini-list {
    display: grid;
    gap: 8px;
}

.mini-item {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfd;
    font-size: 13px;
}

.mini-item strong,
.mini-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-item em {
    border-radius: 999px;
    padding: 3px 8px;
    font-style: normal;
    font-weight: 900;
    font-size: 11px;
}

@media (max-width: 900px) {
    .page.two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .page {
        width: min(100% - 20px, 1180px);
        margin-top: 14px;
    }

    .panel,
    .auth-panel {
        padding: 18px;
    }

    .panel-title {
        display: block;
    }

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

    .upload-form .primary-button {
        min-height: 44px;
    }

    .reset-form {
        flex-direction: column;
        align-items: stretch;
    }

    .reset-form input {
        max-width: none;
    }
}
