:root {
    /* --- Surfaces --- */
    --bg-1: #f6efe4;
    --bg-2: #efe6d7;
    --panel: rgba(255, 253, 249, 0.94);
    --panel-strong: #fffdf9;
    --panel-inset: #faf5ec;

    /* --- Ink --- */
    --text: #221a11;
    --text-soft: #4a3d2e;
    --muted: #8a7962;
    --faint: #a99a86;

    /* --- Lines --- */
    --line: rgba(88, 63, 33, 0.13);
    --line-strong: rgba(88, 63, 33, 0.2);
    --line-faint: rgba(88, 63, 33, 0.08);

    /* --- Brand --- */
    --accent: #b45309;
    --accent-strong: #9a3412;
    --accent-soft: rgba(180, 83, 9, 0.1);
    --accent-line: rgba(180, 83, 9, 0.24);
    --danger: #b42318;
    --danger-soft: rgba(180, 35, 24, 0.1);

    /* --- Depth --- */
    --shadow-sm: 0 1px 2px rgba(74, 46, 18, 0.06), 0 1px 1px rgba(74, 46, 18, 0.04);
    --shadow-md: 0 8px 24px rgba(82, 49, 21, 0.08), 0 2px 6px rgba(82, 49, 21, 0.05);
    --shadow-lg: 0 20px 48px rgba(82, 49, 21, 0.12), 0 4px 12px rgba(82, 49, 21, 0.06);
    --shadow-focus: 0 0 0 3px rgba(180, 83, 9, 0.16);
    --shadow-inset: inset 0 1px 2px rgba(74, 46, 18, 0.05);

    /* --- Radii --- */
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 9px;

    /* --- Rhythm --- */
    --gap: 16px;
    --gap-lg: 20px;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
    --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas,
        "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    line-height: 1.5;
    letter-spacing: 0.002em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(1100px 620px at -8% -12%, rgba(253, 213, 162, 0.45), transparent 60%),
        radial-gradient(960px 560px at 108% 112%, rgba(186, 220, 253, 0.4), transparent 58%),
        linear-gradient(158deg, var(--bg-1) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(180, 83, 9, 0.18); }

/* --- Scrollbars --- */
* { scrollbar-width: thin; scrollbar-color: rgba(140, 110, 70, 0.4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    background: rgba(140, 110, 70, 0.34);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(140, 110, 70, 0.55); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Shell & layout ---------- */
.shell {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: 100vh;
}
.app-shell {
    min-height: 100vh;
    max-width: 1560px;
    margin: 0 auto;
    padding: 22px 24px 40px;
}

/* ---------- Topbar ---------- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-faint);
    flex-wrap: wrap;
}
.topbar-title h1 {
    margin: 0;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 750;
    letter-spacing: -0.01em;
    color: var(--text);
}
.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.topbar-meta {
    min-width: 172px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, 0.8);
    box-shadow: var(--shadow-sm);
    line-height: 1.35;
}
.topbar-meta strong {
    display: block;
    font-weight: 650;
    font-size: 13.5px;
}
.topbar-meta span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.dashboard { display: grid; gap: var(--gap); }

/* ---------- Sidebar (login/detail contexts) ---------- */
.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    padding: 24px 20px;
    background: linear-gradient(180deg, #2a1f15 0%, #211910 100%);
    color: #fdf6ea;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand h1, .panel-header h3, .hero h2, .editor-header h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.006em;
}

/* ---------- Eyebrow / muted ---------- */
.eyebrow {
    margin: 0 0 7px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 10.5px;
    font-weight: 650;
    color: var(--accent);
    opacity: 0.82;
}
.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; }

.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
}
/* Anchors that act as buttons should carry real button chrome */
a.ghost, a.primary, a.secondary, a.danger, a.expand-toggle {
    padding: 8px 15px;
    min-height: 38px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
a.ghost:hover, a.primary:hover, a.secondary:hover, a.danger:hover, a.expand-toggle:hover {
    transform: translateY(-1px);
}

.jump-links { display: grid; gap: 10px; }
.jump-links a {
    color: inherit;
    text-decoration: none;
    padding: 10px 12px;
    border: 1px solid rgba(255, 247, 235, 0.14);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    font-size: 13px;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.jump-links a:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 247, 235, 0.28); }

.config-card {
    padding: 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 247, 235, 0.14);
}
.config-card h2 { margin: 0 0 12px; font-size: 16px; }
.user-card {
    padding: 13px 15px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 247, 235, 0.14);
}
.user-card strong, .user-card span { display: block; }

.main { padding: 18px; display: grid; gap: var(--gap); }

/* ---------- Panels & hero ---------- */
.hero, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 22px 24px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}
.tone-create, .tone-query, .tone-console, .tone-local, .tone-preview {
    position: relative;
    overflow: hidden;
}
.tone-create { background: linear-gradient(180deg, rgba(255, 245, 233, 0.96), rgba(255, 253, 249, 0.94)); }
.tone-query { background: linear-gradient(180deg, rgba(248, 247, 236, 0.96), rgba(255, 253, 249, 0.94)); }
.tone-console { background: linear-gradient(180deg, rgba(246, 242, 235, 0.97), rgba(255, 253, 249, 0.94)); }
.tone-local { background: linear-gradient(180deg, rgba(251, 246, 238, 0.96), rgba(255, 253, 249, 0.94)); }
.tone-preview { background: linear-gradient(180deg, rgba(240, 247, 245, 0.96), rgba(255, 253, 249, 0.94)); }

.tone-create::before, .tone-query::before, .tone-console::before,
.tone-local::before, .tone-preview::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0;
}
.tone-create::before { background: linear-gradient(90deg, #ea580c, #f59e0b); }
.tone-query::before { background: linear-gradient(90deg, #a3a03a, #cdbb52); }
.tone-console::before { background: linear-gradient(90deg, #8a7c66, #b3a48a); }
.tone-local::before { background: linear-gradient(90deg, #b4652c, #e0995a); }
.tone-preview::before { background: linear-gradient(90deg, #0d9488, #4bb8ac); }

.panel-dense { padding: 20px; }
.hero {
    display: grid;
    grid-template-columns: 1.5fr 0.9fr;
    gap: var(--gap);
}
.hero-compact { padding: 18px 20px; }
.hero p, .panel p { line-height: 1.55; }
.hero-meta { display: grid; gap: 12px; }
.hero-meta div {
    padding: 13px 15px;
    border-radius: var(--radius-lg);
    background: var(--panel-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.hero-meta strong, label span { display: block; margin-bottom: 6px; }

.panel-header, .editor-header, .button-row, .toggles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.panel-header h3 { font-size: 18px; }
.inline-header { margin-bottom: 12px; }

/* ---------- Tabs ---------- */
.tab-bar {
    display: inline-flex;
    gap: 4px;
    padding: 5px;
    margin: 14px 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-inset);
}
.tab-button {
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    min-height: 34px;
    padding: 7px 16px;
    font-size: 13.5px;
    font-weight: 550;
    box-shadow: none;
}
.tab-button:hover { color: var(--text-soft); transform: none; }
.tab-button.active {
    background: var(--panel-strong);
    color: var(--accent-strong);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
    font-weight: 650;
}
.tab-pane { display: none; }
.tab-pane.is-active { display: block; animation: fade-in 0.24s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Workspace grids ---------- */
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.85fr);
    gap: var(--gap);
    align-items: start;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
    gap: var(--gap);
    align-items: start;
}
.left-column, .right-column {
    display: grid;
    gap: var(--gap);
    align-content: start;
}
.panel-create { grid-row: auto; }

/* ---------- Forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.form-grid.compact { grid-template-columns: 1fr; }
label { display: block; }
label span { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }

input, select, textarea {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    padding: 10px 12px;
    color: var(--text);
    min-height: 42px;
    font-size: 14px;
    box-shadow: var(--shadow-inset);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
    background: #fff;
}
textarea { resize: vertical; line-height: 1.55; }

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a7962' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    padding-right: 34px;
    cursor: pointer;
}

.is-hidden { display: none !important; }

.upload-box {
    margin-top: 8px;
    padding: 12px;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.55);
    transition: border-color 0.16s ease, background 0.16s ease;
}
.upload-box:hover { border-color: var(--accent-line); background: rgba(255, 250, 243, 0.7); }
.content-file { display: none; }
.upload-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.upload-status { font-size: 12px; color: var(--muted); word-break: break-all; }

.check-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.72);
}
.check-group.stacked { display: grid; gap: 10px; }
.check-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 13.5px;
}
.check-item input { width: auto; }
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13.5px;
    transition: border-color 0.16s ease, background 0.16s ease;
}
.checkbox:hover { border-color: var(--accent-line); }
.checkbox input { width: auto; }

input[type="checkbox"], input[type="radio"] {
    accent-color: var(--accent);
    min-height: 0;
    box-shadow: none;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ---------- Buttons ---------- */
button {
    border: 0;
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease, filter 0.16s ease;
    min-height: 40px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(0.2); }

.primary {
    background: linear-gradient(135deg, #c2410c 0%, #e2600f 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(194, 65, 12, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.primary:hover { box-shadow: 0 10px 22px rgba(194, 65, 12, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2); filter: brightness(1.03); }
.secondary {
    background: #f6e2d0;
    color: #7c3a12;
    box-shadow: var(--shadow-sm);
}
.secondary:hover { background: #f2d8c1; }
.expand-toggle {
    background: linear-gradient(135deg, #fde8c4, #f7ce8a);
    color: #7c2d12;
    border: 1px solid var(--accent-line);
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(180, 83, 9, 0.16);
}
.expand-toggle:hover { box-shadow: 0 10px 22px rgba(180, 83, 9, 0.2); }
.ghost {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-soft);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.ghost:hover { background: #fff; border-color: var(--line-strong); color: var(--text); }
.danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(180, 35, 24, 0.2);
}
.danger:hover { background: rgba(180, 35, 24, 0.14); }

.content-editor, .advanced { margin-top: 20px; }
.script-helper { display: grid; gap: 16px; }
.script-helper textarea { min-height: 140px; }
#scriptOutput { min-height: 280px; }
#framePromptOutput { min-height: 180px; }

.content-rows, .task-list { display: grid; gap: 12px; margin-top: 14px; }
.content-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.content-action { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.content-mode-hint { margin: 10px 0 0; font-size: 13px; }

.content-row, .task-card, .result-card, .preview-shell, .console, .json-card {
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.content-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 15px;
    align-items: start;
    box-shadow: var(--shadow-sm);
}
.content-row.has-role { grid-template-columns: 130px 150px minmax(0, 1fr) auto; }
.content-main { min-width: 0; }
.content-value { min-height: 150px; line-height: 1.6; }
.content-row:not(.has-role) .remove-row { align-self: center; }
.remove-row { min-height: 32px; padding: 6px 12px; font-size: 12px; }
.content-role-wrap { display: block; }

.task-card {
    padding: 14px 16px;
    display: grid;
    gap: 9px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.task-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.assistant-card { background: linear-gradient(180deg, rgba(251, 249, 243, 0.98), rgba(255, 253, 249, 0.96)); }
.assistant-actions { justify-content: flex-end; gap: 8px; }
.task-main h4, .preview-meta p { margin: 0; }
.task-main h4 { font-size: 15px; font-weight: 700; }
.task-preview-link {
    padding: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
}
.task-preview-link:hover { transform: none; color: var(--accent); box-shadow: none; }
.task-main p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.task-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-tags span {
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(154, 52, 18, 0.08);
    border: 1px solid rgba(154, 52, 18, 0.12);
    font-size: 11.5px;
    font-weight: 550;
    color: var(--text-soft);
}

.badge {
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.01em;
}
.badge.success { background: rgba(22, 101, 52, 0.12); color: #15803d; border-color: rgba(22, 101, 52, 0.2); }
.badge.danger { background: rgba(180, 35, 24, 0.12); color: #b42318; border-color: rgba(180, 35, 24, 0.2); }
.badge.running { background: rgba(14, 116, 144, 0.12); color: #0e7490; border-color: rgba(14, 116, 144, 0.2); }
.badge.pending { background: rgba(180, 120, 4, 0.14); color: #a16207; border-color: rgba(180, 120, 4, 0.22); }
.badge.muted { background: rgba(107, 92, 74, 0.12); color: #6b5c4a; border-color: rgba(107, 92, 74, 0.2); }

.result-card, .empty { padding: 15px; color: var(--muted); }
.empty {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.4);
    text-align: center;
    font-size: 13.5px;
}

.preview-shell { overflow: hidden; display: grid; justify-items: center; box-shadow: var(--shadow-sm); }
#previewVideo, .preview-shell video {
    width: 100%;
    max-height: 420px;
    min-height: 240px;
    background: #17120d;
    object-fit: contain;
}
.preview-shell-compact #previewVideo { max-height: 420px; min-height: 220px; }
.preview-feature { display: grid; gap: 10px; }
.panel-sticky { position: sticky; top: 16px; }
.preview-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 15px;
    font-size: 13px;
    color: var(--text-soft);
}

.frame-card {
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.frame-image { width: 100%; display: block; background: #f4efe8; }
.compact-frame { max-width: 320px; }

.console, .json-card {
    margin: 0;
    padding: 13px 15px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    background: var(--panel-inset);
    color: var(--text-soft);
}
.console-compact { min-height: 240px; max-height: 360px; }

/* ---------- Login & detail ---------- */
.login-body, .detail-body { min-height: 100vh; padding: 40px 32px; }
.login-shell {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-stack {
    display: grid;
    gap: 18px;
    justify-items: center;
    width: min(420px, 100%);
}
.login-card, .detail-shell { width: min(1100px, 100%); }
.login-header { text-align: center; margin: 0; }
.login-header h1 {
    margin: 0;
    font-family: var(--font-sans);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 780;
    letter-spacing: -0.015em;
    color: #4a2a15;
}
.login-card {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 26px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
}
.login-card-title {
    margin: 0;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.008em;
}
.login-form { display: grid; gap: 14px; margin-top: 10px; }
.login-form label span { margin-bottom: 7px; }
.wide { width: 100%; }

.hint-block, .meta-card, .timeline-item, .simple-table, .alert {
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.hint-block, .alert { margin-top: 14px; padding: 13px 15px; box-shadow: var(--shadow-sm); }
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 550;
}
.alert.info { color: #0f766e; border-color: rgba(15, 118, 110, 0.24); background: rgba(15, 118, 110, 0.06); }
.alert.danger { color: #b42318; border-color: rgba(180, 35, 24, 0.24); background: rgba(180, 35, 24, 0.06); }

.detail-shell { margin: 0 auto; display: grid; gap: 20px; }
.narrow-shell { width: min(560px, 100%); }
.detail-grid, .stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.meta-card {
    padding: 16px;
    display: grid;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.meta-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-grid .meta-card { gap: 4px; }
.stat-grid .meta-card strong { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.stat-grid .meta-card span {
    font-size: 27px;
    font-weight: 750;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    align-items: end;
}
.inline-form > input,
.inline-form > select { flex: 1 1 160px; min-width: 140px; }
.inline-form > .check-group { flex: 1 1 240px; }
.inline-form > .hint { flex: 1 1 100%; margin: 2px 0 0; }
.inline-form > button { flex: 0 0 auto; }
.mini-form { display: inline-flex; align-items: center; gap: 8px; }
.mini-form input[type="number"] { width: 82px; min-height: 36px; }

.simple-table { overflow: hidden; box-shadow: var(--shadow-sm); }
.table-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-faint);
    transition: background 0.14s ease;
}
.table-row:hover { background: rgba(180, 83, 9, 0.03); }
.table-row:last-child { border-bottom: 0; }

.timeline { display: grid; gap: 12px; }
.audit-block { display: grid; gap: 6px; }
.assistant-details { display: grid; gap: 10px; }
.assistant-details.is-collapsed .json-card { max-height: 110px; overflow: hidden; position: relative; }
.assistant-details.is-collapsed .json-card::after {
    content: "";
    position: sticky;
    display: block;
    bottom: 0;
    height: 40px;
    margin-top: -40px;
    background: linear-gradient(180deg, rgba(250, 245, 236, 0), rgba(250, 245, 236, 0.98));
    pointer-events: none;
}
.timeline-item { padding: 16px; box-shadow: var(--shadow-sm); }
.timeline-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.video-gallery {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}
.video-item {
    width: 100%;
    text-align: left;
    display: grid;
    gap: 4px;
    padding: 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    box-shadow: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.video-item:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.video-item-title { font-weight: 650; font-size: 13.5px; }
.video-item-meta { font-size: 12px; color: var(--muted); }

/* ---------- 图片生成 ---------- */
.image-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.image-result-item { display: grid; gap: 6px; align-content: start; }
.image-thumb-button {
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--panel-strong);
    cursor: pointer;
    line-height: 0;
    box-shadow: var(--shadow-sm);
    min-height: 0;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.image-thumb-button:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.image-thumb-button img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.image-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}
.image-result-error {
    padding: 12px;
    border: 1px dashed var(--danger);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: var(--danger);
    background: rgba(255, 255, 255, 0.6);
}
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 14px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}
.image-gallery-item {
    display: grid;
    gap: 5px;
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.image-gallery-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.image-gallery-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.image-gallery-meta {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.preview-image {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    background: rgba(0, 0, 0, 0.05);
    display: block;
}
.image-reference-row { grid-template-columns: minmax(0, 1fr) 96px auto; align-items: start; }
.image-reference-row .image-reference-value { min-height: 78px; line-height: 1.6; }
.image-reference-preview { width: 96px; }
.image-reference-preview img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--panel-strong);
    display: block;
}
.image-reference-preview.is-hidden { display: none; }
.image-reference-status { font-size: 12px; color: var(--muted); }

.checkbox.is-disabled { opacity: 0.55; cursor: not-allowed; }
.check-item.is-disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .app-shell { padding: 14px 14px 28px; }
    .topbar, .topbar-actions { align-items: stretch; flex-direction: column; }
    .topbar-meta { min-width: 0; width: 100%; }
    .topbar-meta span { max-width: none; }
    .dashboard-grid, .shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .hero, .workspace-grid, .form-grid, .form-grid.compact, .content-row { grid-template-columns: 1fr; }
    .detail-grid, .stat-grid, .two-col, .inline-form { grid-template-columns: 1fr; }
    .login-body, .detail-body { padding: 18px; }
    .panel-sticky { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
