:root {
  color-scheme: light;
  --ink: #151619;
  --muted: #747984;
  --canvas: #e9ebf1;
  --surface: #f8f9fb;
  --card: #ffffff;
  --dark: #17181e;
  --dark-2: #24262f;
  --line: #dfe2e9;
  --lime: #d7ff4f;
  --violet: #8370ee;
  --pink: #f4a8dc;
  --cyan: #aee9f1;
  --red: #ce4c55;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: #cfd3df; color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 20% 15%, #987df0 0, transparent 28%), radial-gradient(circle at 85% 80%, #c8ef70 0, transparent 26%), #17181e;
}
.login-card { width: min(460px, 100%); padding: 46px; border: 1px solid #ffffff24; border-radius: 34px; background: #f8f9fbea; box-shadow: 0 40px 100px #08090c80; backdrop-filter: blur(20px); }
.login-card h1 { margin: 4px 0 12px; font-size: 47px; line-height: 1; letter-spacing: -.055em; }
.login-card > p:not(.eyebrow) { color: var(--muted); }
.login-card label { margin-top: 28px; }
.feishu-login-button { min-height: 48px; display: grid; place-items: center; margin-top: 28px; border-radius: 999px; background: var(--dark); color: #fff; font-size: 12px; font-weight: 780; text-decoration: none; }
.feishu-login-button:hover { background: #252832; }
.emergency-login { margin-top: 12px; color: var(--muted); font-size: 10px; }
.emergency-login summary { cursor: pointer; text-align: center; }
.emergency-login form { display: grid; gap: 12px; margin-top: 14px; }
.emergency-login form label { margin-top: 0; }
.login-card > .form-message { margin-top: 10px; }

.app-shell { min-height: calc(100vh - 28px); margin: 14px; display: grid; grid-template-columns: 224px minmax(0, 1fr); overflow: hidden; border: 1px solid #ffffff4d; border-radius: 34px; background: var(--surface); box-shadow: 0 25px 70px #3035452c; }
.sidebar { position: sticky; top: 0; height: calc(100vh - 28px); display: flex; flex-direction: column; padding: 31px 20px 22px; background: var(--dark); color: #f6f7fa; }
.brand { color: inherit; font-size: 25px; font-weight: 800; letter-spacing: -.06em; text-decoration: none; }
.brand span { color: var(--lime); }
.brand-caption { margin: 7px 0 43px; color: #737782; font-size: 9px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 15px; border: 0; border-radius: 13px; background: transparent; color: #8f939d; text-align: left; transition: .18s ease; }
.nav-item:hover { color: #fff; background: #22242b; }
.nav-item.active { color: #17181e; background: var(--lime); box-shadow: 0 9px 24px #d7ff4f1f; }
.nav-item span { font-size: 12px; font-weight: 740; }
.nav-item small { min-width: 23px; padding: 3px 6px; border-radius: 999px; background: #ffffff0d; color: inherit; font-size: 9px; text-align: center; }
.sidebar-footer { margin-top: auto; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; color: #7f838d; font-size: 10px; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #62656e; }
.sidebar-footer.online .connection-dot { background: var(--lime); box-shadow: 0 0 0 5px #d7ff4f13; }
.text-button { grid-column: 1/-1; margin-top: 10px; padding: 9px 0; border: 0; background: transparent; color: #777b84; text-align: left; }

main { min-width: 0; padding: 35px clamp(24px, 4vw, 58px) 70px; background: linear-gradient(145deg, #f7f8fa, #eceef3); }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 27px; }
.eyebrow, .signal { margin: 0 0 8px; color: var(--violet); font-size: 9px; font-weight: 850; letter-spacing: .17em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -.055em; }
.topbar h1 { font-size: clamp(38px, 4.5vw, 61px); line-height: .98; }
.page-description { margin: 11px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.agent-state, .cost-pill { padding: 9px 13px; border: 1px solid #d8dbe3; border-radius: 999px; background: #fff; color: #31343b; font-size: 10px; font-weight: 760; }
.secondary-button, .inline-button { border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); }
.secondary-button { min-height: 38px; padding: 0 14px; }
.inline-button { padding: 6px 10px; font-size: 10px; }

.view { display: none; }
.view.active { display: block; }
.workflow-banner { position: relative; min-height: 265px; display: grid; grid-template-columns: 1.45fr .38fr; gap: 24px; align-items: center; overflow: hidden; padding: 40px; border-radius: 27px; background: var(--dark); color: white; box-shadow: 0 18px 45px #22252e20; }
.workflow-banner::before { content: ""; position: absolute; width: 480px; height: 480px; right: -120px; top: -210px; border-radius: 50%; background: radial-gradient(circle at 35% 65%, var(--pink), var(--violet) 45%, transparent 68%); filter: blur(3px); opacity: .88; }
.workflow-banner::after { content: ""; position: absolute; width: 280px; height: 280px; right: 120px; bottom: -220px; border-radius: 50%; background: var(--lime); filter: blur(2px); opacity: .82; }
.workflow-banner > * { position: relative; z-index: 1; }
.workflow-banner h2 { max-width: 680px; font-size: clamp(34px, 4.3vw, 60px); line-height: 1.01; }
.quota-card { justify-self: end; width: 145px; min-height: 165px; display: grid; align-content: center; padding: 20px; border: 1px solid #ffffff32; border-radius: 27px; background: #ffffff14; backdrop-filter: blur(18px); }
.quota-card span, .quota-card small { color: #e1e2e6; font-size: 9px; }
.quota-card strong { margin: 5px 0 -3px; font-size: 68px; line-height: 1; letter-spacing: -.08em; }
.workflow-steps { grid-column: 1/-1; display: flex; gap: 8px; margin-top: -12px; }
.workflow-steps span { padding: 8px 11px; border: 1px solid #ffffff1b; border-radius: 999px; background: #ffffff0d; color: #c9cbd2; font-size: 9px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin: 15px 0; }
.metrics article { padding: 18px 19px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.metrics span { display: block; color: var(--muted); font-size: 9px; }
.metrics strong { display: block; margin-top: 12px; font-size: 28px; line-height: 1; letter-spacing: -.05em; }

.automation-strip { display: grid; grid-template-columns: minmax(230px, 1.4fr) 120px 130px minmax(190px, .9fr) auto; gap: 13px; align-items: end; margin: 0 0 15px; padding: 18px 20px; border: 1px solid #dfe2e9; border-radius: 21px; background: linear-gradient(105deg, #fff, #f4f1ff 65%, #f4fbe3); }
.automation-intro { display: flex; gap: 11px; align-items: center; align-self: center; }
.automation-intro b, .automation-intro small { display: block; }
.automation-intro b { font-size: 12px; }
.automation-intro small { max-width: 410px; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.automation-strip label { font-size: 9px; }
.automation-strip input[type="number"] { padding: 10px 11px; background: #fff; }
.automation-strip > button { min-height: 39px; padding: 0 15px; border: 0; border-radius: 999px; background: var(--dark); color: #fff; font-size: 10px; font-weight: 780; }
.automation-strip .form-message { grid-column: 1/-1; min-height: 0; }
.switch-field { display: flex; grid-template-columns: none; align-items: center; gap: 9px; min-height: 39px; padding: 8px 10px; border: 1px solid #dde0e7; border-radius: 11px; background: #fff; }
.switch-field input { width: 17px; height: 17px; margin: 0; accent-color: var(--violet); }
.switch-field span, .switch-field small { display: block; }
.switch-field small { margin-top: 2px; color: var(--muted); font-size: 8px; font-weight: 500; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .72fr); gap: 15px; }
.panel, .production-card, .recent-card, .upload-zone, .video-upload-bar { padding: clamp(22px, 3vw, 32px); border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.section-heading h2, .panel h2, .upload-zone h2 { font-size: 28px; }

.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 24px; padding: 6px; border-radius: 17px; background: #f0f1f5; }
.mode-switch label { display: block; cursor: pointer; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch span { display: grid; gap: 3px; padding: 13px 15px; border: 1px solid transparent; border-radius: 13px; color: #767b86; }
.mode-switch b { font-size: 11px; }
.mode-switch small { font-size: 9px; font-weight: 500; }
.mode-switch input:checked + span { border-color: #d6d9e1; background: #fff; color: var(--ink); box-shadow: 0 5px 14px #3135410d; }

.ai-director { margin-top: 13px; padding: 20px; overflow: hidden; border: 1px solid #ded8fa; border-radius: 20px; background: linear-gradient(135deg, #f3f0ff, #fff7fc 60%, #f3fae4); }
.ai-director-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.ai-director-head > div { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px; }
.spark { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: var(--dark); color: var(--lime); }
.ai-director-head b { font-size: 12px; }
.ai-director-head small { color: var(--muted); font-size: 9px; }
.ai-director-head button { padding: 9px 13px; border: 0; border-radius: 999px; background: var(--dark); color: #fff; font-size: 10px; font-weight: 760; }
.ai-brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 17px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
label { display: grid; gap: 7px; color: #3a3d44; font-size: 10px; font-weight: 760; }
.wide { grid-column: 1/-1; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #dde0e7; border-radius: 11px; outline: none; background: #f8f9fb; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px #8370ee13; background: #fff; }
.field-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #3a3d44; font-size: 10px; font-weight: 760; }
.confirmation { display: flex; grid-template-columns: none; align-items: center; gap: 9px; padding: 12px; border: 1px solid #efd7ce; border-radius: 12px; background: #fff7f3; color: #7b3d2a; }
.confirmation input { width: 17px; height: 17px; margin: 0; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 19px; }
.form-actions > button, .login-card button, .upload-zone button, .video-upload-bar > button { min-height: 43px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--dark); color: #fff; font-weight: 780; }
.form-message { min-height: 16px; margin: 0 auto 0 0; color: var(--red); font-size: 10px; }
.form-message.success { color: #34744e; }

.asset-picker { display: flex; gap: 9px; overflow-x: auto; padding: 2px 2px 8px; }
.picker-item { position: relative; flex: 0 0 72px; height: 92px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 13px; background: #eee; }
.picker-item img { width: 100%; height: 100%; object-fit: cover; }
.picker-item.selected { border-color: var(--violet); box-shadow: 0 0 0 3px #8370ee18; }
.picker-item.selected::after { content: "✓"; position: absolute; right: 5px; top: 5px; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--violet); color: #fff; font-size: 10px; }
.recent-card { min-height: 470px; background: var(--dark); color: #fff; border-color: #24262d; }
.recent-card .inline-button { border-color: #ffffff26; background: #ffffff0d; color: #fff; }
.recent-video { margin-top: 20px; }
.recent-video video { width: 100%; max-height: 410px; border-radius: 17px; background: #0d0e11; object-fit: contain; }
.latest-assets-panel { margin-top: 15px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 20px; }
.compact-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.media-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; transition: transform .18s, box-shadow .18s; }
.media-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px #30343f14; }
.media-preview { position: relative; aspect-ratio: 4/5; overflow: hidden; background: #e5e7ec; }
.video-grid .media-preview { aspect-ratio: 9/16; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-preview video { background: #101116; }
.media-badge { position: absolute; top: 9px; left: 9px; padding: 5px 8px; border-radius: 999px; background: #f9fafbe8; color: #22242a; font-size: 8px; font-weight: 850; backdrop-filter: blur(8px); }
.media-card-body { padding: 12px; }
.media-card h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.media-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 8px; }
.media-open { position: absolute; inset: 0; border: 0; background: transparent; font-size: 0; }
.media-delete { position: absolute; z-index: 2; right: 9px; top: 9px; padding: 5px 8px; border: 0; border-radius: 999px; background: #17181edb; color: #fff; font-size: 8px; opacity: 0; transition: opacity .18s; }
.media-card:hover .media-delete { opacity: 1; }

.split-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); gap: 15px; align-items: start; }
.sticky-form { position: sticky; top: 24px; }
.sticky-form > label { margin-top: 15px; }
.prompt-list { display: grid; gap: 11px; }
.prompt-card { padding: 21px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.prompt-card-top { display: flex; justify-content: space-between; gap: 18px; }
.prompt-card h3 { margin: 0 0 7px; font-size: 14px; }
.prompt-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0; }
.tag { padding: 5px 8px; border-radius: 999px; background: #eff0f4; color: #626772; font-size: 8px; }
.card-actions { display: flex; gap: 7px; }
.card-actions button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 9px; }
.card-actions .danger { color: var(--red); }

.upload-zone { text-align: center; border-style: dashed; background: #f7f8fa; }
.upload-zone.dragover { border-color: var(--violet); background: #f5f2ff; }
.upload-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 15px; border-radius: 17px; background: var(--dark); color: var(--lime); font-size: 24px; }
.upload-zone p { color: var(--muted); font-size: 11px; }
.video-upload-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 20px 23px; background: linear-gradient(100deg, #1c1d23, #292c38); color: #fff; }
.video-upload-bar > div { display: flex; align-items: center; gap: 12px; }
.video-upload-bar b, .video-upload-bar small { display: block; }
.video-upload-bar b { font-size: 12px; }
.video-upload-bar small { margin-top: 4px; color: #a7abb6; font-size: 9px; }
.video-upload-bar > button { background: var(--lime); color: #17181e; }
.video-upload-bar .form-message { grid-column: 1/-1; }
.library-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 0; }
.library-toolbar span { font-size: 12px; font-weight: 760; }
.library-toolbar input { width: min(280px, 45%); background: #fff; }

.task-list { display: grid; gap: 9px; margin-top: 20px; }
.task-card { display: grid; grid-template-columns: minmax(190px, 1.2fr) 105px minmax(190px, 1fr) 100px; gap: 15px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 15px; }
.task-card h3 { margin: 0 0 5px; font-size: 12px; }
.task-card p { margin: 0; color: var(--muted); font-size: 9px; }
.status { justify-self: start; padding: 6px 9px; border-radius: 999px; background: #eeeff3; color: var(--muted); font-size: 8px; font-weight: 850; }
.status.succeeded { background: #e5f8ce; color: #38612f; }
.status.failed { background: #f8e1e4; color: var(--red); }
.status.running, .status.leased { background: #eee8ff; color: #5c4bb6; }
.progress { display: grid; gap: 7px; }
.progress-bar { height: 6px; overflow: hidden; border-radius: 999px; background: #e7e8ed; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--pink)); }
.task-cost { text-align: right; font-size: 14px; font-weight: 760; }
.task-actions { display: flex; justify-content: flex-end; gap: 6px; }
.task-actions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 8px; }
.task-actions button.danger { color: var(--red); }
.empty { padding: 36px 10px; color: var(--muted); text-align: center; font-size: 11px; }
.empty.compact { padding: 22px 4px; }
.preview-dialog { width: min(900px, 92vw); max-height: 90vh; padding: 43px 24px 24px; border: 0; border-radius: 24px; background: #111217; color: #fff; }
.preview-dialog::backdrop { background: #090a0dc7; backdrop-filter: blur(8px); }
.preview-dialog img, .preview-dialog video { display: block; max-width: 100%; max-height: 78vh; margin: auto; border-radius: 14px; }
.dialog-close { position: absolute; right: 14px; top: 12px; border: 0; background: transparent; color: #fff; }
.preview-caption { margin: 14px 0 0; color: #b6bac3; text-align: center; font-size: 10px; }

@media (max-width: 1060px) {
  .dashboard-grid, .split-layout { grid-template-columns: 1fr; }
  .sticky-form { position: static; }
  .recent-card { min-height: auto; }
  .task-card { grid-template-columns: 1fr 100px 1fr; }
  .task-cost { display: none; }
  .automation-strip { grid-template-columns: 1fr 1fr 1fr; }
  .automation-intro { grid-column: 1/-1; }
}
@media (max-width: 840px) {
  .app-shell { margin: 0; min-height: 100vh; border: 0; border-radius: 0; grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 19px; }
  .brand-caption { margin-bottom: 17px; }
  .sidebar nav { grid-template-columns: repeat(5, 110px); overflow-x: auto; }
  .sidebar-footer { display: none; }
  main { padding-top: 25px; }
  .topbar { align-items: start; flex-direction: column; }
  .workflow-banner { grid-template-columns: 1fr; }
  .quota-card { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .task-card { grid-template-columns: 1fr; }
  .automation-strip { grid-template-columns: 1fr 1fr; }
  .switch-field { grid-column: 1/-1; }
}
@media (max-width: 600px) {
  main { padding-inline: 16px; }
  .form-grid, .ai-brief-grid, .metrics, .mode-switch { grid-template-columns: 1fr; }
  .wide { grid-column: 1; }
  .media-grid { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: 39px; }
  .workflow-banner { min-height: 330px; padding: 27px; }
  .workflow-steps { flex-direction: column; align-items: start; }
  .video-upload-bar { grid-template-columns: 1fr; }
  .automation-strip { grid-template-columns: 1fr; }
  .automation-intro, .switch-field { grid-column: 1; }
}
