/* 主题变量：统一管理颜色和阴影，便于后续快速调整视觉风格。 */
:root {
    --bg: #f3efe7;
    --panel: rgba(255, 251, 245, 0.86);
    --panel-border: rgba(53, 41, 28, 0.14);
    --text: #201810;
    --muted: #6b6258;
    --accent: #006a63;
    --accent-strong: #00463f;
    --success: #1e7a38;
    --danger: #a12d2d;
    --shadow: 0 18px 50px rgba(49, 36, 22, 0.1);
}

* {
    box-sizing: border-box;
}

/* 页面全局背景与基础字体设置。 */
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(0, 106, 99, 0.18), transparent 26%),
        radial-gradient(circle at left center, rgba(216, 145, 46, 0.16), transparent 28%),
        linear-gradient(180deg, #fffaf2 0%, var(--bg) 100%);
}

/* 页面主容器宽度与边距。 */
.page-shell {
    width: min(1360px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

/* 顶部 Hero 区域（标题、导航、模式说明）。 */
.hero {
    padding: 12px 4px 24px;
}

/* 顶部标题与模式导航横向布局。 */
.hero-topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: start;
}

/* 模式导航容器。 */
.mode-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: end;
}

/* 模式切换按钮通用样式。 */
.mode-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(32, 24, 16, 0.12);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: transform 140ms ease, background 140ms ease, color 140ms ease;
}

.mode-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.88);
}

/* 当前模式高亮。 */
.mode-link.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.hero-copy {
    margin-top: 16px;
}

/* 品牌副标题（小标签）。 */
.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1;
}

/* 当前模式徽标。 */
.mode-badge {
    display: inline-flex;
    margin: 0 0 10px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(0, 106, 99, 0.12);
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
}

/* 主副文案。 */
.lead {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.sublead {
    max-width: 720px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 15px;
}

/* 工作区网格：用于承载列表与详情组件。 */
.workspace {
    display: grid;
    gap: 18px;
    align-items: start;
}

/* 专业模式双栏布局。 */
.workspace-pro {
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
}

/* 普通模式单栏布局。 */
.workspace-normal {
    grid-template-columns: minmax(0, 1fr);
}

/* 面板通用外观。 */
.panel {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    background: var(--panel);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

/* 提交模式表单面板布局。 */
.form-panel {
    display: grid;
    gap: 18px;
    align-items: end;
    max-width: 760px;
}

/* 专业模式详情面板占满可用高度。 */
.detail-panel {
    min-height: 100%;
}

/* 工作区中的 panel 取消默认顶部 margin，避免双重间距。 */
.workspace .panel,
.workspace + .panel {
    margin-top: 0;
}

/* 面板头部（标题 + 操作按钮）。 */
.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

h2 {
    margin: 0 0 8px;
    font-size: 22px;
}

p {
    margin: 0;
    color: var(--muted);
}

/* 提交表单布局。 */
.task-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

label {
    font-size: 14px;
    font-weight: 700;
}

input {
    min-width: 240px;
    flex: 1;
    padding: 12px 14px;
    border: 1px solid rgba(32, 24, 16, 0.16);
    border-radius: 14px;
    background: #fff;
    font-size: 15px;
}

/* 按钮通用样式（主按钮）。 */
button {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

/* 次级按钮（如立即刷新）。 */
button.secondary {
    background: #e4dbcf;
    color: var(--text);
}

.form-message {
    min-height: 20px;
    font-size: 14px;
}

/* 提交结果区域。 */
.submit-result {
    text-align: left;
}

.submit-result-content strong {
    display: inline-block;
    margin-bottom: 8px;
}

.submit-result-content p + p {
    margin-top: 8px;
}

/* 任务表格容器。 */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

/* 表头与表格单元。 */
th,
td {
    padding: 14px 10px;
    border-bottom: 1px solid rgba(32, 24, 16, 0.08);
    text-align: left;
    vertical-align: top;
}

/* 列表行 hover 效果。 */
tbody tr {
    cursor: pointer;
    transition: background 140ms ease;
}

tbody tr:hover {
    background: rgba(0, 106, 99, 0.06);
}

/* 列宽由语义化 class 控制，避免列变更后 nth-child 失效。 */
.col-id {
    width: 56px;
}

.col-type {
    width: 86px;
    white-space: nowrap;
    text-align: center;
}

.col-task-name {
    width: 22%;
}

.col-title {
    width: 20ch;
}

.col-branch {
    width: 16%;
}

.col-status {
    width: 88px;
    white-space: nowrap;
}

.col-frontend-url {
    width: 24%;
}

.col-updated {
    width: 138px;
    white-space: nowrap;
}

/* 单元格文本统一省略策略。 */
.cell-ellipsis {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

/* 类型标签：表示任务归属（前端/后端），与状态标签分离语义。 */
.type-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.type-chip::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
}

/* 后端：边框型标签 + 方形标记。 */
.type-chip.backend {
    background: rgba(60, 88, 140, 0.08);
    color: #36507f;
    border: 1px solid rgba(60, 88, 140, 0.35);
}

.type-chip.backend::before {
    border-radius: 2px;
    background: #4d6796;
}

/* 前端：实底高亮 + 圆点标记。 */
.type-chip.frontend {
    background: rgba(0, 106, 99, 0.18);
    color: #0e6058;
    border: 1px solid transparent;
}

.type-chip.frontend::before {
    border-radius: 50%;
    background: #0e6058;
}

/* 兜底样式：未知类型时保持可识别。 */
.type-chip.unknown {
    background: rgba(107, 98, 88, 0.12);
    color: #6b6258;
    border: 1px dashed rgba(107, 98, 88, 0.45);
}

.type-chip.unknown::before {
    border-radius: 50%;
    background: #6b6258;
}

/* 状态徽标通用样式。 */
.status-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

/* 运行中相关状态统一暖色。 */
.status-chip.pending,
.status-chip.running,
.status-chip.building,
.status-chip.queued,
.status-chip.triggering,
.status-chip.updating_code,
.status-chip.cloning,
.status-chip.installing,
.status-chip.deploying {
    background: rgba(216, 145, 46, 0.16);
    color: #8c5d14;
}

/* 成功状态绿色。 */
.status-chip.success {
    background: rgba(30, 122, 56, 0.14);
    color: var(--success);
}

/* 失败状态红色。 */
.status-chip.failed {
    background: rgba(161, 45, 45, 0.14);
    color: var(--danger);
}

.detail-title {
    color: var(--accent-strong);
    font-weight: 700;
}

/* 专业模式详情区块网格。 */
.detail-grid {
    display: grid;
    gap: 16px;
}

.detail-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(32, 24, 16, 0.08);
}

.detail-card h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.detail-card dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
    margin: 0;
}

.detail-card dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-card dd {
    margin: 0;
    word-break: break-word;
}

/* 人工验证卡片操作区。 */
.review-card .review-hint {
    margin-top: 12px;
    font-size: 13px;
}

.review-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.review-actions button[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* 日志列表区域。 */
.log-list {
    display: grid;
    gap: 10px;
}

.log-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(32, 24, 16, 0.08);
}

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

/* 命令行输出区域：黑底白字，按纯文本流持续追加。 */
.cmd-console-wrap {
    background: #0d0d0d;
    border: 1px solid #242424;
    border-radius: 14px;
    padding: 12px;
    max-height: 360px;
    overflow: auto;
}

.cmd-console {
    margin: 0;
    color: #f5f5f5;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    min-height: 120px;
}

/* 通用空态容器（无数据、加载失败等）。 */
.empty-state {
    padding: 18px;
    border-radius: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.55);
    text-align: center;
}

a {
    color: var(--accent-strong);
}

/* 平板宽度下，专业模式退化为单栏。 */
@media (max-width: 980px) {
    .workspace-pro {
        grid-template-columns: 1fr;
    }
}

/* 手机宽度下的响应式优化。 */
@media (max-width: 860px) {
    .page-shell {
        width: min(100vw - 20px, 1360px);
        padding-top: 20px;
    }

    .hero-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-nav {
        justify-content: start;
    }

    .panel {
        padding: 16px;
        border-radius: 18px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }

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

    input {
        min-width: 0;
    }

    .detail-card dl {
        grid-template-columns: 1fr;
    }
}

/* 任务描述内容样式 */
.description-content {
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(32, 24, 16, 0.08);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}
