:root {
  --ink: #111318;
  --soft: #252934;
  --paper: #f5f4ef;
  --card: #fff;
  --line: #deded7;
  --muted: #73776f;
  --acid: #bffb4f;
  --teal: #35e8c1;
  --pink: #ff557d;
  --danger: #b93145;
  --shadow: 0 18px 50px rgba(17, 19, 24, .09);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 90% 5%, rgba(191,251,79,.22), transparent 24rem), var(--paper);
  font: 14px/1.65 "Microsoft YaHei UI", "PingFang SC", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }

.app-shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 25px 18px;
  color: #fff; background: radial-gradient(circle at 0 0, rgba(53,232,193,.15), transparent 17rem), var(--ink);
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 7px 26px; }
.logo-mark { display: grid; width: 42px; height: 42px; place-items: center; color: var(--ink); background: var(--acid); border-radius: 13px 13px 13px 4px; font-size: 22px; font-weight: 900; transform: rotate(-3deg); }
.brand strong, .brand small { display: block; }
.brand small { color: #8f949f; font-size: 9px; letter-spacing: .12em; }
nav { display: grid; gap: 4px; }
.nav { display: flex; gap: 11px; align-items: center; padding: 11px 13px; color: #adb2bc; background: transparent; border: 0; border-radius: 11px; text-align: left; }
.nav:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav.active { color: var(--ink); background: var(--acid); font-weight: 800; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 7px; margin-top: auto; padding: 13px; color: #9096a1; background: rgba(255,255,255,.05); border-radius: 13px; font-size: 10px; }
.link-button { padding: 2px 0; color: var(--teal); background: transparent; border: 0; text-align: left; }

.main { min-width: 0; padding: 0 38px 55px; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 106px; }
.topbar h1 { margin: 3px 0 0; font-size: 27px; letter-spacing: -.04em; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.user-chip { display: flex; gap: 11px; align-items: center; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 10px; }
.user-chip b { color: #267553; }

.view { display: none; animation: enter .22s ease; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero { display: flex; justify-content: space-between; align-items: center; min-height: 300px; padding: 40px 44px; color: #fff; background: var(--ink); border-radius: 25px; overflow: hidden; }
.hero h2 { margin: 16px 0 10px; font-size: clamp(33px, 4vw, 50px); line-height: 1.08; letter-spacing: -.055em; }
.hero h2 em { color: var(--acid); font-style: normal; }
.hero p { max-width: 530px; color: #b4b8c1; }
.tag { display: inline-flex; padding: 4px 9px; color: #5f5c45; background: #fff4c9; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.hero .tag { color: var(--acid); background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.12); }
.hero-orbit { position: relative; width: 260px; height: 220px; }
.hero-orbit span { position: absolute; display: grid; place-items: center; border-radius: 50%; font-weight: 900; box-shadow: 0 12px 35px rgba(0,0,0,.3); }
.hero-orbit span:nth-child(1) { top: 4px; left: 45px; width: 72px; height: 72px; color: var(--ink); background: var(--acid); }
.hero-orbit span:nth-child(2) { top: 91px; right: 10px; width: 76px; height: 76px; color: #fff; background: var(--pink); }
.hero-orbit span:nth-child(3) { bottom: 2px; left: 90px; width: 58px; height: 58px; background: var(--teal); }
.hero-orbit span:nth-child(4) { top: 58px; left: 0; width: 48px; height: 48px; background: #fff; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 20px; }
.stat { padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.stat span { color: var(--muted); font-size: 10px; }
.stat strong { display: block; font-size: 27px; }
.two-col { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }
.panel { padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.panel.dark { color: #fff; background: var(--soft); border-color: var(--soft); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel h2 { margin-bottom: 4px; font-size: 18px; }
.status-list { display: grid; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; color: #d2d4d9; font-size: 11px; }
.status-list li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid rgba(255,255,255,.08); }
.status-list b { color: var(--teal); }

.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin: 12px 0 22px; }
.section-head h2 { margin: 7px 0 4px; font-size: 31px; letter-spacing: -.04em; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 8px 15px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 800; text-decoration: none; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--ink); border-color: var(--ink); }
.button.danger { color: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.wide { width: 100%; }
.file-button { position: relative; }
.icon { display: grid; width: 31px; height: 31px; place-items: center; background: var(--paper); border: 0; border-radius: 50%; font-size: 18px; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.muted { color: var(--muted); font-size: 10px; }

input, select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8e9288; box-shadow: 0 0 0 3px rgba(191,251,79,.25); }
label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 800; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.item-card { display: flex; flex-direction: column; min-height: 240px; padding: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.item-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.item-image { display: grid; height: 120px; margin-bottom: 13px; place-items: center; color: #a3a69e; background: linear-gradient(135deg, #eaf8c9, #f1f1eb); border-radius: 11px; font-size: 28px; overflow: hidden; }
.item-image img { width: 100%; height: 100%; object-fit: cover; }
.item-card h3 { margin-bottom: 5px; font-size: 14px; }
.meta { color: var(--muted); font-size: 9px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.tag-mini { padding: 3px 6px; color: #5c6058; background: var(--paper); border-radius: 5px; font-size: 8px; }
.card-actions { display: flex; gap: 7px; margin-top: auto; }
.card-actions .button { flex: 1; min-height: 33px; font-size: 9px; }

.generate-bar { display: grid; grid-template-columns: 1.3fr .8fr 1fr auto; gap: 10px; align-items: end; padding: 16px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.generate-bar .button { margin-bottom: 1px; }
.content-layout { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 13px; align-items: start; }
.project-list { display: grid; gap: 5px; padding: 9px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.project-option { padding: 10px; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 9px; text-align: left; }
.project-option:hover, .project-option.active { background: #f0f8dd; border-color: #dceaba; }
.project-option strong, .project-option small { display: block; }
.project-option strong { font-size: 10px; }
.project-option small { color: var(--muted); font-size: 8px; }
.status { display: inline-flex; padding: 3px 7px; color: #61520a; background: #fff2ba; border-radius: 999px; font-size: 8px; font-weight: 800; }
.status.video_ready, .status.approved, .status.published { color: #1f5a42; background: #daf8e9; }
.status.failed, .status.video_failed, .status.expired { color: #7b2635; background: #ffe7eb; }
.script-grid { display: grid; gap: 11px; }
.scene { display: grid; grid-template-columns: 28px 1fr 1fr; gap: 8px; padding: 9px; background: var(--paper); border-radius: 9px; }
.scene-number { display: grid; width: 26px; height: 26px; place-items: center; background: #fff; border-radius: 7px; font-size: 9px; }

.jobs { display: grid; gap: 9px; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.job h3 { margin: 0 0 4px; font-size: 13px; }
.job-actions { display: flex; gap: 7px; align-items: center; }
.empty { padding: 32px; color: var(--muted); background: rgba(255,255,255,.7); border: 1px dashed #c9cbc4; border-radius: 14px; text-align: center; }
.recent-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid #eee; }
.recent-row:first-child { border-top: 0; }
.recent-row strong { display: block; font-size: 11px; }
.recent-row small { color: var(--muted); font-size: 8px; }

.modal { width: min(680px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(10,12,15,.6); backdrop-filter: blur(3px); }
.modal form { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #eee; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: 380px; padding: 11px 15px; color: #fff; background: var(--ink); border-radius: 10px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s; font-size: 10px; }
.toast.show { opacity: 1; transform: none; }
.form-message { min-height: 20px; color: var(--danger); font-size: 10px; }

.login-body { min-height: 100vh; background: var(--ink); }
.login-shell { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 100vh; }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 8vw; color: #fff; background: radial-gradient(circle at 15% 15%, rgba(53,232,193,.17), transparent 22rem); }
.login-brand > p { color: #8f949f; font-size: 10px; letter-spacing: .14em; }
.login-brand h1 { margin: 28px 0 16px; font-size: clamp(42px, 6vw, 76px); line-height: 1.02; letter-spacing: -.06em; }
.login-brand h1 em { color: var(--acid); font-style: normal; }
.login-brand .login-note { max-width: 480px; color: #aeb3bc; font-size: 13px; letter-spacing: 0; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 10vw; background: var(--paper); }
.login-card h2 { margin: 8px 0 25px; font-size: 32px; }
.login-card form { display: grid; gap: 14px; max-width: 400px; }
.login-card .button { margin-top: 5px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(4, 1fr); }
  .sidebar-bottom { margin-top: 12px; }
  .main { padding: 0 18px 40px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .content-layout { grid-template-columns: 1fr; }
  .hero-orbit { display: none; }
}
@media (max-width: 650px) {
  .sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .topbar { min-height: 90px; }
  .stats, .card-grid, .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .generate-bar { grid-template-columns: 1fr; }
  .hero { padding: 30px 24px; }
  .hero h2 { font-size: 36px; }
  .scene { grid-template-columns: 28px 1fr; }
  .scene label:last-child { grid-column: 2; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 38vh; padding: 45px 28px; }
  .login-card { padding: 40px 28px; }
}
