:root {
    --bg: #eef3f6;
    --panel: #ffffff;
    --panel-soft: #f7fafb;
    --line: #d9e3e8;
    --text: #16222a;
    --muted: #687783;
    --accent: #0d766d;
    --accent-dark: #07534d;
    --danger: #b64b43;
    --warn: #966515;
    --shadow: 0 18px 45px rgba(22, 34, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
textarea,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 32px;
}

.workspace {
    min-width: 0;
}

.topbar,
.download-panel,
.task-panel,
.file-panel,
.feedback-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    letter-spacing: 0;
}

h2 {
    font-size: 17px;
    letter-spacing: 0;
}

.topbar-actions,
.panel-actions,
.section-head,
.job-actions,
.file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button,
.text-button,
.icon-button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.button {
    min-height: 42px;
    padding: 0 16px;
    color: #fff;
    background: var(--accent);
    font-weight: 700;
}

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

.button.secondary {
    color: var(--accent);
    background: #e4f2f0;
}

.button.secondary:hover,
.button.ghost:hover,
.text-button:hover {
    background: #d9ebe8;
}

.button.ghost,
.text-button {
    color: var(--accent);
    background: transparent;
}

.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 10px;
    text-decoration: none;
    font-weight: 700;
}

.text-button.danger,
.icon-button:hover {
    color: var(--danger);
}

.icon-button {
    width: 32px;
    height: 32px;
    color: var(--muted);
    background: var(--panel-soft);
    font-size: 22px;
    line-height: 1;
}

.download-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    padding: 18px;
    margin-bottom: 14px;
}

.panel-main label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

textarea {
    width: 100%;
    min-height: 132px;
    max-height: 280px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--panel-soft);
    outline: none;
    resize: vertical;
}

textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 118, 109, 0.13);
}

.panel-actions {
    margin-top: 10px;
}

select {
    min-width: 220px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    outline: none;
}

.panel-side {
    display: grid;
    gap: 10px;
}

.stat {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.stat span,
.section-head span,
.status-line,
.file-meta span,
.job-item span,
.feedback-head p {
    color: var(--muted);
}

.stat strong {
    min-width: 0;
    overflow: hidden;
    font-size: 22px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-grid {
    display: grid;
    grid-template-columns: 0.92fr 1.08fr;
    gap: 14px;
}

.task-panel,
.file-panel {
    min-width: 0;
    padding: 16px;
}

.section-head {
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-head span {
    font-size: 13px;
}

.job-list,
.file-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.job-item,
.file-row,
.empty {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.job-item,
.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
}

.job-item strong,
.job-item span,
.file-meta strong,
.file-meta span {
    display: block;
}

.job-item span,
.file-meta span {
    margin-top: 4px;
    font-size: 13px;
}

.job-item em {
    color: var(--muted);
    font-style: normal;
    font-weight: 800;
}

.job-item.running em {
    color: var(--warn);
}

.job-item.done em {
    color: var(--accent);
}

.job-item.failed em,
.status-line.error {
    color: var(--danger);
}

.status-line {
    min-height: 22px;
    margin-top: 10px;
    font-size: 14px;
}

.status-line.ok {
    color: var(--accent);
}

.file-meta {
    min-width: 0;
}

.file-meta strong {
    overflow-wrap: anywhere;
}

.file-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.feedback-panel {
    position: sticky;
    top: 18px;
    align-self: start;
    padding: 16px;
}

.feedback-head {
    margin-bottom: 12px;
}

.feedback-head p {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.feedback-panel textarea {
    min-height: 220px;
}

.feedback-panel .button {
    width: 100%;
    margin-top: 10px;
}

.empty {
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

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

    .feedback-panel {
        position: static;
    }
}

@media (max-width: 680px) {
    .app-shell {
        width: min(100% - 20px, 1440px);
        padding-top: 10px;
    }

    .topbar,
    .panel-actions,
    .job-item,
    .file-row {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions,
    .file-actions,
    .button,
    select {
        width: 100%;
    }
}
