:root {
    color-scheme: light;
    --bg: #f6f7f5;
    --panel: #ffffff;
    --text: #202522;
    --muted: #68716b;
    --line: #dfe4df;
    --accent: #0f9f7a;
    --accent-dark: #087259;
    --warn: #c75f28;
    --danger: #b53737;
    --ink: #26312d;
    --soft: #edf5f1;
    --radius: 8px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

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

.auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 18px 60px rgba(32, 37, 34, .08);
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.app-shell {
    margin: 0 auto;
    padding: 28px 18px 42px;
}

.topbar,
.section-title,
.selected-head,
.card-head,
.platform-head,
.top-actions,
.card-actions,
.copy-actions {
    display: flex;
    align-items: center;
}

.topbar,
.section-title,
.card-head {
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    margin-bottom: 18px;
}

.top-actions,
.card-actions,
.copy-actions {
    gap: 10px;
    flex-wrap: wrap;
}

.eyebrow {
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    margin: 0 0 6px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    margin-bottom: 8px;
}

h2 {
    font-size: 20px;
    margin-bottom: 14px;
}

h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.muted,
.hint,
.card-head p,
.platform-message,
.selected-item span {
    color: var(--muted);
}

.hint,
.platform-message,
.selected-item span,
.card-head p {
    font-size: 13px;
}

.notice {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 16px 0;
    border: 1px solid var(--line);
    background: #fff;
}

.notice.success {
    border-color: #96d9bd;
    background: #f1fbf6;
}

.notice.error {
    border-color: #e6aaa2;
    background: #fff4f1;
}

.form-stack,
.settings-grid {
    display: grid;
    gap: 14px;
}

.form-stack {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

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

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: var(--radius);
    padding: 11px 12px;
    outline: none;
}

textarea {
    min-height: 86px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 159, 122, .14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
    border: 0;
    border-radius: var(--radius);
    min-height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
}

.primary-btn:hover {
    background: var(--accent-dark);
}

.secondary-btn {
    background: var(--ink);
    color: #fff;
}

.ghost-btn {
    background: var(--soft);
    color: var(--ink);
    border: 1px solid var(--line);
}

.danger-btn {
    background: #fff2ef;
    color: var(--danger);
    border: 1px solid #f1c6bf;
}

.icon-btn {
    width: 36px;
    padding: 0;
    background: #f3f4f1;
    color: var(--muted);
    border: 1px solid var(--line);
}

.small {
    min-height: 34px;
    padding-inline: 11px;
    font-size: 13px;
}

.wide {
    width: 100%;
    margin-top: 14px;
}

.settings-panel,
.settings-page-panel,
.upload-panel,
.uploads-panel,
.upload-card,
.platform-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.settings-panel {
    margin-bottom: 18px;
}

.settings-page-panel {
    padding: 18px;
}

summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    cursor: pointer;
    font-weight: 900;
}

summary::-webkit-details-marker {
    display: none;
}

summary small {
    color: var(--accent-dark);
}

.settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 18px 18px;
}

.settings-page-panel .settings-grid {
    padding: 0;
    margin-top: 16px;
}

.settings-save {
    align-self: end;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.upload-panel,
.uploads-panel {
    padding: 18px;
}

.dropzone {
    min-height: 148px;
    border: 2px dashed #aebcb3;
    border-radius: var(--radius);
    background: #fbfcfb;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 18px;
    cursor: pointer;
}

.dropzone input {
    display: none;
}

.dropzone strong {
    font-size: 18px;
}

.dropzone span {
    color: var(--muted);
    font-weight: 600;
}

.dropzone.dragging {
    border-color: var(--accent);
    background: #edf8f4;
}

.selected-head {
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.selected-head h3 {
    margin: 0;
}

.selected-list,
.uploads-list {
    display: grid;
    gap: 10px;
}

.empty-state {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--muted);
    background: #fbfcfb;
    text-align: center;
}

.selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
}

.file-main {
    min-width: 0;
    display: grid;
    gap: 5px;
    width: 100%;
}

.file-main strong,
.card-head h3 {
    overflow-wrap: anywhere;
}

.mini-progress,
.progress {
    height: 7px;
    background: #eef0ec;
    border-radius: 999px;
    overflow: hidden;
}

.mini-progress span,
.progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
}

.upload-card {
    padding: 14px;
}

.platform-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.platform-card {
    padding: 12px;
    display: grid;
    gap: 10px;
}

.platform-head {
    justify-content: space-between;
    gap: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 900;
    background: #edf0ec;
    color: var(--ink);
}

.badge.complete {
    background: #e7f7ef;
    color: #0d6d45;
}

.badge.failed,
.badge.missing_settings,
.badge.needs_retry {
    background: #fff0ed;
    color: var(--danger);
}

.badge.processing,
.badge.queued {
    background: #eef4ff;
    color: #315f98;
}

.copy-box {
    gap: 6px;
}

.copy-actions {
    align-items: stretch;
}

.copy-actions input {
    min-width: 180px;
    flex: 1 1 220px;
}

.error-text {
    color: var(--danger);
}

.debug-line {
    color: #59645f;
    background: #f4f6f3;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 7px 8px;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .workspace-grid,
    .auth-grid,
    .settings-grid,
    .platform-grid {
        grid-template-columns: 1fr;
    }

    .topbar,
    .section-title,
    .card-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions,
    .card-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .auth-shell {
        padding: 12px;
    }

    .auth-panel,
    .upload-panel,
    .uploads-panel {
        padding: 14px;
    }

    .app-shell {
        padding-inline: 12px;
    }

    h1 {
        font-size: 30px;
    }
}
