:root {
  --bg: #f4f5f7;
  --card: #fff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #e11d48;
  --primary-hover: #be123c;
  --sidebar: #111827;
  --sidebar-text: #d1d5db;
  --sidebar-active: #fff;
  --ok: #059669;
  --warn: #d97706;
  --info: #2563eb;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --studio-bg: #0f1115;
  --studio-panel: #171a21;
  --studio-card: #1e2330;
  --studio-border: #2a3142;
  --studio-text: #e5e7eb;
  --studio-muted: #9ca3af;
  --studio-accent: #8b5cf6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 20px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #1f2937; color: #fff; font-weight: 700; font-size: 15px; }
.sidebar-brand .logo { width: 28px; height: 20px; background: #ff0000; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-brand .logo svg { width: 14px; height: 14px; }
.nav-section { padding: 14px 18px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--sidebar-text); font-size: 13px; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: #1f2937; color: #fff; }
.sidebar-nav a.active { background: #1f2937; color: var(--sidebar-active); border-left-color: var(--primary); }
.sidebar-nav .sub { padding-left: 36px; font-size: 12px; color: #9ca3af; }
.sidebar-nav .sub.active { color: #fff; }
.sidebar-footer { margin-top: auto; padding: 14px 18px; border-top: 1px solid #1f2937; font-size: 12px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
.content { padding: 20px 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--muted); cursor: pointer; font-size: 13px; }
.tab:hover { border-color: #cbd5e1; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { height: 34px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; background: #fff; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--text); }
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-danger { color: var(--primary); border-color: #fecdd3; }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: 13px; }
table.data th { background: #fafafa; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
table.data tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: #f3f4f6; color: #374151; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.title { background: #dbeafe; color: #1e40af; }
.badge.translate { background: #ede9fe; color: #5b21b6; }
.badge.published { background: #d1fae5; color: #065f46; }
.cover { width: 64px; height: 40px; background: #e5e7eb; border-radius: 4px; object-fit: cover; display: block; }
.cover.ph { display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 11px; }
.muted { color: var(--muted); }
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.alert-error { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-mask.show { display: flex; }
.modal { background: #fff; width: min(640px, 92vw); max-height: 90vh; overflow: auto; border-radius: 10px; padding: 20px; }
.modal h3 { margin: 0 0 14px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.form-row textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#0f172a,#1e293b); }
.login-card { width: 380px; background: #fff; border-radius: 12px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-card .btn-primary { width: 100%; height: 40px; justify-content: center; margin-top: 8px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card { padding: 16px; cursor: pointer; transition: border-color .15s; }
.project-card:hover { border-color: #c4b5fd; }
.project-card h3 { margin: 0 0 6px; font-size: 15px; }
.stub-box { padding: 48px; text-align: center; color: var(--muted); }
/* Studio dark editor */
body.studio-dark { background: var(--studio-bg); color: var(--studio-text); }
body.studio-dark .layout { background: var(--studio-bg); }
.studio-shell { display: flex; flex-direction: column; height: 100vh; background: var(--studio-bg); color: var(--studio-text); }
.studio-top { height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--studio-border); background: var(--studio-panel); }
.studio-top a { color: var(--studio-muted); }
.studio-body { flex: 1; display: grid; grid-template-columns: 200px 1fr 320px; min-height: 0; }
.studio-left, .studio-right { background: var(--studio-panel); border-color: var(--studio-border); overflow: auto; }
.studio-left { border-right: 1px solid var(--studio-border); padding: 12px; }
.studio-right { border-left: 1px solid var(--studio-border); padding: 12px; }
.studio-center { overflow: auto; padding: 16px; }
.ep-item { padding: 10px 12px; border-radius: 8px; margin-bottom: 6px; cursor: pointer; color: var(--studio-muted); border: 1px solid transparent; }
.ep-item:hover, .ep-item.active { background: var(--studio-card); color: #fff; border-color: var(--studio-border); }
.scene-card { display: grid; grid-template-columns: 120px 1fr; gap: 12px; background: var(--studio-card); border: 1px solid var(--studio-border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.scene-thumb { width: 120px; height: 68px; background: #0b0d12; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--studio-muted); font-size: 11px; overflow: hidden; }
.scene-thumb img { width: 100%; height: 100%; object-fit: cover; }
.scene-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.scene-meta select, .scene-meta input { background: #0f1115; border: 1px solid var(--studio-border); color: #fff; border-radius: 6px; padding: 4px 8px; height: 30px; }
.scene-text { width: 100%; min-height: 60px; background: #0f1115; border: 1px solid var(--studio-border); color: #fff; border-radius: 6px; padding: 8px; }
.studio-right label { display: block; font-size: 12px; color: var(--studio-muted); margin: 10px 0 4px; }
.studio-right textarea, .studio-right input, .studio-right select { width: 100%; background: #0f1115; border: 1px solid var(--studio-border); color: #fff; border-radius: 6px; padding: 8px; }
.studio-right textarea { min-height: 120px; }
.btn-accent { background: var(--studio-accent); border-color: var(--studio-accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.08); }
.settings-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.settings-tabs .tab { background: var(--studio-card); border-color: var(--studio-border); color: var(--studio-muted); }
.settings-tabs .tab.active { background: var(--studio-accent); border-color: var(--studio-accent); color: #fff; }
