:root {
    --ink: #18201d;
    --muted: #6b746f;
    --line: #dfe5e1;
    --paper: #f4f6f2;
    --panel: #ffffff;
    --accent: #166b4f;
    --accent-dark: #0d513b;
    --accent-soft: #e5f3ed;
    --warning: #9b6314;
    --danger: #b33b3b;
    --danger-soft: #fbeaea;
    --shadow: 0 18px 50px rgba(22, 41, 33, .08);
    --radius: 20px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 90% 0%, rgba(112, 177, 150, .16), transparent 30rem),
        linear-gradient(180deg, #f7f9f6 0, var(--paper) 38rem);
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(223, 229, 225, .8);
    background: rgba(248, 250, 247, .88);
    backdrop-filter: blur(18px);
}

.header-inner {
    width: min(1180px, calc(100% - 40px));
    min-height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 32px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: var(--accent);
    font-size: 13px;
    letter-spacing: .04em;
    box-shadow: 0 8px 18px rgba(22, 107, 79, .22);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.main-nav a {
    padding: 8px 13px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 14px;
    transition: .18s ease;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--ink);
    background: #e9eeea;
}

.logout-form {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.logout-form button {
    border: 0;
    background: transparent;
    color: var(--accent);
}

.site-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 56px 0 80px;
}

.site-footer {
    padding: 28px 20px 40px;
    text-align: center;
    color: #8a948e;
    font-size: 12px;
}

.eyebrow, .section-kicker {
    display: block;
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 40px;
}

.hero h1, .page-heading h1, .job-header h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.08;
    letter-spacing: -.045em;
}

.hero p, .page-heading p {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 17px;
}

.hero-badge {
    min-width: 145px;
    padding: 20px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .72);
}

.hero-badge strong {
    display: block;
    color: var(--accent);
    font-size: 40px;
    line-height: 1;
}

.hero-badge span { color: var(--muted); font-size: 13px; }

.panel {
    border: 1px solid rgba(217, 225, 220, .9);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .93);
    box-shadow: var(--shadow);
}

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

.create-panel { padding: 32px; }
.panel-heading, .progress-copy {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.panel-heading h2, .progress-copy h2, .result-panel h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -.02em;
}

.quiet-note { color: var(--muted); font-size: 13px; }

.drop-zone {
    min-height: 205px;
    margin: 28px 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px dashed #b8c6bd;
    border-radius: 16px;
    background: #fafcf9;
    text-align: center;
    transition: .2s ease;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragging {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.drop-zone input { position: absolute; opacity: 0; pointer-events: none; }
.drop-zone strong { margin-top: 12px; font-size: 17px; }
.drop-zone span:last-child { margin-top: 5px; color: var(--muted); font-size: 13px; }
.drop-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    border: 0;
    padding: 0;
}

.field > span, .field legend {
    color: #39423d;
    font-size: 13px;
    font-weight: 700;
}

.field input, .field select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: .18s ease;
}

.field input:focus, .field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(22, 107, 79, .09);
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
    min-height: 90px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
    transition: .18s ease;
}

.segmented input:checked + span {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.segmented strong { font-size: 14px; }
.segmented small { margin-top: 4px; color: var(--muted); line-height: 1.45; }

.button {
    min-height: 44px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 750;
    transition: .18s ease;
}

.button.primary {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 10px 22px rgba(22, 107, 79, .18);
}

.button.primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.button.secondary { background: #fff; border-color: var(--line); }
.button.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button.large { width: 100%; min-height: 54px; font-size: 15px; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-arrow { margin-left: auto; font-size: 20px; }
.form-footnote { margin: 12px 0 0; color: var(--muted); text-align: center; font-size: 12px; }

.process-card {
    padding: 28px;
    border: 1px solid rgba(207, 219, 211, .8);
    border-radius: var(--radius);
    background: #eef3ee;
}

.mini-process { margin: 22px 0 0; padding: 0; list-style: none; }
.mini-process li {
    position: relative;
    padding: 0 0 26px 48px;
    display: flex;
    gap: 14px;
}
.mini-process li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 15px;
    top: 34px;
    bottom: 6px;
    width: 1px;
    background: #c7d4cc;
}
.mini-process > li > span {
    position: absolute;
    left: 0;
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border: 1px solid #b9c9bf;
    border-radius: 50%;
    background: #f9fbf8;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
}
.mini-process strong { display: block; font-size: 14px; }
.mini-process small { color: var(--muted); font-size: 12px; }

.alert {
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 12px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 14px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 32px;
}
.page-heading h1, .job-header h1 { font-size: clamp(34px, 5vw, 50px); }

.job-list { display: grid; gap: 12px; }
.job-row {
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: 0 7px 26px rgba(22, 41, 33, .05);
    transition: .18s ease;
}
.job-row:hover { transform: translateY(-2px); border-color: #b9c9bf; }
.job-row-main, .job-row-meta { display: flex; align-items: center; gap: 14px; }
.job-row h3 { margin: 0; font-size: 17px; }
.job-row p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.row-arrow { color: #95a099; font-size: 20px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #9da6a0; }
.status-dot.success { background: #1e9068; }
.status-dot.danger { background: var(--danger); }
.status-dot.running { background: #e09a2d; box-shadow: 0 0 0 5px rgba(224, 154, 45, .12); }
.status-pill {
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: #eef1ee;
    font-size: 11px;
    font-weight: 700;
}
.status-pill.success { color: var(--accent); background: var(--accent-soft); }
.status-pill.danger { color: var(--danger); background: var(--danger-soft); }
.status-pill.running, .status-pill.queued { color: var(--warning); background: #fff3df; }

.empty-state { padding: 70px 30px; text-align: center; }
.empty-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 25px;
}
.empty-state h2 { margin: 0; }
.empty-state p { color: var(--muted); }

.job-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}
.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.job-header p { margin: 8px 0 0; color: var(--muted); }
.job-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.progress-panel { padding: 28px; }
.progress-copy > strong { color: var(--accent); font-size: 34px; letter-spacing: -.04em; }
.progress-copy p { margin: 5px 0 0; color: var(--muted); }
.progress-track {
    height: 8px;
    margin: 24px 0;
    overflow: hidden;
    border-radius: 99px;
    background: #e6ebe7;
}
.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .5s ease;
}
.phase-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.phase {
    position: relative;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #8b948f;
    background: #fbfcfa;
}
.phase span { display: block; font-size: 10px; font-weight: 800; }
.phase strong { font-size: 13px; }
.phase.active { color: var(--accent); border-color: #a9c7b8; background: var(--accent-soft); }
.phase.done { color: #3d5e50; border-color: #d7e5dd; background: #f4faf7; }

.result-panel { margin-top: 20px; padding: 28px; }
.page-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.page-grid a {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f2f4f2;
    transition: .18s ease;
}
.page-grid a:hover { transform: translateY(-2px); border-color: #abc4b7; }
.page-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.page-grid span { display: block; padding: 8px 10px; color: var(--muted); font-size: 11px; }

.waiting-panel {
    margin-top: 20px;
    padding: 22px 26px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: none;
}
.waiting-panel h3 { margin: 0; font-size: 15px; }
.waiting-panel p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.pulse {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #e09a2d;
    box-shadow: 0 0 0 0 rgba(224, 154, 45, .3);
    animation: pulse 1.8s infinite;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 12px rgba(224, 154, 45, 0); }
    100% { box-shadow: 0 0 0 0 rgba(224, 154, 45, 0); }
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.settings-card { padding: 26px; }
.settings-card dl { margin: 16px 0 0; }
.settings-card dt { color: var(--muted); font-size: 12px; }
.settings-card dd { margin: 0 0 14px; font-weight: 700; overflow-wrap: anywhere; }
.settings-card code {
    display: block;
    margin: 8px 0;
    padding: 9px 11px;
    border-radius: 8px;
    background: #eff3f0;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: min(420px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow);
}
.login-card .brand-mark { margin-bottom: 22px; }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: -.035em; }
.login-card > p { margin: 8px 0 24px; color: var(--muted); }

.alert.success {
    color: var(--accent-dark);
    background: var(--accent-soft);
}

.settings-heading { align-items: flex-end; }
.settings-layout {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.settings-tabs {
    position: sticky;
    top: 92px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .82);
}

.settings-tab {
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
}

.settings-tab:hover { background: #eef2ee; }
.settings-tab.active { color: var(--accent); background: var(--accent-soft); }

.settings-content { min-width: 0; }
.settings-section { display: none; padding: 30px; }
.settings-section.active { display: block; }
.settings-section hr {
    height: 1px;
    margin: 30px 0;
    border: 0;
    background: var(--line);
}

.settings-section h3 {
    margin: 0 0 14px;
    font-size: 16px;
}

.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 14px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font: inherit;
    line-height: 1.6;
}
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(22, 107, 79, .09);
}
.field input[type="number"] { font-variant-numeric: tabular-nums; }

.help-text {
    margin: 8px 0 20px;
    color: var(--muted);
    font-size: 12px;
}
.secret-state {
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--muted);
    background: #eff2ef;
    font-size: 11px;
}
.check-field {
    margin: -6px 0 18px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
}
.check-field input { accent-color: var(--accent); }

.setting-block {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcfa;
}
.setting-block .field:last-child { margin-bottom: 0; }

.style-editor { margin-top: 22px; display: grid; gap: 14px; }
.style-row {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcfa;
}
.style-row .field:last-of-type { margin-bottom: 4px; }
.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}
.danger-text { color: var(--danger); }
.validation-summary:empty { display: none; }

.settings-savebar {
    grid-column: 1 / -1;
    position: sticky;
    bottom: 16px;
    z-index: 10;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid #cbd8d0;
    border-radius: 16px;
    background: rgba(250, 252, 249, .94);
    box-shadow: 0 14px 35px rgba(22, 41, 33, .14);
    backdrop-filter: blur(16px);
}
.settings-savebar strong { display: block; font-size: 13px; }
.settings-savebar span { display: block; color: var(--muted); font-size: 11px; }

@media (max-width: 860px) {
    .site-main { width: min(100% - 28px, 760px); padding-top: 36px; }
    .header-inner { width: calc(100% - 28px); gap: 16px; }
    .brand > span:last-child { display: none; }
    .main-nav { flex: 1; justify-content: center; }
    .logout-form span { display: none; }
    .hero, .page-heading, .job-header { align-items: flex-start; flex-direction: column; }
    .hero-badge { min-width: 0; padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
    .hero-badge strong { font-size: 26px; }
    .workspace, .settings-grid { grid-template-columns: 1fr; }
    .process-card { order: 2; }
    .create-panel { padding: 22px; }
    .field-grid { grid-template-columns: 1fr; gap: 0; }
    .segmented { grid-template-columns: 1fr; }
    .segmented span { min-height: 0; }
    .phase-strip { grid-template-columns: repeat(2, 1fr); }
    .job-row { align-items: flex-start; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-tabs {
        position: static;
        flex-direction: row;
        overflow-x: auto;
    }
    .settings-tab { flex: 0 0 auto; }
    .field-grid.three { grid-template-columns: 1fr; }
    .settings-savebar { bottom: 8px; }
}

@media (max-width: 520px) {
    .hero h1 { font-size: 38px; }
    .main-nav a { padding: 8px 9px; font-size: 12px; }
    .drop-zone { min-height: 175px; padding: 22px; }
    .job-actions { width: 100%; }
    .job-actions .button { flex: 1; }
    .progress-copy > strong { font-size: 26px; }
    .settings-section { padding: 20px; }
    .settings-savebar span { display: none; }
}
