:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2533;
  --muted: #6b7280;
  --line: #e5e8ef;
  --brand: #3b5bdb;
  --brand-soft: #e7ecff;
  --ok: #2f9e44;
  --warn: #e8590c;
  --shadow: 0 2px 10px rgba(20,30,60,.06);
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--brand); }
/* 确保带 hidden 属性的元素（弹窗遮罩 / 提示条）真正隐藏，避免被类样式 display 覆盖 */
[hidden] { display: none !important; }

/* 登录 */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #4c6ef5, #7048e8); }
.login-card { background: #fff; width: 340px; padding: 32px 28px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.2); text-align: center; }
.login-logo { font-size: 44px; }
.login-card h1 { margin: 6px 0 2px; font-size: 22px; }
.login-sub { color: var(--muted); margin: 0 0 18px; }
.login-card label { display: block; text-align: left; margin: 12px 0; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.err { color: #e03131; min-height: 18px; font-size: 13px; margin: 8px 0 0; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 8px; padding: 10px; line-height: 1.7; }

/* 顶栏 */
.topbar { height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 16px; }
.user-box { display: flex; align-items: center; gap: 12px; color: var(--muted); }
#who { font-size: 13px; }

/* 布局 */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidenav { width: 188px; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; flex-shrink: 0; }
.sidenav button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 11px 14px; border-radius: 9px; color: var(--ink); font-size: 14px; cursor: pointer; margin-bottom: 4px; }
.sidenav button:hover { background: var(--bg); }
.sidenav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.content { flex: 1; padding: 20px 24px; overflow: auto; }

/* 通用 */
h2.page-title { margin: 0 0 4px; font-size: 19px; }
.page-desc { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.btn { background: var(--brand); color: #fff; border: none; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #e03131; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
label.fld { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: var(--bg); color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* 状态徽章 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.badge.todo { background: #fff0e6; color: var(--warn); }
.badge.doing { background: var(--brand-soft); color: var(--brand); }
.badge.done { background: #e6fcf0; color: var(--ok); }

/* 甘特图 */
.gantt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 20px; cursor: pointer; font-size: 13px; background: var(--panel); user-select: none; }
.chip input { width: auto; margin: 0; }
.chip .dot { width: 10px; height: 10px; border-radius: 3px; }
.gantt-scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.gantt-inner { position: relative; }
.gantt-header { display: flex; position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5; }
.gantt-head-label { width: 220px; flex-shrink: 0; padding: 10px 12px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line); }
.gantt-months { position: relative; height: 38px; }
.gantt-month { position: absolute; top: 0; height: 38px; border-left: 1px solid var(--line); padding: 10px 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.gantt-row { display: flex; border-bottom: 1px solid var(--line); }
.gantt-row:hover { background: #fafbff; }
.gantt-label { width: 220px; flex-shrink: 0; padding: 10px 12px; border-right: 1px solid var(--line); position: sticky; left: 0; background: var(--panel); z-index: 4; }
.gantt-row:hover .gantt-label { background: #fafbff; }
.gantt-label .t { font-weight: 600; }
.gantt-label .s { color: var(--muted); font-size: 12px; margin-top: 3px; }
.gantt-track { position: relative; }
.gantt-bar { position: absolute; top: 9px; height: 26px; border-radius: 7px; color: #fff; font-size: 12px; display: flex; align-items: center; padding: 0 8px; cursor: pointer; white-space: nowrap; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.gantt-bar:hover { filter: brightness(1.06); }
.month-line { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #eef0f5; }

/* 作品网格 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 130px; object-fit: cover; display: block; }
.thumb .meta { padding: 8px; font-size: 12px; color: var(--muted); }
.chapter-block { margin-bottom: 22px; }
.chapter-block h3 { border-left: 4px solid var(--brand); padding-left: 8px; margin: 0 0 10px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(20,28,50,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-box { background: #fff; width: 460px; max-width: 92vw; max-height: 88vh; overflow: auto; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-x { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 16px 18px; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #1f2533; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* 剧本/分镜 文档 */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.doc-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.doc-thumb { height: 140px; background: #f0f2f7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ver-badge { display: inline-block; font-size: 11px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 1px 7px; border-radius: 10px; vertical-align: middle; margin-left: 4px; }
.hist-list { display: flex; flex-direction: column; }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.hist-row:last-child { border-bottom: none; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-file { padding: 20px; color: var(--brand); font-weight: 600; }
.doc-meta { padding: 10px; font-size: 12px; }
.doc-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }

/* 美术参考 */
.refs-layout { display: flex; gap: 16px; align-items: flex-start; }
.board-side { width: 220px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.board-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 10px; }
.board-list { display: flex; flex-direction: column; gap: 6px; }
.board-item { padding: 9px 11px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.board-item:hover { background: var(--bg); }
.board-item.active { background: var(--brand-soft); color: var(--brand); border-color: #c7d2fe; font-weight: 600; }
.board-main { flex: 1; min-width: 0; }
.board-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
