:root {
  --bg: #f4f5f2;
  --paper: #ffffff;
  --ink: #171918;
  --muted: #6f746f;
  --line: #dfe2dd;
  --soft: #ecefeb;
  --accent: #e6534c;
  --teal: #167c80;
  --green: #2f7d53;
  --amber: #a96518;
  --shadow: 0 12px 40px rgba(23, 25, 24, .11);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(120deg, #eef4f1 0 48%, #f8e9e5 48% 100%); }
.login-panel { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); padding: 44px; box-shadow: var(--shadow); }
.login-panel h1 { margin: 0 0 8px; font-size: 32px; }
.login-form { display: grid; gap: 16px; margin-top: 30px; }
label { display: grid; gap: 7px; color: #3b3e3b; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd3ce; background: white; color: var(--ink); border-radius: 6px; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,124,128,.1); }
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.form-error { min-height: 18px; margin: -5px 0 0; color: #b42318; font-size: 13px; }
.primary, .ghost, .danger, .text-button, .icon-button { border: 0; border-radius: 6px; padding: 10px 14px; font-weight: 700; white-space: nowrap; }
.primary { background: var(--ink); color: white; }
.primary:hover { background: var(--teal); }
.ghost { background: transparent; border: 1px solid var(--line); color: inherit; }
.ghost:hover { background: var(--soft); }
.danger { color: #b42318; background: #fff0ee; }
.text-button { color: var(--muted); background: transparent; padding-inline: 0; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); background: white; font-size: 24px; }
.wide { width: 100%; }
.app-shell { min-height: 100vh; display: grid; grid-template: 70px 1fr / 230px 1fr; }
.sidebar { grid-row: 1 / 3; display: flex; flex-direction: column; background: #171918; color: white; padding: 22px 14px; position: sticky; top: 0; height: 100vh; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid #343735; }
.brand-mark { display: grid; place-items: center; width: 35px; aspect-ratio: 1; background: var(--accent); font: 800 18px Georgia, serif; }
.brand strong, .brand small { display: block; }
.brand small { color: #aeb3ae; font-size: 11px; margin-top: 2px; }
nav { display: grid; gap: 4px; margin-top: 22px; }
nav button { display: flex; align-items: center; gap: 12px; border: 0; padding: 12px; border-radius: 6px; background: transparent; color: #c8ccc8; text-align: left; }
nav button span { color: #777d78; font-size: 10px; }
nav button:hover, nav button.active { background: #2a2d2b; color: white; }
nav button.active span { color: #ff7169; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; padding: 12px 8px 0; }
.sidebar .ghost { border-color: #484c49; }
.sidebar .text-button { color: #9ba09c; }
.topbar { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 30px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 8; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 20px; }
.character-switcher { display: flex; align-items: center; gap: 10px; }
.character-switcher img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.character-switcher small { display: block; color: var(--muted); font-size: 10px; }
.character-switcher select { border: 0; padding: 0 24px 0 0; background-color: transparent; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.workspace { grid-column: 2; padding: 28px 30px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 24px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0; font-size: 27px; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: nowrap; align-items: center; flex: 0 0 auto; }
.actions button { white-space: nowrap; min-width: max-content; }
.hero { display: grid; grid-template-columns: minmax(220px, .72fr) 1.28fr; min-height: 390px; background: #1b1e1c; color: white; overflow: hidden; }
.hero-media { min-height: 390px; background: #dfe5df; }
.hero-media img { width: 100%; height: 100%; min-height: 390px; object-fit: cover; object-position: center 26%; display: block; }
.hero-copy { align-self: end; padding: 42px; }
.hero-copy h1 { margin: 8px 0 6px; font: 500 48px Georgia, "Noto Serif SC", serif; }
.hero-copy h1 span { color: #bfc5c0; font-size: .58em; }
.hero-copy .positioning { max-width: 580px; margin: 20px 0 28px; color: #d9deda; font-size: 18px; line-height: 1.7; }
.status-pill, .pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 800; }
.status-pill { background: var(--accent); color: white; }
.pill { background: var(--soft); color: #464a46; }
.pill.green { background: #e6f4ea; color: var(--green); }
.pill.amber { background: #fff1d7; color: var(--amber); }
.pill.red { background: #ffe8e5; color: #a6322c; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.metric { background: white; border: 1px solid var(--line); padding: 18px; min-width: 0; }
.metric small { color: var(--muted); }
.metric strong { display: block; font-size: 26px; margin: 9px 0 4px; }
.metric span { color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.section { margin-top: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head small { color: var(--muted); }
.panel { background: white; border: 1px solid var(--line); padding: 20px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
.panel p { line-height: 1.7; }
.info-list { display: grid; gap: 0; margin: 0; }
.info-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--soft); }
.info-row:last-child { border-bottom: 0; }
.info-row dt { color: var(--muted); font-size: 12px; }
.info-row dd { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { padding: 5px 8px; background: #eef3f1; border: 1px solid #dde5e1; border-radius: 4px; font-size: 12px; }
.progress-row { margin: 15px 0; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12px; }
.progress { height: 7px; background: var(--soft); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7f8f6; color: var(--muted); font-size: 11px; text-transform: uppercase; }
td { font-size: 13px; line-height: 1.45; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcfa; }
.row-title { font-weight: 800; }
.row-copy { max-width: 340px; color: #4a4e4a; }
.row-actions { display: flex; gap: 5px; }
.row-actions.section { flex-wrap: wrap; }
.row-actions button { border: 1px solid var(--line); background: white; border-radius: 4px; padding: 5px 8px; }
.row-actions button.primary { background: var(--ink); color: white; border-color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 7px 11px; font-size: 12px; }
.filters button.active { background: var(--ink); color: white; border-color: var(--ink); }
.content-plan-grid { display: grid; gap: 14px; }
.content-plan-card { background: white; border: 1px solid var(--line); padding: 16px; }
.content-plan-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--soft); padding-bottom: 12px; }
.content-plan-card h3 { margin: 4px 0 0; font-size: 18px; }
.content-date { color: var(--muted); font-size: 12px; font-weight: 800; }
.content-production-block { border-top: 1px solid var(--soft); padding-top: 14px; margin-top: 14px; }
.content-production-block h4 { margin: 3px 0 0; font-size: 15px; }
.content-production-block.missing { background: #fbfcfa; border: 1px dashed var(--line); padding: 12px; }
.content-copy { margin: 12px 0; font-size: 15px; line-height: 1.65; color: #252a27; }
.content-meta-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.content-brief-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.content-brief-block { border: 1px solid var(--line); background: #fbfcfa; padding: 10px; min-width: 0; }
.content-brief-block span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; margin-bottom: 5px; }
.content-brief-block p { margin: 0; color: #39403c; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.content-script { margin-top: 12px; border: 1px solid var(--line); background: #f7f8f6; padding: 12px; }
.content-script b { display: block; font-size: 12px; margin-bottom: 8px; }
.content-script pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #343a36; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(130px,1fr)); overflow-x: auto; background: white; border: 1px solid var(--line); }
.day { min-height: 160px; padding: 12px; border-right: 1px solid var(--line); }
.day:last-child { border-right: 0; }
.day-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.day-card { margin-top: 10px; padding: 10px; border-left: 3px solid var(--accent); background: #f7f8f6; }
.day-card strong { display: block; font-size: 12px; }
.day-card span { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 14px; }
.asset-card { background: white; border: 1px solid var(--line); overflow: hidden; }
.asset-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: center top; display: block; background: var(--soft); }
.image-plain { display: block; width: 100%; padding: 0; border: 0; background: transparent; }
.asset-card-body { padding: 13px; }
.asset-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.asset-card h3 { margin: 8px 0 5px; font-size: 14px; }
.asset-card p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.prompt-box { background: #1e2220; color: #edf0ed; padding: 16px; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.negative-box { margin-top: 10px; border: 1px solid #f1d4d0; background: #fff6f4; color: #8a3028; padding: 12px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 14px; }
.prompt-card { background: white; border: 1px solid var(--line); padding: 16px; }
.prompt-card h3 { margin: 8px 0 4px; font-size: 16px; }
.production-list { display: grid; gap: 14px; }
.production-card { background: white; border: 1px solid var(--line); padding: 18px; }
.production-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.production-card h3 { margin: 8px 0 4px; font-size: 18px; }
.production-card header p { margin: 0; color: var(--muted); font-size: 12px; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px,1fr)); gap: 14px; }
.story-card { background: white; border: 1px solid var(--line); padding: 16px; }
.story-card h3 { margin: 8px 0 4px; font-size: 16px; }
.story-card p { color: #4a4e4a; font-size: 13px; line-height: 1.65; }
.story-thumb { width: 100%; margin: 12px 0; border: 1px solid var(--line); background: var(--soft); min-height: 104px; display: grid; place-items: center; color: var(--muted); font-size: 12px; position: relative; overflow: hidden; padding: 0; }
.story-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.story-thumb span { position: absolute; right: 8px; bottom: 8px; background: rgba(255,255,255,.88); border: 1px solid var(--line); padding: 3px 7px; font-size: 11px; }
.reference-preview { margin: 12px 0; border: 1px solid #d9e4df; background: #f4faf7; padding: 10px; }
.reference-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.reference-preview-head b { font-size: 12px; }
.reference-preview-head span { color: var(--teal); font-size: 11px; font-weight: 800; }
.reference-preview-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.reference-preview-list button { display: grid; gap: 5px; padding: 6px; border: 1px solid var(--line); background: white; text-align: left; }
.reference-preview-list img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--soft); }
.reference-preview-list span { font-size: 10px; line-height: 1.35; color: #39403c; overflow-wrap: anywhere; }
.reference-list { border: 1px solid var(--line); background: #f7f8f6; padding: 12px; display: grid; gap: 9px; }
.reference-list > b { font-size: 13px; }
.reference-option { display: grid; grid-template-columns: auto 46px 1fr; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); background: white; font-weight: 700; }
.reference-option.recommended { border-color: #8bbcb5; background: #f0faf7; }
.reference-option input { width: auto; }
.reference-option img { width: 46px; aspect-ratio: 1; object-fit: cover; background: var(--soft); border: 1px solid var(--line); }
.reference-option span { display: grid; gap: 2px; min-width: 0; }
.reference-option small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.image-lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(10, 12, 11, .82); }
.lightbox-panel { width: min(1180px, 100%); max-height: 94vh; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #111311; color: white; border: 1px solid rgba(255,255,255,.16); box-shadow: var(--shadow); }
.lightbox-panel header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.lightbox-actions { display: flex; align-items: center; gap: 8px; }
.download-button { color: white; text-decoration: none; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); padding: 8px 12px; font-weight: 800; font-size: 12px; }
.download-button:hover { background: rgba(255,255,255,.16); }
.lightbox-panel img { max-width: 100%; max-height: calc(94vh - 64px); object-fit: contain; display: block; background: #0a0c0b; }
.settings-form { display: grid; gap: 14px; }
.inline-check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 700; }
.inline-check input { width: auto; }
.inline-actions { border-top: 0; padding-top: 0; }
.model-list { display: flex; flex-wrap: wrap; gap: 7px; max-height: 260px; overflow-y: auto; align-content: flex-start; }
.model-list span { max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); background: #f7f8f6; border-radius: 4px; color: #39403c; font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.empty { padding: 50px 24px; text-align: center; color: var(--muted); background: white; border: 1px dashed #c9cdc9; }
.action-empty h3 { margin: 0 0 8px; color: var(--ink); }
.action-empty p { max-width: 720px; margin: 0 auto 16px; line-height: 1.7; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 10px 0 10px 28px; border-bottom: 1px solid var(--soft); position: relative; }
.checklist li::before { content: '✓'; position: absolute; left: 2px; color: var(--green); font-weight: 900; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(23,25,24,.4); display: flex; justify-content: flex-end; }
.drawer { width: min(760px, 100%); height: 100%; overflow-y: auto; background: white; box-shadow: var(--shadow); padding: 28px; }
.drawer > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.drawer h2 { margin: 0; }
#drawer-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.drawer-section { border: 1px solid var(--line); background: #fbfcfa; padding: 14px; }
.drawer-section h3 { margin: 0 0 12px; font-size: 14px; }
.advanced-json { border: 1px solid var(--line); background: white; padding: 12px; }
.advanced-json summary { cursor: pointer; font-weight: 800; }
.advanced-json label { display: block; margin-top: 12px; }
.field-full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.help { color: var(--muted); font-size: 11px; line-height: 1.5; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; background: #171918; color: white; padding: 12px 16px; border-radius: 6px; box-shadow: var(--shadow); }
.character-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.character-card { background: white; border: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: 70px 1fr; gap: 12px; }
.character-card img { width: 70px; height: 92px; object-fit: cover; background: var(--soft); }
.character-card h3 { margin: 4px 0; }
.character-card p { color: var(--muted); font-size: 11px; line-height: 1.45; }
@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .hero { grid-template-columns: .9fr 1.1fr; }
  .hero-copy { padding: 28px; }
  .hero-copy h1 { font-size: 38px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: -250px; width: 230px; transition: left .2s; }
  .sidebar.open { left: 0; }
  .topbar { padding: 0 15px; height: 64px; }
  .menu-toggle { display: block; }
  .workspace { padding: 20px 15px 50px; }
  .hero { grid-template-columns: 1fr; }
  .hero-media, .hero-media img { min-height: 360px; }
  .hero-copy { padding: 26px 22px; }
  .metric-grid, .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .login-panel { padding: 30px 24px; }
}
