:root {
  --paper: #f5f0e8;
  --paper-deep: #eae2d6;
  --ink: #242722;
  --ink-soft: #6d7069;
  --line: rgba(46, 50, 43, .13);
  --sage: #657265;
  --sage-deep: #4f5c50;
  --sage-light: #dfe4dc;
  --terracotta: #a65f46;
  --rose: #c98774;
  --success: #5e7660;
  --danger: #a94e42;
  --warning: #a2763c;
  --white: #fffdf8;
  --shadow: 0 22px 60px rgba(44, 39, 32, .09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); overflow-x: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.grain { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }

.eyebrow { color: var(--terracotta); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-seal { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid rgba(255,255,255,.28); border-radius: 13px; color: #f6eee4; font: 700 15px Georgia, serif; letter-spacing: .06em; background: rgba(255,255,255,.08); }
.brand b, .brand small { display: block; }
.brand b { font-family: Georgia, "Songti SC", serif; font-size: 18px; letter-spacing: .12em; }
.brand small { margin-top: 4px; opacity: .53; font-size: 8px; letter-spacing: .15em; }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr); background: #ece5da; }
.login-art { position: relative; min-height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 9vh 8vw; color: #f8f0e6; background: radial-gradient(circle at 30% 22%, rgba(211,151,116,.48), transparent 23%), linear-gradient(135deg, #37473e 0%, #596b5f 42%, #82765e 100%); }
.login-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(22deg, rgba(28,35,31,.72), transparent 50%), radial-gradient(ellipse at 70% 75%, rgba(244,210,166,.18), transparent 48%); }
.login-art::after { content: ""; position: absolute; width: 72%; height: 45%; right: -10%; bottom: -10%; transform: rotate(-12deg); border-radius: 50%; background: linear-gradient(165deg, rgba(234,199,158,.24), rgba(97,73,51,.18)); filter: blur(4px); }
.login-mark { position: relative; z-index: 2; font: 400 clamp(100px, 13vw, 190px)/.85 "STKaiti", "KaiTi", serif; opacity: .22; }
.login-art > p { position: relative; z-index: 2; max-width: 520px; margin: 32px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(26px, 3vw, 44px); line-height: 1.5; letter-spacing: .09em; }
.sun-orbit { position: absolute; z-index: 1; width: 40vw; height: 40vw; max-width: 650px; max-height: 650px; left: 9%; top: 4%; border: 1px solid rgba(255,241,219,.18); border-radius: 50%; }
.sun-orbit::before, .sun-orbit::after { content: ""; position: absolute; inset: 13%; border: 1px solid rgba(255,241,219,.12); border-radius: inherit; }
.sun-orbit::after { inset: 29%; }
.sun-orbit span { position: absolute; width: 18%; aspect-ratio: 1; right: 8%; top: 20%; border-radius: 50%; background: #e3a77d; box-shadow: 0 0 70px rgba(227,167,125,.45); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 9vh clamp(44px, 7vw, 120px); background: var(--white); }
.brand-login { position: absolute; top: 42px; color: var(--ink); }
.brand-login .brand-seal { color: var(--sage-deep); border-color: var(--line); background: var(--sage-light); }
.login-copy h1 { margin: 12px 0 12px; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 4.5vw, 62px); font-weight: 500; letter-spacing: -.04em; }
.login-copy p { margin: 0; color: var(--ink-soft); font-size: 16px; }
.login-form { margin-top: 52px; }
.login-form label { display: block; margin-bottom: 10px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.key-field { position: relative; }
.key-field input { width: 100%; height: 58px; padding: 0 58px 0 18px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: #f9f6f0; transition: .2s; }
.key-field input:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(101,114,101,.1); }
.icon-button { position: absolute; right: 8px; top: 8px; width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.eye-icon { display: inline-block; width: 19px; height: 13px; border: 1.7px solid var(--ink-soft); border-radius: 50% 50%; position: relative; }
.eye-icon::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); left: 5px; top: 2px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 14px; border: 0; border-radius: 13px; color: #fffaf2; background: var(--sage-deep); text-decoration: none; font-weight: 700; box-shadow: 0 10px 24px rgba(68,82,69,.18); cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(68,82,69,.24); background: #465348; }
.primary-button:disabled { opacity: .55; cursor: wait; transform: none; }
.login-button { width: 100%; height: 58px; margin-top: 12px; }
.login-button .arrow { font-size: 20px; }
.field-error, .form-error { min-height: 19px; margin: 8px 0 0; color: var(--danger); font-size: 13px; }
.login-footnote { display: flex; align-items: center; gap: 8px; margin: 28px 0 0; color: #92958e; font-size: 12px; }
.secure-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(94,118,96,.12); }

/* Main layout */
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: 250px; display: flex; flex-direction: column; padding: 28px 21px 22px; color: #f4eee5; background: linear-gradient(170deg, #37463d 0%, #303a34 58%, #2a322e 100%); }
.sidebar::after { content: "洹"; position: absolute; z-index: -1; left: 5px; bottom: 130px; color: rgba(255,255,255,.025); font: 180px/.8 "STKaiti", serif; }
.main-nav { margin-top: 58px; display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; height: 49px; padding: 0 14px; border: 0; border-radius: 12px; color: rgba(255,255,255,.65); background: transparent; text-align: left; cursor: pointer; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.11); box-shadow: inset 3px 0 var(--rose); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }
.nav-item em { margin-left: auto; min-width: 21px; height: 21px; display: grid; place-items: center; border-radius: 20px; font-style: normal; font-size: 10px; color: #efe7db; background: rgba(255,255,255,.12); }
.sidebar-spacer { flex: 1; }
.engine-card { padding: 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(255,255,255,.045); }
.engine-card-head { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.55); font-size: 10px; letter-spacing: .09em; }
.engine-card-head i { width: 8px; height: 8px; border-radius: 50%; background: #b79b6e; }
.engine-card-head i.online { background: #8fb293; box-shadow: 0 0 0 4px rgba(143,178,147,.1); }
.engine-card strong, .engine-card small { display: block; }
.engine-card strong { margin-top: 13px; font-size: 13px; }
.engine-card small { margin-top: 5px; color: rgba(255,255,255,.44); line-height: 1.5; font-size: 10px; }
.engine-card button { margin-top: 12px; padding: 0; border: 0; color: #d5c0aa; background: transparent; font-size: 10px; cursor: pointer; }
.logout-button { display: flex; justify-content: space-between; margin-top: 14px; padding: 13px 3px 4px; border: 0; color: rgba(255,255,255,.43); background: transparent; font-size: 11px; cursor: pointer; }
.workspace { grid-column: 2; min-width: 0; }
.topbar { height: 95px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(28px, 4.5vw, 72px); border-bottom: 1px solid var(--line); background: rgba(245,240,232,.8); backdrop-filter: blur(16px); }
.topbar h2 { margin: 3px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 500; }
.date-line { margin: 0; color: var(--ink-soft); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.workspace-badge { display: flex; align-items: center; gap: 10px; }
.workspace-badge .avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--terracotta); font-family: "STKaiti", serif; }
.workspace-badge b, .workspace-badge small { display: block; }
.workspace-badge b { font-size: 12px; }
.workspace-badge small { margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.mobile-menu { display: none; }
.view { display: none; padding: 50px clamp(28px, 4.5vw, 72px) 80px; }
.view.active { display: block; animation: viewIn .35s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

.hero-copy { max-width: 720px; }
.hero-copy h1, .history-head h1 { margin: 12px 0 15px; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 5vw, 64px); line-height: 1.12; font-weight: 500; letter-spacing: -.05em; }
.hero-copy h1 em { color: var(--terracotta); font-style: normal; }
.hero-copy p, .history-head p { max-width: 620px; margin: 0; color: var(--ink-soft); line-height: 1.8; font-size: 14px; }
.creation-layout { display: grid; grid-template-columns: minmax(570px, 1fr) minmax(285px, 350px); gap: 25px; align-items: start; margin-top: 38px; }
.composer-card, .recent-panel { border: 1px solid rgba(52,55,48,.1); background: rgba(255,253,248,.82); box-shadow: var(--shadow); }
.composer-card { border-radius: var(--radius-xl); overflow: hidden; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; border-bottom: 1px solid var(--line); background: rgba(227,221,211,.44); }
.type-switch button { display: flex; align-items: center; justify-content: center; gap: 13px; min-height: 68px; border: 0; border-radius: 16px; color: var(--ink-soft); background: transparent; cursor: pointer; }
.type-switch button.active { color: var(--ink); background: var(--white); box-shadow: 0 5px 18px rgba(45,42,37,.08); }
.type-switch b, .type-switch small { display: block; text-align: left; }
.type-switch b { font-size: 13px; }
.type-switch small { margin-top: 3px; font-size: 9px; opacity: .6; }
.switch-symbol { width: 32px; height: 32px; position: relative; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.image-symbol::before { content: ""; position: absolute; width: 15px; height: 11px; left: 7px; top: 10px; clip-path: polygon(0 100%, 38% 37%, 56% 65%, 75% 18%, 100% 100%); background: var(--sage); }
.video-symbol::before { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--terracotta); font-size: 12px; }
#creation-form { padding: 28px 30px 30px; }
.form-section + .form-section { margin-top: 25px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.section-heading label, .control-field > span { font-size: 12px; font-weight: 700; }
.section-heading label i, .control-field span i { color: var(--ink-soft); font-weight: 400; font-style: normal; }
.section-heading > span { color: #9b9c96; font-size: 10px; }
.section-heading > span b { color: var(--ink-soft); }
.prompt-wrap { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #fbf8f2; transition: .2s; }
.prompt-wrap:focus-within { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(101,114,101,.08); }
.prompt-wrap textarea { display: block; width: 100%; min-height: 140px; padding: 17px 18px; resize: vertical; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.7; font-size: 13px; }
.prompt-wrap textarea::placeholder { color: #a8a69f; }
.prompt-hint { display: flex; align-items: center; gap: 8px; padding: 10px 17px; border-top: 1px solid rgba(46,50,43,.07); color: #92928b; font-size: 9px; }
.prompt-hint span { color: var(--terracotta); }
.upload-zone { min-height: 78px; padding: 12px; border: 1px dashed rgba(80,89,78,.35); border-radius: 15px; outline: none; background: rgba(229,231,224,.25); cursor: pointer; transition: .2s; }
.upload-zone:hover, .upload-zone.dragging, .upload-zone:focus { border-color: var(--sage); background: rgba(223,228,220,.55); }
.upload-zone.disabled { cursor: not-allowed; opacity: .55; filter: saturate(.5); }
.upload-zone.disabled:hover, .upload-zone.disabled:focus { border-color: rgba(80,89,78,.35); background: rgba(229,231,224,.25); }
.upload-empty { min-height: 52px; display: flex; justify-content: center; align-items: center; gap: 14px; }
.upload-empty b, .upload-empty small { display: block; }
.upload-empty b { font-size: 11px; }
.upload-empty small { margin-top: 4px; color: #96968f; font-size: 9px; }
.upload-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; color: var(--sage-deep); background: var(--sage-light); font-size: 22px; }
.preview-grid { display: grid; grid-template-columns: repeat(7, minmax(52px, 1fr)); gap: 8px; }
.preview-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--paper-deep); }
.preview-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.preview-item button { position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; color: #fff; background: rgba(30,31,28,.75); cursor: pointer; }
.reference-mode-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 0 12px; color: var(--ink-soft); font-size: 10px; }
.segmented-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(229,231,224,.48); }
.segmented-control button { min-height: 31px; padding: 0 13px; border: 0; border-radius: 7px; color: var(--ink-soft); background: transparent; font: inherit; cursor: pointer; }
.segmented-control button.active { color: #fff; background: var(--sage-deep); box-shadow: 0 4px 12px rgba(62,76,65,.18); }
.video-media-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 13px; }
.video-media-sections .form-section { margin-top: 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(249,247,241,.58); }
.compact-upload-zone { min-height: 74px; display: grid; grid-template-columns: 34px 1fr; align-items: center; column-gap: 10px; padding: 11px; border: 1px dashed rgba(80,89,78,.35); border-radius: 12px; cursor: pointer; transition: .2s; }
.compact-upload-zone:hover { border-color: var(--sage); background: rgba(223,228,220,.55); }
.compact-upload-zone > span { grid-row: 1 / span 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; background: var(--terracotta); font-size: 18px; }
.compact-upload-zone b { align-self: end; font-size: 10px; }
.compact-upload-zone small { align-self: start; color: var(--ink-soft); font-size: 8px; }
.file-chip-list { display: grid; gap: 6px; margin-top: 9px; }
.file-chip { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 9px; color: var(--ink-soft); background: rgba(223,228,220,.62); font-size: 9px; }
.file-chip > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--sage-deep); background: rgba(255,255,255,.7); }
.file-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { width: 24px; height: 24px; border: 0; border-radius: 50%; color: var(--ink-soft); background: transparent; cursor: pointer; }
.video-options { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 13px; }
.toggle-option { min-height: 58px; display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(249,247,241,.58); cursor: pointer; }
.toggle-option input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; flex: 0 0 auto; width: 37px; height: 21px; border-radius: 20px; background: #c8cbc3; transition: .2s; }
.toggle-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.16); transition: .2s; }
.toggle-option input:checked + .toggle-track { background: var(--sage-deep); }
.toggle-option input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-option > span:last-child b, .toggle-option > span:last-child small { display: block; }
.toggle-option > span:last-child b { font-size: 10px; }
.toggle-option > span:last-child small { margin-top: 3px; color: var(--ink-soft); font-size: 8px; line-height: 1.35; }
.form-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 13px; margin-top: 25px; }
.form-grid:has(.duration-field:not(.hidden)) { grid-template-columns: 1.35fr repeat(3, 1fr); }
.control-field { display: grid; gap: 8px; }
.control-field select { width: 100%; height: 44px; padding: 0 36px 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: #f9f6f0; font-size: 11px; }
.control-field select:focus { border-color: var(--sage); }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.privacy-note { display: flex; align-items: center; gap: 10px; color: var(--sage); }
.privacy-note > span:first-child { font-size: 20px; }
.privacy-note b, .privacy-note small { display: block; }
.privacy-note b { font-size: 10px; }
.privacy-note small { margin-top: 3px; color: #979991; font-size: 8px; }
.create-button { min-width: 180px; height: 50px; }
.create-button .spark { color: #f2c69e; }

.recent-panel { position: sticky; top: 24px; padding: 25px 20px; border-radius: var(--radius-xl); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 5px 18px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 6px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 19px; font-weight: 500; }
.text-button { padding: 0; border: 0; color: var(--terracotta); background: transparent; font-size: 9px; cursor: pointer; }
.recent-list { display: grid; gap: 9px; padding-top: 15px; }
.recent-task { position: relative; display: grid; grid-template-columns: 45px 1fr auto; align-items: center; gap: 10px; min-height: 65px; padding: 9px; border: 1px solid rgba(46,50,43,.08); border-radius: 13px; background: #faf7f1; overflow: hidden; }
.recent-thumb { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 10px; color: var(--sage); background: var(--sage-light); font-size: 18px; overflow: hidden; }
.recent-thumb img, .recent-thumb video { width: 100%; height: 100%; object-fit: cover; }
.recent-info { min-width: 0; }
.recent-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.recent-info small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b3a178; }
.status-dot.succeeded { background: var(--success); }
.status-dot.failed { background: var(--danger); }
.recent-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--terracotta); transition: width .4s; }
.empty-state { display: grid; place-items: center; min-height: 260px; color: #96978f; text-align: center; }
.empty-state.compact { min-height: 225px; }
.empty-state > span { font-size: 42px; opacity: .4; }
.empty-state p { margin: 10px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 15px; line-height: 1.7; }
.empty-state small { font-family: "Segoe UI Variable", sans-serif; font-size: 9px; }

/* History */
.history-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.history-head h1 { font-size: clamp(38px, 4vw, 54px); }
.history-filters { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,248,.7); }
.history-filters button { height: 35px; padding: 0 15px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 10px; cursor: pointer; }
.history-filters button.active { color: #fff; background: var(--sage-deep); }
.history-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin: 36px 0 28px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(255,253,248,.78); }
.history-summary > div { padding: 19px 22px; border-right: 1px solid var(--line); }
.history-summary > div:last-child { border: 0; }
.history-summary span, .history-summary strong { display: block; }
.history-summary span { color: var(--ink-soft); font-size: 9px; }
.history-summary strong { margin-top: 7px; font: 500 26px Georgia, serif; }
.danger-stat strong { color: var(--danger); }
.task-gallery { display: grid; grid-template-columns: repeat(3, minmax(240px, 1fr)); gap: 18px; }
.task-card { display: flex; flex-direction: column; min-height: 380px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: rgba(255,253,248,.9); box-shadow: 0 10px 35px rgba(45,42,37,.06); }
.task-media { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; color: rgba(59,67,59,.5); background: linear-gradient(145deg, #e4e5dc, #d6d8ce); cursor: default; }
.task-card.portrait .task-media { aspect-ratio: 4 / 3; }
.task-media.clickable { cursor: zoom-in; }
.task-media img, .task-media video { width: 100%; height: 100%; object-fit: cover; }
.task-media .media-placeholder { text-align: center; }
.task-media .media-placeholder span { display: block; font-size: 35px; }
.task-media .media-placeholder small { display: block; margin-top: 10px; font-size: 9px; }
.task-badge { position: absolute; left: 12px; top: 12px; padding: 6px 9px; border-radius: 20px; color: #fff; background: rgba(46,55,48,.75); backdrop-filter: blur(8px); font-size: 8px; }
.progress-ring { --progress: 0; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--terracotta) calc(var(--progress) * 1%), rgba(255,255,255,.45) 0); }
.progress-ring::before { content: ""; grid-area: 1/1; width: 52px; height: 52px; border-radius: 50%; background: #e0e1d8; }
.progress-ring b { z-index: 1; grid-area: 1/1; font-size: 11px; }
.task-card-body { display: flex; flex: 1; flex-direction: column; padding: 16px 17px 17px; }
.task-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-card-head strong { font-size: 11px; }
.status-pill { padding: 5px 8px; border-radius: 20px; color: var(--warning); background: rgba(162,118,60,.1); font-size: 8px; white-space: nowrap; }
.status-pill.succeeded { color: var(--success); background: rgba(94,118,96,.1); }
.status-pill.failed { color: var(--danger); background: rgba(169,78,66,.1); }
.task-prompt { display: -webkit-box; margin: 11px 0; overflow: hidden; color: var(--ink-soft); line-height: 1.6; font-size: 10px; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.task-id { padding-top: 9px; border-top: 1px solid var(--line); color: #92938d; font: 9px Consolas, monospace; overflow-wrap: anywhere; }
.failure-box { margin-top: 10px; padding: 10px 11px; border-left: 3px solid var(--danger); border-radius: 7px; color: #83483f; background: rgba(169,78,66,.07); font-size: 9px; line-height: 1.55; overflow-wrap: anywhere; }
.failure-box b { display: block; margin-bottom: 3px; color: var(--danger); }
.task-actions { display: flex; gap: 7px; margin-top: auto; padding-top: 13px; }
.task-actions a, .task-actions button { flex: 1; height: 33px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: transparent; text-decoration: none; font-size: 9px; cursor: pointer; }
.task-actions a.primary { color: #fff; border-color: var(--sage-deep); background: var(--sage-deep); }

/* Modal and toast */
.modal-backdrop { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 30px; background: rgba(27,31,28,.72); backdrop-filter: blur(14px); }
.asset-modal { position: relative; width: min(1000px, 96vw); max-height: 92vh; overflow: auto; border-radius: 24px; background: var(--white); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.modal-close { position: absolute; z-index: 2; right: 14px; top: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%; color: #fff; background: rgba(20,22,20,.6); font-size: 25px; cursor: pointer; }
.modal-media { min-height: 420px; max-height: 66vh; display: grid; place-items: center; background: #202521; }
.modal-media img, .modal-media video { display: block; max-width: 100%; max-height: 66vh; object-fit: contain; }
.modal-meta { display: flex; justify-content: space-between; gap: 30px; align-items: center; padding: 22px 26px; }
.modal-meta span { color: var(--terracotta); font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.modal-meta h3 { margin: 5px 0; font-family: Georgia, serif; }
.modal-meta p { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }
.modal-meta .primary-button { flex: 0 0 auto; height: 43px; padding: 0 18px; font-size: 10px; }
.toast-stack { position: fixed; z-index: 80; right: 22px; bottom: 22px; display: grid; gap: 10px; }
.toast { width: min(360px, calc(100vw - 44px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--white); box-shadow: var(--shadow); font-size: 11px; animation: toastIn .25s ease both; }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .creation-layout { grid-template-columns: 1fr; }
  .recent-panel { position: static; }
  .recent-list { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .form-grid:has(.duration-field:not(.hidden)) { grid-template-columns: repeat(2, 1fr); }
  .task-gallery { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

@media (max-width: 780px) {
  .login-shell { display: block; background: var(--white); }
  .login-art { min-height: 34vh; padding: 38px 28px; justify-content: flex-end; }
  .login-art > p { margin: 0; font-size: 25px; }
  .login-mark { display: none; }
  .sun-orbit { width: 80vw; height: 80vw; top: -45%; left: 20%; }
  .login-panel { min-height: 66vh; padding: 75px 28px 40px; }
  .brand-login { top: calc(34vh + 20px); }
  .login-copy h1 { font-size: 38px; }
  .login-form { margin-top: 38px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .25s; box-shadow: 20px 0 60px rgba(0,0,0,.15); }
  .sidebar.open { transform: translateX(0); }
  .workspace { width: 100%; }
  .topbar { height: 80px; padding: 0 18px; }
  .mobile-menu { display: block; width: 38px; height: 38px; margin-right: 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; }
  .topbar > div:first-of-type { margin-right: auto; }
  .workspace-badge small { display: none; }
  .view { padding: 34px 18px 60px; }
  .hero-copy h1 { font-size: 40px; }
  .creation-layout { margin-top: 28px; }
  #creation-form { padding: 22px 18px; }
  .type-switch button { min-height: 62px; }
  .form-grid, .form-grid:has(.duration-field:not(.hidden)) { grid-template-columns: 1fr 1fr; }
  .preview-grid { grid-template-columns: repeat(4, 1fr); }
  .video-media-sections, .video-options { grid-template-columns: 1fr; }
  .reference-mode-row { align-items: flex-start; flex-direction: column; }
  .submit-row { display: grid; }
  .create-button { width: 100%; }
  .recent-list { grid-template-columns: 1fr; }
  .history-head { align-items: flex-start; flex-direction: column; }
  .history-filters { width: 100%; overflow-x: auto; }
  .history-filters button { flex: 1; white-space: nowrap; }
  .history-summary { grid-template-columns: 1fr 1fr; }
  .history-summary > div:nth-child(2) { border-right: 0; }
  .history-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .task-gallery { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 12px; }
  .modal-media { min-height: 260px; }
  .modal-meta { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
