:root {
  --bg: #0F1117;
  --bg-rgb: 15,17,23;
  --sidebar: #161823;
  --card: #1E2030;
  --card-hover: #252840;
  --border: #2A2D3F;
  --text: #E8EAF0;
  --text-muted: #8B8FA8;
  --text-dim: #5C6178;
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #4834D4;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #FF6B6B;
  --info: #74B9FF;
  --pink: #FD79A8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.4);
  --transition: .18s ease;
  --transition-fast: .12s ease;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.sidebar { width: 220px; min-width: 220px; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 0; }
.sidebar-logo { padding: 20px 18px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.sidebar-logo .logo-icon { width: 38px; height: 38px; flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; }
.sidebar-logo .logo-icon img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: 50%; filter: blur(2px); }
.sidebar-logo .logo-icon .logo-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); letter-spacing: -0.5px; pointer-events: none; }
.sidebar-logo .logo-text { font-size: 13px; font-weight: 700; line-height: 1.3; }
.sidebar-nav { flex:1; padding: 12px 8px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; cursor: pointer; transition: all var(--transition); font-size: 13px; color: var(--text-muted); margin-bottom: 2px; }
.nav-item:hover { background: var(--card-hover); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-dim); }
.main { flex:1; overflow-y: auto; }
.main-header { position: sticky; top: 0; z-index: 10; background: rgba(var(--bg-rgb), 0.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; }
.main-header h1 { font-size: 18px; font-weight: 700; }
.main-header .subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.content { padding: 24px 28px 80px; } /* #523（#10）全局底部留白约2cm，避免内容贴底 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; transition: border-color var(--transition), box-shadow var(--transition); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.data-table th { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { font-size: 13px; }
.data-table tr:hover { background: var(--card-hover); }
.card:hover { border-color: var(--primary-dark); box-shadow: var(--shadow-hover); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden; transition: all var(--transition); }
.stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.stat-card.s-green::before { background: var(--success); }
.stat-card.s-yellow::before { background: var(--warning); }
.stat-card.s-pink::before { background: var(--pink); }
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; }
.stat-card .stat-trend { font-size: 11px; margin-top: 4px; }
.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.project-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: all var(--transition); }
.project-card:hover { border-color: var(--primary); background: var(--card-hover); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.project-card .pc-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px; }
.project-card .pc-title { font-size: 15px; font-weight: 700; }
.project-card .pc-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.project-card .pc-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-dim); }
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; }
.badge-green { background: rgba(0,184,148,0.15); color: var(--success); }
.badge-yellow { background: rgba(253,203,110,0.15); color: var(--warning); }
.badge-blue { background: rgba(116,185,255,0.15); color: var(--info); }
.badge-red { background: rgba(255,107,107,0.15); color: var(--danger); }
.badge-purple { background: rgba(108,92,231,0.15); color: var(--primary-light); }
.badge-pink { background: rgba(253,121,168,0.15); color: var(--pink); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--card-hover); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea { width: 100%; background: var(--sidebar); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; color: var(--text); font-size: 13px; font-family: inherit; outline: none; transition: border-color var(--transition); }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.btn { padding: 8px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: all var(--transition); font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.avatar-group { display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; border: 2px solid var(--card); margin-left: -6px; }
.avatar:first-child { margin-left: 0; }
.modal-overlay { display: none; position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.6); z-index: 100; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px; width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close { font-size: 22px; cursor: pointer; color: var(--text-muted); background:none; border:none; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
/* 文件上传UI */
.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-row .form-input { flex: 1; }
.upload-btn { white-space: nowrap; flex-shrink: 0; }
.upload-progress { font-size: 12px; margin-top: 4px; min-height: 18px; }
.upload-progress.success { color: var(--success, #2ed573); }
.upload-progress.error { color: var(--danger, #ff4757); }
.upload-progress.uploading { color: var(--info, #3742fa); }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -21px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--border); border: 2px solid var(--card); }
.timeline-item.active::before { background: var(--primary); }
.timeline-item.done::before { background: var(--success); }
.timeline-item .ti-time { font-size: 11px; color: var(--text-dim); }
.timeline-item .ti-title { font-size: 13px; font-weight: 600; margin: 2px 0; }
.timeline-item .ti-desc { font-size: 12px; color: var(--text-muted); }
.script-scene { background: var(--sidebar); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.script-scene .ss-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.script-scene .ss-label { font-size: 12px; font-weight: 700; color: var(--primary-light); }
.script-scene .ss-content { font-size: var(--app-font-size, 13px); font-family: var(--app-font-family, inherit); line-height: 1.7; color: var(--text); white-space: pre-wrap; }
.script-scene .ss-content.collapsed { max-height: 6.8em; overflow: hidden; position: relative; }
.script-scene .ss-content.collapsed::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1.5em; background: linear-gradient(transparent, var(--sidebar)); }
.script-scene .ss-expand-btn { display: inline-block; padding: 3px 14px; font-size: 12px; font-weight: 600; color: var(--primary-light); cursor: pointer; user-select: none; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; transition: all 0.2s; }
.script-scene .ss-expand-btn:hover { text-decoration: underline; background: var(--card); border-color: var(--primary-light); }
.script-scene .ss-actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h2 { font-size: 16px; font-weight: 700; }
/* 项目资产折叠条 — 强提示可点击 */
.asset-toggle { user-select: none; cursor: pointer; -webkit-tap-highlight-color: rgba(108,92,231,0.25);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0;
  transition: var(--transition); }
.asset-toggle:hover { background: rgba(108,92,231,0.08); border-color: rgba(108,92,231,0.4); box-shadow: 0 1px 6px rgba(108,92,231,0.12); }
.asset-toggle:active { background: rgba(108,92,231,0.14); }
.asset-chevron { display: inline-block; font-size: 15px; color: var(--primary-light); margin-left: 4px; transition: transform .2s ease; vertical-align: middle; }
.asset-hint { font-size: 12px; font-weight: 600; color: var(--primary-light); margin-left: 8px; letter-spacing: .3px; vertical-align: middle; }

.role-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; }
.role-card .rc-avatar { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0; }
.role-card .rc-info { flex: 1; }
.role-card .rc-name { font-size: 14px; font-weight: 700; }
.role-card .rc-role { font-size: 12px; color: var(--text-muted); }
.role-card .rc-stats { display: flex; gap: 16px; font-size: 11px; color: var(--text-dim); }
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 20px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all var(--transition); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.pin-btn { background: none; border: none; cursor: pointer; font-size: 14px; opacity: 0.5; transition: opacity .15s; padding: 2px 4px; }
.pin-btn:hover { opacity: 1; }
.pin-btn.pinned { opacity: 1; }
.delete-btn { background: none; border: none; cursor: pointer; font-size: 13px; opacity: 0.4; transition: opacity .15s; padding: 2px 4px; color: var(--danger); }
.delete-btn:hover { opacity: 1; }
.project-card.pinned { border-color: var(--warning); background: linear-gradient(135deg, var(--card), rgba(253,203,110,0.04)); }
.project-card .pc-actions { display: flex; gap: 4px; margin-left: 8px; }
.import-hint { background: var(--sidebar); border: 1px dashed var(--border); border-radius: 8px; padding: 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.8; }
.import-hint code { background: var(--bg); padding: 1px 6px; border-radius: 3px; font-size: 11px; color: var(--primary-light); }
.identity-modal .modal { max-width: 480px; }
.identity-welcome { text-align: center; padding: 20px 0 16px; }
.identity-welcome .iw-icon { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: linear-gradient(135deg, #FF6B6B, #FFA94D, #FFD43B, #51CF66, #339AF0, #9775FA); }
.identity-welcome .iw-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.identity-welcome .iw-sub { font-size: 13px; color: var(--text-muted); }
.identity-tabs { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.identity-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; font-size: 13px; color: var(--text-muted); transition: all .15s; background: transparent; border: none; }
.identity-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.identity-tab { border-right: 1px solid var(--border); }
.identity-tab:last-child { border-right: none; }
.identity-pane { display: none; }
.identity-pane.active { display: block; }
.identity-hint { font-size: 12px; color: var(--info); text-align: center; padding: 8px 0 0; margin-top: 8px; }
body.visitor-mode .btn-primary, body.visitor-mode .btn-ghost, body.visitor-mode .pin-btn, body.visitor-mode .delete-btn, body.visitor-mode .rc-delete-btn { display: none !important; }
body.visitor-mode #identityModal .btn-primary,
body.visitor-mode #identityModal .btn-ghost { display: inline-flex !important; }
body.visitor-mode .visitor-banner { display: flex !important; }
.visitor-banner { display: none; align-items: center; gap: 8px; padding: 6px 14px; margin-bottom: 12px; background: rgba(116,185,255,0.1); border: 1px solid rgba(116,185,255,0.3); border-radius: 8px; font-size: 12px; color: var(--info); }
.identity-member-item.selected { border-color: var(--primary); background: rgba(108,92,231,0.1); }
.role-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.role-pick-item { display: flex; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 12px; transition: all var(--transition); background: var(--card); }
.role-pick-item:hover { border-color: var(--primary); }
.role-pick-item.selected { border-color: var(--primary); background: rgba(108,92,231,0.1); }
.role-pick-item .rpi-icon { font-size: 16px; }
.sidebar-profile { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background var(--transition); }
.sidebar-profile:hover { background: var(--card-hover); }
.sidebar-profile .sp-avatar { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; }
.sidebar-profile .sp-info { flex: 1; min-width: 0; }
.sidebar-profile .sp-name { font-size: 13px; font-weight: 600; }
.sidebar-profile .sp-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .sp-role-link { color: var(--primary); font-size: 10px; } /* #526（#19）身份与"点击进入个人中心"分两行 */
.sidebar-profile .sp-switch { font-size: 16px; color: var(--text-dim); }
.role-card.is-me { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.role-card.is-me .rc-me-badge { display:inline-block; background: var(--primary); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 10px; font-weight: 600; vertical-align: middle; margin-left: 6px; }
/* mobile identity layout moved to main @media block below */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.page { display: none; }
.page.active { display: block; }
.mobile-menu-btn { display: none; background: var(--card); border: 1px solid var(--border); border-radius: 8px; width: 38px; height: 38px; font-size: 20px; color: var(--text); cursor: pointer; flex-shrink: 0; align-items: center; justify-content: center; position: relative; }
.menu-hint-finger { display: none; position: absolute; right: -28px; top: -4px; font-size: 20px; animation: fingerPoint 1.2s ease-in-out infinite; pointer-events: none; z-index: 5; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); transform: scaleX(-1); }
.header-left { display: flex; align-items: center; gap: 12px; }
.mobile-logo-center { display: none; align-items: center; justify-content: center; position: relative; cursor: pointer; width: 36px; height: 36px; flex-shrink: 0; }
.mobile-logo-center img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; filter: blur(2px); }
.mobile-logo-center .mlc-badge { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); letter-spacing: -0.5px; pointer-events: none; }
@keyframes fingerPoint { 0%,100% { transform: scaleX(-1) translateX(0) rotate(0deg); } 50% { transform: scaleX(-1) translateX(6px) rotate(10deg); } }
.sidebar-backdrop { display: none; position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.5); z-index: 49; }
/* ===== MOBILE RESPONSIVE BASELINE v3 ===== */
/* Based on: 8pt spacing grid, 44px touch targets, Chinese typography (1.5-1.8 line-height) */
@media (max-width: 768px) {
  /* --- Layout Structure --- */
  body { flex-direction: column; }
  .mobile-menu-btn { display: flex; }
  .menu-hint-finger { display: block; }
  .mobile-logo-center { display: flex; }
  .header-left .subtitle { display: none; }
  .header-left h1 { font-size: 17px; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 2px 0 20px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }

  /* --- Header + Safe Area --- */
  .main-header {
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .main-header h1 { font-size: 17px; }

  /* --- Content Area --- */
  .content {
    padding: 16px;
    padding-bottom: max(80px, calc(64px + env(safe-area-inset-bottom))); /* #523 移动端底部留白约2cm */
  }

  /* --- Typography: Font Scale (min 12px, body 14px, title 17px) --- */
  .card { padding: 16px; margin-bottom: 12px; }
  .card-title { font-size: 14px; margin-bottom: 12px; }
  .section-header { margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
  .section-header h2 { font-size: 15px; }
  .badge { font-size: 12px; padding: 3px 10px; }

  /* --- Stats Grid --- */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-label { font-size: 12px; margin-bottom: 4px; }
  .stat-card .stat-value { font-size: 22px; }
  .stat-card .stat-trend { font-size: 11px; }

  /* --- Projects / Card Grid --- */
  .projects-grid { grid-template-columns: 1fr; gap: 12px; }
  .project-card { padding: 14px; }
  .project-card .pc-title { font-size: 15px; }
  .project-card .pc-desc { font-size: 13px; line-height: 1.6; }
  .project-card .pc-footer { font-size: 12px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }

  /* --- Tables --- */
  .data-table th { font-size: 12px; padding: 8px 10px; }
  .data-table td { font-size: 13px; padding: 10px; }
  table { font-size: 13px; }
  th { padding: 8px 10px; font-size: 12px; }
  td { padding: 10px; }

  /* --- Forms (44px min touch height) --- */
  .form-group { margin-bottom: 14px; }
  .form-group label { font-size: 13px; margin-bottom: 8px; }
  .form-input, .form-select, .form-textarea {
    padding: 12px 14px; font-size: 14px; min-height: 44px;
  }
  .form-textarea { min-height: 80px; }
  .form-row { flex-direction: column; gap: 0; }

  /* --- 审核页三栏（#635 移动端响应式：竖排堆叠，缩略图条转横向滑动）--- */
  .rv3col { flex-direction: column; }
  .rv3col > .rv-thumbs { flex-direction: row !important; width: 100% !important; max-height: none !important; overflow-x: auto !important; padding-right: 0 !important; }
  .rv3col > .rv-main { min-width: 0 !important; width: 100% !important; }
  .rv3col > .rv-side { width: 100% !important; }

  /* --- Buttons (44px min touch target) --- */
  .btn {
    padding: 10px 18px; font-size: 14px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }

  /* --- Sidebar Nav (touch friendly) --- */
  .sidebar-nav { padding: 8px; }
  .sidebar-logo { padding: 16px 14px 12px; }
  .sidebar-logo .logo-text { font-size: 14px; }
  .nav-item { padding: 12px 14px; font-size: 14px; min-height: 44px; }
  .nav-item .icon { font-size: 18px; width: 22px; }
  .sidebar-footer {
    font-size: 12px; padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .sidebar-profile { padding: 10px 14px; min-height: 44px; }
  .sidebar-profile .sp-name { font-size: 14px; }
  .sidebar-profile .sp-role { font-size: 12px; }

  /* --- Tabs (44px touch) --- */
  .tabs { margin-bottom: 16px; }
  .tab { padding: 12px 16px; font-size: 14px; min-height: 44px; }

  /* --- Avatars --- */
  .avatar { width: 30px; height: 30px; font-size: 12px; }

  /* --- Modal --- */
  .modal { width: 94%; padding: 20px; max-height: 88vh; border-radius: 12px; }
  .modal-header h2 { font-size: 17px; }
  .modal-footer { gap: 8px; }
  .modal-footer .btn { flex: 1; }

  /* --- Script Scene (Chinese line-height 1.8) --- */
  .script-scene { padding: 14px; margin-bottom: 10px; }
  .script-scene .ss-label { font-size: 13px; }
  .script-scene .ss-content { font-size: 14px; line-height: 1.8; }
  .script-scene .ss-content.collapsed { max-height: 7.2em; }
  .script-scene .ss-expand-btn { padding: 6px 14px; font-size: 13px; min-height: 36px; }
  /* Script actions: 6 buttons → 2 rows of 3 */
  .script-scene .ss-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .script-scene .ss-actions { flex-wrap: wrap; gap: 6px; }
  .script-scene .ss-actions .btn { flex: 1 1 calc(33.33% - 4px); min-width: 0; }

  /* --- Emoji Icons: hidden on mobile, only text shown --- */
  .emoji-ic { display: none !important; }

  /* --- Anti-overflow: prevent horizontal scroll --- */
  .main { overflow-x: hidden; }
  .content { overflow-x: hidden; max-width: 100%; }
  .card { max-width: 100%; }
  .table-wrap { max-width: 100%; }

  /* --- #5 媒体与长文本防溢出（全量兜底） --- */
  img, video, iframe, canvas { max-width: 100%; height: auto; }
  .content, .card { overflow-wrap: break-word; }
  pre, code { white-space: pre-wrap !important; word-break: break-word; overflow-wrap: anywhere; }
  .table-wrap, .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* --- Timeline --- */
  .timeline-item .ti-title { font-size: 14px; }
  .timeline-item .ti-desc { font-size: 13px; line-height: 1.5; }
  .timeline-item .ti-time { font-size: 12px; }

  /* --- Role Cards --- */
  .role-card { padding: 14px; min-height: 44px; }
  .role-card .rc-name { font-size: 14px; }
  .role-card .rc-role { font-size: 13px; }
  /* #12 团队卡右上角编辑/删除按钮为绝对定位，给内容留右边距防重叠 */
  .role-card .rc-info { padding-right: 52px; }
  .role-card .rc-stats { padding-right: 52px; }

  /* --- Identity Modal --- */
  .identity-member-list { grid-template-columns: 1fr; }
  .identity-member-item { padding: 12px; min-height: 44px; }
  .identity-member-item .imi-name { font-size: 14px; }
  .identity-member-item .imi-role { font-size: 12px; }
  .role-picker { grid-template-columns: 1fr 1fr; }
  .role-pick-item { padding: 12px; min-height: 44px; font-size: 13px; }

  /* --- Empty State --- */
  .empty-state { padding: 32px 16px; }
  .empty-state .icon { font-size: 36px; }
  .empty-state .text { font-size: 14px; }

  /* --- Login Overlay --- */
  .login-box { width: 94%; padding: 28px 20px; }
  .login-logo .login-title { font-size: 18px; }
  .login-logo .login-sub { font-size: 12px; }
  .login-tab { padding: 12px 0; font-size: 14px; }
  .login-field label { font-size: 14px; margin-bottom: 8px; }
  .login-input { height: 48px; font-size: 16px; }
  .login-btn-code { height: 48px; font-size: 14px; padding: 0 16px; }
  .login-btn { height: 48px; font-size: 16px; }
  .login-error { font-size: 13px; }
  .login-toggle { font-size: 13px; }
  .login-hint { font-size: 12px; }

  /* --- Visitor Banner --- */
  .visitor-banner { font-size: 13px; padding: 8px 14px; }

  /* --- Import Hint --- */
  .import-hint { padding: 12px; font-size: 13px; line-height: 1.7; }
  .import-hint code { font-size: 12px; }

  /* --- Conflict Banner --- */
  .conflict-banner { padding: 12px; }
  .conflict-banner .cb-title { font-size: 13px; }
  .conflict-banner .cb-desc { font-size: 12px; line-height: 1.6; }

  /* --- Hide cluttered elements --- */
  .main-header .btn.btn-ghost { display: none; }

  /* --- Editor Textarea --- */
  #sContent { min-height: 200px !important; font-size: 14px !important; line-height: 1.8 !important; }

  /* --- Profile (个人中心) mobile --- */
  .profile-ucard { flex-wrap: wrap !important; gap: 14px !important; padding: 16px !important; }
  .profile-uinfo { flex: 1 1 auto !important; min-width: 0 !important; }
  .profile-ubtns { flex: 1 1 100% !important; }
  .profile-ubtns .btn { flex: 1 1 auto !important; }
  .profile-tabs { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; gap: 6px !important; }
  .profile-tabs .btn { flex: 0 0 auto !important; white-space: nowrap !important; }
  /* #6：移动端个人中心不显示 Emoji（Tab 图标 + 分享按钮图标） */
  .profile-ucard .emoji-ic, .profile-tabs .emoji-ic { display: none !important; }
  /* --- Homepage footer breathing room (mobile) --- */
  #page-dashboard { padding-bottom: 36px; }
}
.loading-overlay { position: fixed; top:0; left:0; right:0; bottom:0; background: var(--bg); z-index: 999; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
.loading-overlay .text { font-size: 14px; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LOGIN OVERLAY ===== */
.login-overlay { position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;background:var(--bg);background:radial-gradient(ellipse at 50% 30%,#1a1d2e 0%,#0F1117 70%); }
.login-overlay.hidden { display:none; }
.login-box { width:360px;max-width:90vw;background:var(--card);border:1px solid var(--border);border-radius:16px;padding:36px 32px;box-shadow:0 8px 40px rgba(0,0,0,0.4); }
.login-logo { text-align:center;margin-bottom:28px; }
.login-logo img { width:56px;height:56px;border-radius:14px;object-fit:cover;filter:blur(1px); }
.login-logo .login-title { font-size:20px;font-weight:700;color:var(--text);margin-top:12px; }
.login-tabs { display:flex;gap:0;margin-bottom:20px;border-bottom:1px solid var(--border); }
.login-tab { flex:1;padding:10px 0;background:none;border:none;color:var(--text-muted);font-size:13px;font-weight:600;cursor:pointer;border-bottom:2px solid transparent;transition:all .15s; }
.login-tab.active { color:var(--primary);border-bottom-color:var(--primary); }
.login-tab:hover { color:var(--text); }
.login-pane { display:none; }
.login-pane.active { display:block; }
.login-field { margin-bottom:16px; }
.login-field label { display:block;font-size:13px;color:var(--text-muted);margin-bottom:6px; }
.login-input { width:100%;height:44px;background:var(--bg);border:1px solid var(--border);border-radius:10px;color:var(--text);padding:0 14px;font-size:15px;outline:none;transition:border .2s; }
.login-input:focus { border-color:var(--primary); }
.login-input::placeholder { color:var(--text-dim); }
.login-code-row { display:flex;gap:10px; }
.login-code-row .login-input { flex:1; }
.login-btn-code { flex-shrink:0;height:44px;padding:0 16px;background:var(--card);border:1px solid var(--primary);border-radius:10px;color:var(--primary);font-size:13px;cursor:pointer;white-space:nowrap;transition:all .2s; }
.login-btn-code:hover { background:rgba(108,92,231,0.1); }
.login-btn-code:disabled { opacity:0.5;cursor:not-allowed; }
.login-btn { width:100%;height:46px;background:var(--primary);border:none;border-radius:10px;color:#fff;font-size:15px;font-weight:600;cursor:pointer;margin-top:8px;transition:all .2s; }
.login-btn:hover { background:var(--primary-dark); }
.login-btn:disabled { opacity:0.5;cursor:not-allowed; }
.login-error { color:var(--danger);font-size:13px;text-align:center;margin-top:12px;min-height:18px; }
.login-hint { text-align:center;font-size:11px;color:var(--text-dim);margin-top:20px;padding-top:16px;border-top:1px solid var(--border); }
/* ===== 亮色主题 =====
   基础规则全量使用 CSS 变量，故只需在 :root[data-theme="light"] 覆盖变量即可自动跟随。
   以下仅保留基础规则中写死颜色的必要覆盖（如登录页渐变、亮色滚动条）。
*/
:root[data-theme="light"] {
  --bg-rgb: 244,246,250;
  --bg: #f4f6fa; --card: #ffffff; --border: #e2e8f0; --text: #1a2332;
  --text-dim: #64748b; --text-muted: #94a3b8; --primary: #3b82f6; --primary-light: #6ea8fe;
  --primary-dark: #1d4ed8; --info: #0ea5e9; --success: #16a34a; --warning: #d97706; --danger: #dc2626;
  --green: #22c55e; --red: #ef4444; --yellow: #f59e0b; --blue: #3b82f6; --pink: #ec4899;
  /* #525（#17）亮色黑框修复：这三个变量此前漏覆盖，导致表单输入框/剧本卡/侧栏等仍是暗色 */
  --sidebar: #ffffff; --card-hover: #eef2f9; --shadow: 0 4px 20px rgba(30,40,60,0.10);
  --shadow-hover: 0 8px 30px rgba(30,40,60,0.16);
}
/* 登录页渐变跟随主题（基础规则写死了深色椭圆渐变） */
:root[data-theme="light"] .login-overlay { background: radial-gradient(ellipse at 50% 30%, #ffffff 0%, #e9eef5 70%); }
/* 亮色滚动条 */
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== 图文列表三板块（v2.12：待审核 / 已打回 / 已完成，限高可滚动） ===== */
.imglist-board { border:1px solid var(--border); border-radius:var(--radius); padding:10px; margin-bottom:12px; background:var(--sidebar); }
.imglist-board-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; padding:0 2px; }
.imglist-board-title { font-size:13px; font-weight:700; }
.imglist-board-count { font-size:11px; font-weight:700; color:var(--text-dim); background:var(--card-hover); border-radius:999px; padding:1px 8px; min-width:20px; text-align:center; }
.imglist-scroll { max-height:300px; overflow-y:auto; overflow-x:hidden; padding:2px; display:flex; flex-direction:column; gap:8px; -webkit-overflow-scrolling:touch; }
.imglist-card { margin-bottom:0; padding:10px 12px; cursor:pointer; transition:border-color var(--transition), background var(--transition); }
.imglist-card:hover { border-color:var(--primary); background:var(--card-hover); }
.imglist-card-top { display:flex; justify-content:space-between; align-items:center; gap:6px; margin-bottom:4px; }
.imglist-card-name { font-size:14px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.imglist-card-type { font-size:11px; color:var(--text-dim); margin-bottom:3px; }
.imglist-card-meta { font-size:11px; color:var(--text-muted); display:flex; justify-content:space-between; gap:6px; }
.imglist-card-meta2 { font-size:11px; color:var(--text-dim); margin-top:2px; }
.imglist-empty { font-size:12px; color:var(--text-muted); text-align:center; padding:8px 0; }
/* PC 端三板块横向排列（移动端改竖向，见末尾媒体查询） */
.imglist-boards { display:flex; gap:12px; align-items:flex-start; }
.imglist-boards .imglist-board { flex:1; min-width:0; margin-bottom:0; }


/* ===== 侧栏主题切换开关（替代原先悬浮右下角的 yj-theme-toggle） ===== */
.sidebar-theme { display:flex; align-items:center; gap:10px; margin:0 12px 6px; padding:9px 14px; border-radius:10px; cursor:pointer; color:var(--text-muted); font-size:13px; transition:all .15s; user-select:none; -webkit-tap-highlight-color:transparent; }
.sidebar-theme:hover { background:var(--card-hover); color:var(--text); }
.sidebar-theme:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.sidebar-theme .st-ico { font-size:16px; width:20px; text-align:center; flex-shrink:0; }
.sidebar-theme .st-txt { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-theme .st-switch { position:relative; width:34px; height:18px; border-radius:10px; background:var(--border); transition:background .2s; flex-shrink:0; }
.sidebar-theme .st-switch .st-knob { position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .2s; }
:root[data-theme="light"] .sidebar-theme .st-switch { background:var(--primary); }
:root[data-theme="light"] .sidebar-theme .st-switch .st-knob { transform:translateX(16px); }

/* ===== 可访问性：焦点可见 & 减少动画偏好 ===== */
:focus-visible { outline:2px solid var(--primary); outline-offset:2px; border-radius:4px; }
.form-input:focus-visible, .form-select:focus-visible, .form-textarea:focus-visible, .login-input:focus-visible { outline:none; } /* 已有 border 高亮 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* ===== 图文列表三板块：移动端不贴边，便于滑动（v2.12） ===== */
@media (max-width: 768px) {
  .imglist-boards { flex-direction:column; }
  .imglist-board { margin-left:2px; margin-right:2px; }
  .imglist-scroll { max-height:56vh; padding:4px 12px 4px 4px; }
}