/* ============================================================
   视频制片台 · Design Tokens — 借鉴 EV视界管理后台风格（浅色）
   ============================================================ */
:root {
  /* Brand */
  --brand: #0057ff;
  --brand-400: #4d8dff;
  --brand-300: #7caeff;
  --brand-600: #0047d1;
  --accent: #00c48c;
  --accent-400: #2fe0ad;
  --warm: #ff6b35;
  --gold: #ffb800;
  --violet: #7c6cff;
  --rose: #ff4d6d;
  --cyan: #22c8f0;

  /* Semantic */
  --ok: #00c48c;
  --warn: #b57e00;
  --danger: #ff4d6d;
  --info: #0ea5c9;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #0057ff 0%, #4d9bff 100%);
  --grad-mint: linear-gradient(135deg, #00c48c 0%, #3ad6ff 100%);
  --grad-royal: linear-gradient(135deg, #6a5cff 0%, #a35bff 100%);
  --grad-rose: linear-gradient(135deg, #ff4d6d 0%, #ff8a5c 100%);

  /* Geometry */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: .15s;
  --t-med: .28s;

  /* Layout */
  --sidebar-w: 224px;
  --topbar-h: 60px;

  /* Type */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 19px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  /* LIGHT theme colors */
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-alt: #edf1f8;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eff3f9;
  --overlay: rgba(15, 23, 42, .38);
  --line: #e5eaf2;
  --line-strong: #d3dbe8;
  --ink: #0b1220;
  --ink-2: #3a4658;
  --ink-3: #6b7789;
  --ink-4: #9aa5b5;
  --brand-soft: #e8f0ff;
  --accent-soft: #dcf7ee;
  --warm-soft: #ffece3;
  --gold-soft: #fff4d6;
  --violet-soft: #ece9ff;
  --rose-soft: #ffe4ea;
  --cyan-soft: #dcf6fc;
  --glass: rgba(255, 255, 255, .82);
  --glass-border: rgba(15, 23, 42, .07);
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06), 0 1px 3px rgba(16, 30, 54, .05);
  --shadow-md: 0 6px 20px rgba(16, 30, 54, .08), 0 2px 6px rgba(16, 30, 54, .05);
  --shadow-lg: 0 18px 50px rgba(16, 30, 54, .14), 0 6px 16px rgba(16, 30, 54, .08);
  --shadow-brand: 0 10px 26px rgba(0, 87, 255, .24);
  --shadow-pop: 0 16px 48px rgba(16, 30, 54, .16), 0 0 0 1px rgba(16, 30, 54, .04);
  --scroll-thumb: rgba(16, 30, 54, .18);
  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, .85);

  /* 旧类名别名（兼容） */
  --border: var(--line);
  --border-strong: var(--line-strong);
  --bg-soft: var(--surface-2);
  --text-dim: var(--ink-3);
  --text-faint: var(--ink-4);
  --accent-soft: var(--brand-soft);
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
.hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.55;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(0, 87, 255, .07), transparent 60%),
    radial-gradient(700px 420px at -8% 30%, rgba(0, 196, 140, .05), transparent 55%);
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; }
::selection { background: rgba(0, 87, 255, .28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-xs); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise .55s var(--ease) both; }
.rise.d1 { animation-delay: .05s; }
.rise.d2 { animation-delay: .12s; }
.rise.d3 { animation-delay: .19s; }
.rise.d4 { animation-delay: .26s; }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 196, 140, .5); } 60% { box-shadow: 0 0 0 6px rgba(0, 196, 140, 0); } }

/* ============ Layout ============ */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; height: 100vh; z-index: 60;
}
.sb-brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.sb-brand .logo-img {
  width: 140px; height: auto; max-height: 46px; object-fit: contain; flex-shrink: 0; display: block;
}
.sb-brand .logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow-brand); flex-shrink: 0;
  font-size: 17px;
}
.sb-brand .brand-text {
  font-size: 16px; font-weight: 800; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden;
  background: linear-gradient(100deg, #4c8dff 0%, #22d3ee 35%, #a78bfa 70%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.sb-brand .brand-text em { font-style: normal; color: var(--brand-400); }
.sb-brand .brand-badge {
  font-size: 10px; font-weight: 700; color: var(--ink-3);
  background: var(--surface-3); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: var(--r-pill); letter-spacing: .05em; white-space: nowrap;
}
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 12px; }
.sb-group { margin-bottom: 24px; }
.sb-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-4); padding: 0 10px 8px; white-space: nowrap;
}
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 2px 0; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  position: relative; transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap; width: 100%;
}
.sb-link:hover { background: var(--surface-2); color: var(--ink); }
.sb-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.sb-link .nav-ico { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; opacity: .85; }
.sb-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.sb-link.active svg, .sb-link.active .nav-ico { opacity: 1; }
.sb-link.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--grad-brand);
}
.sb-link .count {
  margin-left: auto; font-size: 10px; font-weight: 700; min-width: 20px; height: 18px;
  padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-3);
}
.sb-foot {
  padding: 12px; border-top: 1px solid var(--line); flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast);
}
.sb-user:hover { background: var(--surface-2); }
.sb-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-mint); color: #05221a;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0; position: relative;
}
.sb-user .avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--sidebar-bg);
  animation: pulse-dot 2.4s infinite;
}
.sb-user .u-meta { line-height: 1.3; overflow: hidden; white-space: nowrap; flex: 1; }
.sb-user .u-name { font-size: 13px; font-weight: 600; }
.sb-user .u-role { font-size: 11px; color: var(--ink-3); }
.sb-logout {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--ink-4); cursor: pointer;
  transition: all var(--t-fast); text-decoration: none;
}
.sb-logout:hover { color: var(--rose); background: var(--rose-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0; position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
@media (prefers-reduced-transparency: reduce) { .topbar { backdrop-filter: none; background: #fff; } }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--ink-3); }
.breadcrumb .crumb-dim { color: var(--ink-4); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--ink-4); }
.breadcrumb .cur { color: var(--ink); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.clock { font-family: var(--mono); font-size: 12px; color: var(--ink-4); }
.content { flex: 1; padding: 26px 28px 60px; max-width: 1560px; width: 100%; margin: 0 auto; }

/* ============ Page head ============ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-head h1 { font-size: var(--fs-2xl); font-weight: 800; }
.page-head .sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: 4px; }
.page-head .sub b { color: var(--ink); }
.page-head .head-actions { display: flex; gap: 10px; align-items: center; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 18px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600; border: 1px solid transparent;
  transition: all var(--t-fast) var(--ease); white-space: nowrap;
  user-select: none; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-brand); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.btn.soft { background: var(--brand-soft); color: var(--brand); }
.btn.soft:hover { background: rgba(0, 87, 255, .18); }
.btn.danger { background: var(--rose-soft); color: var(--rose); }
.btn.danger:hover { background: rgba(255, 77, 109, .18); }
.btn.warn { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; box-shadow: 0 2px 10px rgba(245, 158, 11, .3); }
.btn.warn:hover { filter: brightness(1.08); }
.btn.warn.pulse { animation: btnPulse 1.6s ease-in-out infinite; }
@keyframes btnPulse { 0%, 100% { box-shadow: 0 2px 10px rgba(245, 158, 11, .3); } 50% { box-shadow: 0 2px 18px rgba(245, 158, 11, .55); } }
.btn.small { height: 30px; padding: 0 12px; font-size: var(--fs-xs); border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============ Card ============ */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.panel { padding: 20px; margin-bottom: 16px; }
.panel-title { font-size: var(--fs-md); font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px 0;
}
.card-head.bordered { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: var(--fs-lg); font-weight: 700; }
.card-body { padding: 18px 22px 22px; }

/* ============ Stat cards ============ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden; padding: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med), border-color var(--t-med);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.stat::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--stat-color, var(--grad-brand)); opacity: 0; transition: opacity var(--t-med);
}
.stat:hover::after { opacity: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-label { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.stat-ico {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 17px;
}
.stat-ico.blue { background: var(--brand-soft); color: var(--brand); }
.stat-ico.mint { background: var(--accent-soft); color: var(--accent); }
.stat-ico.warm { background: var(--warm-soft); color: var(--warm); }
.stat-ico.violet { background: var(--violet-soft); color: var(--violet); }
.stat-ico.gold { background: var(--gold-soft); color: var(--gold); }
.stat-ico.rose { background: var(--rose-soft); color: var(--rose); }
.stat-value { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value em { font-style: normal; font-size: var(--fs-md); font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.stat-meta { margin-top: 7px; font-size: var(--fs-xs); color: var(--ink-3); }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-2xs); font-weight: 600;
  padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--gold-soft); color: var(--warn); }
.badge.danger { background: var(--rose-soft); color: var(--rose); }
.badge.info { background: var(--cyan-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.teal { background: #e3f5f3; color: #0d9488; }
.badge.neutral { background: var(--surface-3); color: var(--ink-3); }
.badge.err { background: var(--rose-soft); color: var(--rose); }
.badge.muted { background: var(--surface-3); color: var(--ink-4); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.status-dot.online { background: var(--ok); animation: pulse-dot 2.4s infinite; }
.status-dot.offline { background: var(--rose); }
.status-dot.busy { background: var(--brand); }

/* ============ Table ============ */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 720px; }
.table thead th {
  font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-4); text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .t-strong { color: var(--ink); font-weight: 600; }
.table .row-actions { display: flex; gap: 6px; }
.row-hover-btn { opacity: 0; transition: opacity .12s; }
.table tbody tr:hover .row-hover-btn { opacity: 1; }
.mono-tag {
  font-family: var(--mono); font-size: 12px; background: var(--surface-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; color: var(--ink-2);
}
.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--ink-3); flex-wrap: wrap; gap: 10px;
}

/* ============ Toolbar ============ */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 200px; height: 38px; padding: 0 13px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: var(--fs-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input::placeholder { color: var(--ink-4); }
.search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 87, 255, .15); }
.toolbar select {
  height: 38px; padding: 0 32px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: var(--fs-sm); cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7789' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 87, 255, .15); }
.list-count { font-size: 12px; color: var(--ink-4); margin-left: auto; }

/* seg 分段控件 */
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  height: 30px; padding: 0 14px; border-radius: 7px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3);
  transition: all var(--t-fast);
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field label { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; height: 40px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: var(--fs-sm); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--ink-4); }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none; border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 87, 255, .15);
}
.form-field textarea { height: auto; min-height: 70px; padding: 11px 13px; resize: vertical; line-height: 1.6; font-family: var(--mono); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-body {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px; width: min(960px, 94vw); max-height: 90vh;
  overflow: auto; box-shadow: var(--shadow-pop); animation: popIn .28s var(--ease-spring) both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.img-modal-body { width: min(720px, 92vw); }
.img-modal-body img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line); }
#img-modal-info { margin-top: 12px; font-size: var(--fs-sm); color: var(--ink-3); }

/* ============ Toast ============ */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 11px 18px; font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-pop); animation: popIn .28s var(--ease-spring) both; max-width: 400px;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--rose); }
.toast.info { border-left: 3px solid var(--brand); }

/* ============ 首页 ============ */
.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.server-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; cursor: pointer;
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med), border-color var(--t-med);
  box-shadow: var(--shadow-sm);
}
.server-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.server-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.server-name { font-weight: 700; font-size: 15px; }
.server-host { color: var(--ink-4); font-size: 12px; font-family: var(--mono); }
.gauge-row { display: flex; gap: 16px; margin: 12px 0; }
.gauge { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.gauge canvas { width: 78px; height: 78px; }
.gauge-label { font-size: var(--fs-2xs); color: var(--ink-3); }
.gauge-val { font-size: var(--fs-xs); font-family: var(--mono); font-weight: 700; }
.gauge-val.hot { color: var(--warn); }
.gauge-val.overheat { color: var(--rose); }
.server-meta { display: flex; gap: 14px; font-size: var(--fs-xs); color: var(--ink-3); flex-wrap: wrap; }
.server-meta b { color: var(--ink); font-family: var(--mono); font-weight: 600; }

/* 实例卡片操作栏：四个等宽文字按钮 */
.card-actions {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.card-actions .act {
  height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.card-actions .act:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-2); }
.card-actions .act:disabled { opacity: .5; cursor: not-allowed; }
.card-actions .act.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.card-actions .act.brand:hover { background: #d9e8ff; color: var(--brand); }
.card-actions .act.danger:hover { background: var(--rose-soft); color: var(--rose); border-color: transparent; }

/* 指标过期提醒条 */
.stale-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--warn-soft); border: 1px solid #f0b429;
  color: var(--warn); font-weight: 700; font-size: 13px;
  border-radius: var(--r-md); padding: 11px 14px; margin-bottom: 14px;
  cursor: pointer; animation: stale-pulse 1.6s ease-in-out infinite;
}
.stale-banner.hidden { display: none; }
.stale-banner b { color: #c2410c; }
@keyframes stale-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, .45); } 50% { box-shadow: 0 0 0 6px rgba(240, 180, 41, 0); } }

/* 项目行（首页） */
.proj-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); margin-bottom: 8px; cursor: pointer; transition: all var(--t-fast);
}
.proj-row:hover { background: var(--brand-soft); border-color: var(--brand-300); }
.proj-row-name { font-weight: 600; }
.proj-row-sub { font-size: 11px; color: var(--ink-4); }
.progress-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--grad-brand); transition: width .5s ease; }
.progress-text { font-size: var(--fs-xs); font-family: var(--mono); color: var(--ink-3); min-width: 44px; text-align: right; }

/* ============ 设置页（左侧目录 + 右侧 iframe） ============ */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.settings-nav {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 8px; position: sticky; top: 16px; box-shadow: var(--shadow-sm);
}
.settings-nav-title {
  font-size: 11.5px; font-weight: 800; color: var(--brand);
  padding: 4px 12px 10px; letter-spacing: .5px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; cursor: pointer; margin-bottom: 3px;
  border: 1px solid transparent; transition: all var(--t-fast);
}
.settings-nav-item:hover { background: var(--surface-2); }
.settings-nav-item.active {
  background: var(--brand-soft);
  border-color: #dbe7ff;
}
.settings-nav-item.active .settings-nav-name { color: var(--brand); }
.settings-nav-ico {
  width: 20px; flex-shrink: 0; text-align: center;
  font-size: 16px; line-height: 1; color: var(--ink-3);
  filter: grayscale(1); transition: all var(--t-fast);
}
.settings-nav-item:hover .settings-nav-ico { filter: none; }
.settings-nav-item.active .settings-nav-ico { filter: none; }
.settings-nav-txt { flex: 1; min-width: 0; }
.settings-nav-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.settings-nav-desc {
  font-size: 11px; color: var(--ink-4); margin-top: 2px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-body { min-width: 0; }
.settings-frame {
  width: 100%; height: calc(100vh - 160px); min-height: 520px;
  border: none; border-radius: 0; background: transparent;
}
.settings-sub { overflow: auto; padding: 4px; }

/* ============ 实例详情 ============ */
.iface-card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 14px; margin-bottom: 10px;
}
.iface-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.iface-name { font-weight: 600; font-size: 14px; }
.iface-row { display: flex; gap: 10px; font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.7; }
.iface-k { flex: 0 0 44px; color: var(--ink-4); }
.iface-row .chip { padding: 2px 8px; margin-right: 4px; display: inline-block; }
.server-detail-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; }
.metric-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px; font-size: var(--fs-xs);
}
.chip b { font-family: var(--mono); margin-left: 6px; }
.log-box {
  background: #10151f; border: 1px solid #2a3242; border-radius: var(--r-sm);
  padding: 12px; font-family: var(--mono); font-size: 11px; color: #c6d2e2;
  max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.proc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.proc-table th { text-align: left; color: var(--ink-4); font-weight: 600; padding: 5px 10px; border-bottom: 1px solid var(--line); }
.proc-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.proc-table td:last-child { font-family: var(--font); color: var(--ink-3); }

/* ============ 项目详情 ============ */
.proj-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.proj-header h1 {
  font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.pill {
  font-size: var(--fs-2xs); padding: 3px 11px; border-radius: var(--r-pill); font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.pill.neutral { background: var(--surface-3); color: var(--ink-3); }
.proj-meta { display: flex; gap: 18px; font-size: var(--fs-xs); color: var(--ink-4); margin-top: 8px; flex-wrap: wrap; }
.proj-meta b { color: var(--ink-2); font-weight: 600; }
.proj-header-actions { display: flex; gap: 10px; }
.section-title {
  font-size: var(--fs-lg); font-weight: 700; margin: 24px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.count-badge {
  background: var(--surface-3); color: var(--ink-3); font-size: var(--fs-2xs);
  padding: 2px 9px; border-radius: var(--r-pill); font-family: var(--mono); font-weight: 600;
}

/* 角色/场景卡 */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.char-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med);
}
.char-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.char-avatar {
  width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line); background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.char-name { font-weight: 700; font-size: var(--fs-sm); }
.char-desc { font-size: var(--fs-2xs); color: var(--ink-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }

/* 图片库 */
.img-toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.imgs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.img-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  overflow: hidden; cursor: pointer; transition: all var(--t-fast); position: relative;
  box-shadow: var(--shadow-sm);
}
.img-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(0, 87, 255, .18); }
.img-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.img-card .img-tag { font-size: 10px; padding: 4px 7px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-type-badge {
  position: absolute; top: 5px; left: 5px; font-size: 9px; padding: 1px 7px;
  border-radius: var(--r-pill); background: rgba(255,255,255,.92); color: var(--ink-3);
  border: 1px solid var(--line); font-weight: 600;
}
.img-type-badge.character { color: var(--brand); border-color: var(--brand-300); }
.img-type-badge.scene { color: var(--accent); border-color: #bfead5; }
.img-type-badge.first_frame { color: var(--gold); border-color: #f8ddb0; }

/* 单元 */
.unit-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px; transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.unit-item:hover { border-color: var(--line-strong); }
.unit-n {
  width: 42px; height: 42px; border-radius: var(--r-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 15px;
  background: var(--brand-soft); color: var(--brand);
}
.unit-n.done { background: var(--accent-soft); color: var(--accent); }
.unit-n.running { background: var(--brand-soft); color: var(--brand); animation: pulse-dot 1.6s infinite; }
.unit-n.failed { background: var(--rose-soft); color: var(--rose); }
.unit-info { flex: 1; min-width: 0; }
.unit-title { font-weight: 700; font-size: var(--fs-md); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unit-lines-preview { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-slots { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.slot-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-2xs);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; color: var(--ink-3);
}
.slot-chip img { width: 16px; height: 16px; border-radius: 4px; object-fit: cover; }
.slot-chip .p-num { font-family: var(--mono); color: var(--brand); font-weight: 700; }
.unit-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* 台词表 */
.line-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.line-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: var(--fs-sm); }
.speaker-chip {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.speaker-chip.off { background: var(--violet-soft); color: var(--violet); }
.emo-chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-2xs);
  background: var(--surface-3); color: var(--ink-3);
}
.line-text { color: var(--ink); line-height: 1.6; }
.density-tag { font-size: var(--fs-2xs); padding: 1px 8px; border-radius: var(--r-pill); font-weight: 600; }
.density-tag.ok { background: var(--accent-soft); color: var(--accent); }
.density-tag.over { background: var(--gold-soft); color: var(--warn); }
.density-tag.under { background: var(--rose-soft); color: var(--rose); }
.empty { text-align: center; color: var(--ink-4); padding: 48px 20px; font-size: var(--fs-sm); }
.empty .big { font-size: 38px; margin-bottom: 12px; }

/* ============ 剧本编辑器 ============ */
.script-modal-body { width: min(1100px, 96vw); }
.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.editor-tab {
  border: 0; background: transparent; color: var(--ink-3);
  padding: 9px 16px; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; font-family: var(--font);
  border-bottom: 2px solid transparent; transition: all var(--t-fast);
}
.editor-tab:hover { color: var(--ink); }
.editor-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.editor-body { min-height: 300px; }
.editor-section-head { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-sm); font-weight: 700; color: var(--ink-3); margin: 8px 0; }
.editor-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px; margin-bottom: 10px; }
.editor-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.editor-card-head > input {
  flex: 1; background: transparent; border: 0; border-bottom: 1px dashed var(--line-strong);
  color: var(--ink); font-size: var(--fs-md); font-weight: 700; padding: 4px 2px; font-family: var(--font);
}
.editor-card-head > input:focus { outline: none; border-bottom-color: var(--brand); }
.editor-sub-head { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 700; display: flex; align-items: center; justify-content: space-between; margin: 6px 0; }
.line-edit-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.line-edit-row select, .line-edit-row input {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 5px 9px; font-size: var(--fs-xs); font-family: var(--font);
}
.line-edit-row input:focus, .line-edit-row select:focus { outline: none; border-color: var(--brand); }
.unit-editor { border-left: 3px solid var(--brand); }
.editor-empty { color: var(--ink-4); font-size: var(--fs-xs); padding: 10px 0; text-align: center; }

/* ============ 创建向导 ============ */
.wizard-body { width: min(580px, 94vw); }
.wizard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.wizard-head h2 { font-size: var(--fs-xl); }
.wizard-steps { display: flex; margin-bottom: 22px; }
.wizard-step {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-xs); color: var(--ink-4); position: relative;
}
.wizard-step:not(:last-child)::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); margin: 0 8px; }
.wstep-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  font-size: var(--fs-xs); font-family: var(--mono); color: var(--ink-4);
}
.wizard-step.active { color: var(--ink); font-weight: 700; }
.wizard-step.active .wstep-num { background: var(--grad-brand); border-color: transparent; color: #fff; }
.wizard-step.done { color: var(--ink-3); }
.wizard-step.done .wstep-num { background: var(--accent-soft); border-color: #bfead5; color: var(--accent); }
.wizard-body-inner { padding: 4px 0 8px; }
.wizard-finish { text-align: center; padding: 18px 0; }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .server-detail-grid { grid-template-columns: 1fr; }
  .sidebar { width: 200px; }
}

/* ============ 管理员菜单：默认隐藏防闪现 ============ */
/* 侧边栏 data-admin 项默认隐藏（非管理员永不闪现），确认管理员后由 JS 移除属性显示 */
[data-admin] { display: none !important; }
