:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #eef2f7;
  --text: #162033;
  --muted: #7d8799;
  --muted-2: #a7afbd;
  --line: #e6eaf0;
  --line-strong: #d9dee7;
  --sidebar: #111827;
  --sidebar-2: #172033;
  --primary: #6f5df6;
  --primary-2: #8c7cff;
  --primary-soft: #efedff;
  --green: #1bbf9b;
  --green-soft: #e8faf5;
  --orange: #f59e52;
  --orange-soft: #fff4e9;
  --red: #ee6a78;
  --red-soft: #ffedef;
  --blue: #4388f7;
  --blue-soft: #eaf2ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 5px 18px rgba(15, 23, 42, .04);
  --shadow-md: 0 18px 45px rgba(25, 32, 56, .12);
  --radius: 15px;
  --sidebar-w: 238px;
  --topbar-h: 72px;
  --transition: 180ms ease;
}

html[data-theme="dark"] {
  --bg: #0c1220;
  --panel: #141c2c;
  --panel-2: #101827;
  --panel-3: #202a3d;
  --text: #e9edf5;
  --muted: #9aa6b8;
  --muted-2: #718097;
  --line: #253147;
  --line-strong: #344159;
  --sidebar: #090e18;
  --sidebar-2: #111827;
  --primary-soft: rgba(111, 93, 246, .16);
  --green-soft: rgba(27, 191, 155, .13);
  --orange-soft: rgba(245, 158, 82, .13);
  --red-soft: rgba(238, 106, 120, .13);
  --blue-soft: rgba(67, 136, 247, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 24px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  color: #b9c2d2;
  background:
    radial-gradient(circle at 20% 0%, rgba(111, 93, 246, .15), transparent 26%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: auto -80px -100px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(34, 200, 168, .06);
  filter: blur(1px);
  pointer-events: none;
}
.brand {
  height: var(--topbar-h);
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  flex: 0 0 auto;
}
.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #7567ff, #22c8a8);
  box-shadow: 0 8px 22px rgba(111, 93, 246, .28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-copy { white-space: nowrap; }
.brand-copy strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-copy span { display: block; margin-top: 1px; color: #77849b; font-size: 10px; text-transform: uppercase; letter-spacing: 1.7px; }
.side-nav { padding: 18px 12px; overflow: auto; scrollbar-width: none; flex: 1; }
.side-nav::-webkit-scrollbar { display: none; }
.nav-label { margin: 12px 12px 8px; color: #657189; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; white-space: nowrap; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 44px;
  margin: 3px 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  color: #a8b2c3;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; stroke-width: 1.7; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .055); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(111, 93, 246, .28), rgba(111, 93, 246, .10)); }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 0 4px 4px 0; background: #8b7dff; }
.nav-item .chevron { width: 14px; height: 14px; margin-left: auto; transition: transform var(--transition); }
.nav-item.open .chevron { transform: rotate(90deg); }
.subnav { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--transition); }
.subnav.open { grid-template-rows: 1fr; }
.subnav-inner { overflow: hidden; }
.subnav .nav-item { min-height: 38px; padding-left: 44px; font-size: 13px; }
.sidebar-footer { padding: 13px 14px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.storage-card { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.045); white-space: nowrap; overflow: hidden; }
.storage-line { display: flex; justify-content: space-between; gap: 10px; color: #9ba7ba; font-size: 11px; }
.storage-bar { height: 4px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #273248; }
.storage-bar i { display: block; width: 42%; height: 100%; background: linear-gradient(90deg, #7567ff, #22c8a8); }

.main-wrap { min-height: 100vh; margin-left: var(--sidebar-w); transition: margin var(--transition); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 39px;
  height: 39px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition), border var(--transition), transform var(--transition);
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--line); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 19px; height: 19px; }
.mobile-menu { display: none; }
.breadcrumb { min-width: 0; display: flex; align-items: center; gap: 8px; }
.breadcrumb strong { font-size: 15px; }
.breadcrumb span { color: var(--muted); white-space: nowrap; }
.breadcrumb .slash { color: var(--muted-2); }
.top-spacer { flex: 1; }
.quick-search {
  width: min(270px, 25vw);
  height: 39px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
}
.quick-search svg { width: 17px; height: 17px; }
.quick-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick-search kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: var(--panel); font-size: 10px; }
.notification-wrap, .profile-wrap { position: relative; }
.notify-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--panel); }
.profile-btn { height: 44px; padding: 0 4px 0 7px; display: flex; align-items: center; gap: 9px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.profile-btn:hover { background: var(--panel-2); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #fe947c, #7465f6); font-weight: 800; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.profile-copy { text-align: left; line-height: 1.25; }
.profile-copy strong { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.profile-copy small { color: var(--muted); font-size: 11px; }
.profile-btn svg { width: 14px; height: 14px; color: var(--muted); }

.content { padding: 26px 28px 46px; }
.page-head { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.35px; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.btn {
  min-height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  font-weight: 650;
  transition: transform var(--transition), border var(--transition), background var(--transition), opacity var(--transition);
}
.btn:hover { border-color: #bfc7d3; background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: #fff; border-color: var(--primary); background: linear-gradient(135deg, var(--primary), #8272fb); box-shadow: 0 7px 16px rgba(111,93,246,.18); }
.btn.primary:hover { background: linear-gradient(135deg, #6350ed, #7866f2); }
.btn.success { color: #fff; border-color: var(--green); background: var(--green); }
.btn.danger { color: var(--red); border-color: transparent; background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 31px; padding: 0 10px; border-radius: 7px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
.panel-head { min-height: 64px; padding: 16px 19px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 20px; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.kpi-card { position: relative; min-height: 144px; padding: 19px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); }
.kpi-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -45px; bottom: -48px; border-radius: 50%; background: var(--tint); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: var(--tint); }
.kpi-icon svg { width: 18px; height: 18px; }
.trend { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 700; }
.trend.down { color: var(--red); background: var(--red-soft); }
.trend svg { width: 11px; height: 11px; }
.kpi-value { margin-top: 16px; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.kpi-label { margin-top: 2px; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; }
.chart-wrap { position: relative; height: 300px; padding: 8px 2px 0; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.chart-gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 6; }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 6px 7px rgba(111,93,246,.18)); }
.chart-area { fill: url(#areaGradient); }
.chart-point { fill: var(--panel); stroke: var(--primary); stroke-width: 3; }
.chart-legend { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--primary); }
.activity-list { display: grid; gap: 0; }
.activity { position: relative; padding: 13px 0 13px 39px; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.activity-icon { position: absolute; left: 0; top: 14px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.activity-icon svg { width: 13px; height: 13px; }
.activity strong { display: block; font-size: 12px; }
.activity p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.system-status { margin-top: 16px; padding: 13px; display: flex; align-items: center; gap: 10px; border-radius: 11px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 650; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(27,191,155,.12); }

.filter-panel { margin-bottom: 16px; }
.filters { padding: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label { color: var(--muted); font-size: 12px; font-weight: 650; }
.control {
  height: 39px;
  min-width: 145px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: var(--panel);
  transition: border var(--transition), box-shadow var(--transition);
}
.control::placeholder { color: var(--muted-2); }
.control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111,93,246,.10); }
select.control { cursor: pointer; }
textarea.control { height: auto; min-height: 95px; padding-top: 10px; resize: vertical; }
.search-control { position: relative; min-width: min(300px, 100%); }
.search-control svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-control .control { width: 100%; padding-left: 37px; }
.date-range { display: flex; align-items: center; gap: 7px; }
.date-range .control { min-width: 145px; }

.table-wrap { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { height: 47px; padding: 0 15px; color: var(--muted); background: var(--panel-2); font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--primary-soft) 42%, transparent); }
.cell-main { font-weight: 650; }
.cell-sub { margin-top: 2px; max-width: 240px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.user-avatar { width: 33px; height: 33px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #fff; font-weight: 800; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 8px; border-radius: 99px; color: var(--muted); background: var(--panel-3); font-size: 11px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green { color: #128d73; background: var(--green-soft); }
.badge.orange { color: #c7782e; background: var(--orange-soft); }
.badge.red { color: #cb4d5c; background: var(--red-soft); }
.badge.blue { color: #3477d6; background: var(--blue-soft); }
.badge.purple { color: var(--primary); background: var(--primary-soft); }
.row-actions { display: flex; align-items: center; gap: 4px; }
.action-btn { width: 31px; height: 31px; display: grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.action-btn:hover { color: var(--primary); background: var(--primary-soft); }
.action-btn.danger:hover { color: var(--red); background: var(--red-soft); }
.action-btn svg { width: 15px; height: 15px; }
.pagination { min-height: 60px; padding: 11px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pager { display: flex; align-items: center; gap: 5px; }
.page-btn { min-width: 31px; height: 31px; padding: 0 8px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.page-btn.active { color: #fff; border-color: var(--primary); background: var(--primary); }

.drama-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.drama-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition); }
.drama-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.poster { position: relative; height: 215px; padding: 18px; overflow: hidden; display: flex; align-items: flex-end; color: #fff; background: var(--poster); }
.poster::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(3,7,18,.78)); }
.poster::after { content: ""; position: absolute; width: 170px; height: 170px; right: -55px; top: -55px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; box-shadow: 0 0 0 25px rgba(255,255,255,.04), 0 0 0 50px rgba(255,255,255,.03); }
.poster-copy { position: relative; z-index: 1; }
.poster-copy small { letter-spacing: 1.5px; text-transform: uppercase; opacity: .72; }
.poster-copy strong { display: block; margin-top: 5px; font-size: 20px; line-height: 1.1; letter-spacing: -.4px; }
.poster-badge { position: absolute; z-index: 2; left: 14px; top: 14px; padding: 4px 8px; border-radius: 99px; background: rgba(12,18,32,.5); backdrop-filter: blur(8px); font-size: 10px; }
.drama-body { padding: 14px; }
.drama-title { margin: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drama-meta { margin: 5px 0 11px; color: var(--muted); font-size: 11px; }
.drama-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.drama-footer { padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }

.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 15px 0; }
.mini-kpi { min-height: 100px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.mini-kpi span { color: var(--muted); font-size: 12px; }
.mini-kpi strong { display: block; margin-top: 9px; font-size: 23px; }
.analytics-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 18px; }
.funnel { display: grid; gap: 15px; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 75px; align-items: center; gap: 12px; }
.funnel-row span { font-size: 12px; }
.funnel-row strong { text-align: right; font-size: 12px; }
.progress { height: 12px; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #a39bff); }
.bar-chart { height: 240px; padding: 18px 8px 0; display: flex; align-items: end; gap: 9px; border-bottom: 1px solid var(--line); }
.bar-item { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar { width: min(28px, 72%); min-height: 4px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #8b7dff, #6653ef); transition: height .35s ease; }
.bar-item span { color: var(--muted); font-size: 10px; }

.tracking-tabs { padding: 0 18px; display: flex; gap: 5px; overflow: auto; border-bottom: 1px solid var(--line); }
.tab-btn { min-height: 51px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; cursor: pointer; white-space: nowrap; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.settings-form { max-width: 840px; display: grid; gap: 19px; }
.form-row { display: grid; grid-template-columns: 185px 1fr; gap: 20px; align-items: start; }
.form-label { padding-top: 9px; }
.form-label strong { display: block; font-size: 13px; }
.form-label small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.form-input-group { display: grid; gap: 8px; }
.form-input-group .control { width: 100%; }
.form-help { color: var(--muted); font-size: 11px; }
.pixel-card { padding: 15px; display: grid; grid-template-columns: minmax(160px,.5fr) minmax(220px,1.5fr) auto; gap: 12px; align-items: end; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.switch { position: relative; width: 42px; height: 24px; display: inline-block; }
.switch input { width: 0; height: 0; opacity: 0; }
.slider { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); cursor: pointer; transition: background var(--transition); }
.slider::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform var(--transition); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.theme-picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.theme-pick { padding: 10px; border: 2px solid var(--line); border-radius: 13px; background: var(--panel); cursor: pointer; text-align: left; }
.theme-pick.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111,93,246,.09); }
.theme-preview { height: 90px; display: grid; grid-template-columns: 25% 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.theme-preview aside { background: var(--preview-side); }
.theme-preview main { padding: 9px; }
.theme-preview i { height: 13px; display: block; margin-bottom: 6px; border-radius: 3px; background: var(--preview-accent); opacity: .55; }
.theme-pick strong { display: block; margin: 9px 2px 0; font-size: 12px; }

.empty-state { min-height: 300px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 17px; color: var(--primary); background: var(--primary-soft); }
.empty-icon svg { width: 25px; height: 25px; }
.empty-state h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0; }

.dropdown { position: absolute; z-index: 80; top: calc(100% + 9px); right: 0; min-width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: var(--shadow-md); animation: pop .15s ease; }
.dropdown.wide { width: 340px; }
.dropdown-head { padding: 9px 10px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dropdown-head strong { font-size: 13px; }
.dropdown-item { width: 100%; padding: 10px; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 9px; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.dropdown-item:hover { background: var(--panel-2); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown-item.danger { color: var(--red); }
.notify-item { padding: 11px 9px; display: grid; grid-template-columns: 31px 1fr; gap: 10px; border-bottom: 1px solid var(--line); }
.notify-item:last-child { border-bottom: 0; }
.notify-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.notify-icon svg { width: 14px; height: 14px; }
.notify-item p { margin: 0; font-size: 12px; }
.notify-item small { color: var(--muted); font-size: 10px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 20px; display: grid; place-items: center; background: rgba(8,13,24,.58); backdrop-filter: blur(5px); animation: fade .16s ease; }
.modal { width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.26); animation: pop .18s ease; }
.modal.large { width: min(820px, 100%); }
.modal-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.modal-grid .full { grid-column: 1 / -1; }
.command-modal { align-self: start; margin-top: 9vh; width: min(610px, 100%); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.28); animation: pop .18s ease; }
.command-search { padding: 15px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.command-search svg { width: 20px; height: 20px; color: var(--muted); }
.command-search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 16px; }
.command-list { max-height: 390px; padding: 9px; overflow: auto; }
.command-item { width: 100%; padding: 10px 11px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.command-item:hover { background: var(--panel-2); }
.command-item .command-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); }
.command-item svg { width: 16px; height: 16px; }
.command-item strong { display: block; font-size: 13px; }
.command-item small { color: var(--muted); }
.command-item kbd { margin-left: auto; color: var(--muted); font-size: 10px; }
.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 9px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 40px)); padding: 13px 15px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-md); animation: slideIn .2s ease; }
.toast-icon { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: var(--green); background: var(--green-soft); }
.toast-icon svg { width: 14px; height: 14px; }
.toast p { margin: 0; font-size: 12px; font-weight: 650; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(430px, 1.05fr) minmax(420px, .95fr); background: #f6f7fb; }
.login-visual { position: relative; padding: 54px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: #101725; }
.login-visual::before { content: ""; position: absolute; width: 540px; height: 540px; left: -170px; top: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(111,93,246,.48), rgba(111,93,246,0) 68%); }
.login-visual::after { content: ""; position: absolute; width: 460px; height: 460px; right: -210px; bottom: -250px; border-radius: 50%; background: radial-gradient(circle, rgba(34,200,168,.32), rgba(34,200,168,0) 68%); }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.login-brand .brand-mark { width: 40px; height: 40px; }
.login-brand strong { font-size: 17px; }
.login-hero { position: relative; z-index: 1; max-width: 590px; margin: auto 0; }
.login-kicker { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.13); border-radius: 99px; color: #b8c0d1; background: rgba(255,255,255,.05); font-size: 11px; }
.login-kicker i { width: 6px; height: 6px; border-radius: 50%; background: #25cfac; }
.login-hero h1 { margin: 21px 0 16px; font-size: clamp(38px, 4.6vw, 66px); line-height: 1.03; letter-spacing: -2.5px; }
.login-hero h1 em { color: #9b91ff; font-style: normal; }
.login-hero p { max-width: 500px; color: #97a3b8; font-size: 15px; line-height: 1.8; }
.login-stats { margin-top: 34px; display: flex; gap: 38px; }
.login-stat strong { display: block; font-size: 19px; }
.login-stat span { color: #6e7b91; font-size: 11px; }
.login-footnote { position: relative; z-index: 1; color: #637086; font-size: 11px; }
.login-form-side { padding: 38px; display: grid; place-items: center; background: var(--bg); }
.login-card { width: min(425px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 35px 70px rgba(33,41,65,.12); }
.login-card h2 { margin: 0; font-size: 25px; }
.login-card > p { margin: 7px 0 28px; color: var(--muted); }
.login-field { margin-bottom: 15px; }
.login-field label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 700; }
.input-shell { position: relative; }
.input-shell svg { position: absolute; left: 12px; top: 13px; width: 17px; height: 17px; color: var(--muted); }
.input-shell .control { width: 100%; height: 44px; padding-left: 39px; }
.password-toggle { position: absolute; right: 7px; top: 5px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.password-toggle:hover { background: var(--panel-2); }
.login-options { margin: 8px 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.checkline { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.checkline input { accent-color: var(--primary); }
.link-button { padding: 0; border: 0; color: var(--primary); background: transparent; cursor: pointer; font-weight: 650; }
.login-submit { width: 100%; height: 44px; }
.demo-box { margin-top: 18px; padding: 12px; border-radius: 11px; color: var(--muted); background: var(--panel-2); font-size: 11px; }
.demo-box strong { color: var(--text); }
.login-error { margin: -4px 0 12px; color: var(--red); font-size: 11px; }

.sidebar-collapsed { --sidebar-w: 76px; }
.sidebar-collapsed .brand { padding: 0 20px; }
.sidebar-collapsed .brand-copy,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .nav-item .chevron,
.sidebar-collapsed .storage-card { opacity: 0; pointer-events: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar-collapsed .subnav { display: none; }

.mobile-scrim { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .drama-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .activity-list { grid-template-columns: 1fr 1fr; column-gap: 18px; }
  .quick-search { width: 185px; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 238px; }
  .sidebar { transform: translateX(-100%); box-shadow: 25px 0 60px rgba(0,0,0,.24); }
  .main-wrap { margin-left: 0; }
  .mobile-nav-open .sidebar { transform: translateX(0); }
  .mobile-nav-open .mobile-scrim { position: fixed; z-index: 45; inset: 0; display: block; border: 0; background: rgba(7,12,22,.48); backdrop-filter: blur(2px); }
  .mobile-menu { display: inline-grid; }
  .desktop-collapse { display: none; }
  .profile-copy, .profile-btn > svg { display: none; }
  .quick-search { width: 42px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .quick-search span, .quick-search kbd { display: none; }
  .content { padding: 22px 20px 40px; }
  .topbar { padding: 0 18px; }
  .drama-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-form-side { min-height: 100vh; }
}

@media (max-width: 640px) {
  .topbar { height: 62px; gap: 7px; }
  .breadcrumb .slash, .breadcrumb span:last-child { display: none; }
  .content { padding: 18px 13px 35px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .page-title { font-size: 21px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr; gap: 11px; }
  .kpi-card { min-height: 125px; }
  .mini-kpis { grid-template-columns: 1fr 1fr; }
  .filters { align-items: stretch; }
  .filters .control, .filters .search-control, .filters .btn { width: 100%; min-width: 100%; }
  .date-range { width: 100%; }
  .date-range .control { min-width: 0; width: 50%; }
  .drama-grid { grid-template-columns: 1fr; }
  .poster { height: 245px; }
  .activity-list { grid-template-columns: 1fr; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .form-row { grid-template-columns: 1fr; gap: 7px; }
  .form-label { padding-top: 0; }
  .pixel-card { grid-template-columns: 1fr; }
  .theme-picks { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-grid .full { grid-column: auto; }
  .modal-backdrop { padding: 10px; }
  .login-form-side { padding: 18px; }
  .login-card { padding: 25px 20px; box-shadow: none; }
  .toast-region { right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Reference console clone -------------------------------------------------- */
:root,
html[data-theme="dark"] {
  --bg: #f0f2f5; --panel: #fff; --panel-2: #f5f7fa; --panel-3: #ebeef5;
  --text: #2c3e50; --muted: #909399; --muted-2: #c0c4cc;
  --line: #ebeef5; --line-strong: #dcdfe6;
  --sidebar: #304156; --sidebar-2: #304156;
  --primary: #409eff; --primary-2: #66b1ff; --primary-soft: #ecf5ff;
  --green: #67c23a; --green-soft: #f0f9eb; --orange: #e6a23c; --orange-soft: #fdf6ec;
  --red: #f56c6c; --red-soft: #fef0f0; --blue: #409eff; --blue-soft: #ecf5ff;
  --shadow-sm: 0 0 12px rgba(0,0,0,.05); --shadow-md: 0 5px 18px rgba(0,0,0,.12);
  --radius: 4px; --sidebar-w: 210px; --topbar-h: 50px; color-scheme: light;
}

body {
  color: #2c3e50; background: #f0f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

.sidebar { color: #bfcbd9; background: #304156; box-shadow: none; }
.sidebar::after { display: none; }
.brand { height: 50px; padding: 0 18px; gap: 10px; color: #fff; background: #2b2f3a; border: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 0; color: #409eff; background: transparent; box-shadow: none; }
.brand-mark svg { width: 23px; height: 23px; stroke-width: 2; }
.brand-copy strong { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.brand-copy span, .nav-label, .sidebar-footer { display: none; }
.side-nav { padding: 0; }
.nav-item {
  min-height: 56px; height: 56px; margin: 0; padding: 0 20px; gap: 16px;
  border-radius: 0; color: #bfcbd9; font-size: 14px; font-weight: 400;
  transition: color .15s ease, background .15s ease;
}
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.8; }
.nav-item:hover, .nav-item.active { color: #409eff; background: #263445; }
.nav-item.active::before { display: none; }
.nav-item .chevron { width: 13px; height: 13px; }
.subnav { background: #1f2d3d; }
.subnav .nav-item { min-height: 50px; height: 50px; padding: 0 20px 0 54px; color: #bfcbd9; font-size: 14px; }
.subnav .nav-item:hover, .subnav .nav-item.active { color: #409eff; background: #001528; }

.main-wrap { margin-left: 210px; background: #f0f2f5; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: 50px; padding: 0 18px; gap: 14px;
  color: #303133; background: #fff; border: 0;
  box-shadow: 0 1px 4px rgba(0,21,41,.08); backdrop-filter: none;
}
.topbar .icon-btn { width: 32px; height: 32px; border: 0; border-radius: 2px; }
.topbar .icon-btn:hover { color: #409eff; background: #f5f7fa; }
.desktop-collapse svg { width: 20px; height: 20px; }
.breadcrumb { gap: 9px; font-size: 14px; }
.breadcrumb strong { color: #303133; font-size: 14px; font-weight: 400; }
.breadcrumb span { color: #97a8be; }
.breadcrumb .slash { color: #c0c4cc; }
.header-tool { color: #5a5e66; }
.profile-btn { height: 40px; padding: 0 3px; gap: 8px; border-radius: 2px; }
.profile-btn:hover { background: #f5f7fa; }
.avatar { width: 30px; height: 30px; border-radius: 50%; color: #fff; background: #409eff; box-shadow: none; font-size: 12px; }
.profile-copy strong { max-width: 220px; color: #606266; font-size: 13px; font-weight: 400; }
.profile-copy small { display: none; }

.tags-view {
  position: sticky; top: 50px; z-index: 39; height: 40px; padding: 4px 12px;
  display: flex; align-items: center; gap: 6px; background: #fff;
  border-top: 1px solid #f4f4f4; border-bottom: 1px solid #d8dce5;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.route-tag {
  height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  color: #495060; border: 1px solid #d8dce5; border-radius: 2px; background: #fff;
  cursor: pointer; font-size: 12px;
}
.route-tag i { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.route-tag.active { color: #fff; border-color: #409eff; background: #409eff; }
.route-tag.active i { background: #fff; }
.route-tag span { margin-left: 2px; font-size: 14px; line-height: 1; }
.tags-more { width: auto; height: 28px; margin-left: auto; padding: 0 10px; display: flex; align-items: center; gap: 5px; color: #fff; border: 1px solid #409eff; border-radius: 2px; background: #409eff; }
.tags-more svg { width: 13px; height: 13px; }

.content { padding: 10px 12px 36px; }
.page-head {
  min-height: 58px; margin: 0 0 10px; padding: 12px 18px; align-items: center;
  background: #fff; border-radius: 4px; box-shadow: 0 0 12px rgba(0,0,0,.05);
}
.page-title { color: #303133; font-size: 18px; font-weight: 500; letter-spacing: 0; }
.page-subtitle { margin-top: 3px; color: #909399; font-size: 12px; }
.page-subtitle:empty { display: none; }
.page-actions { gap: 8px; }
.page-head:has(+ .filter-panel) { min-height: 44px; margin-bottom: 0; padding-bottom: 0; border-radius: 4px 4px 0 0; box-shadow: 0 0 12px rgba(0,0,0,.05); }
.page-head:has(+ .filter-panel) .page-subtitle { display: none; }
.page-head + .filter-panel { border-radius: 0 0 4px 4px; box-shadow: 0 7px 12px rgba(0,0,0,.04); }
.header-text-tool { color: #303133; font-family: Georgia, serif; font-size: 20px; font-weight: 600; }

.btn {
  min-height: 40px; padding: 0 15px; gap: 6px; color: #606266;
  border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; box-shadow: none;
  font-weight: 400; transition: color .15s, border-color .15s, background .15s;
}
.btn:hover { color: #409eff; border-color: #c6e2ff; background: #ecf5ff; }
.btn.primary, .btn.primary:hover { color: #fff; border-color: #409eff; background: #409eff; box-shadow: none; }
.btn.primary:hover { border-color: #66b1ff; background: #66b1ff; }
.btn.success { border-color: #67c23a; background: #67c23a; }
.btn.danger { color: #f56c6c; border-color: #fbc4c4; background: #fef0f0; }
.btn.small { min-height: 32px; border-radius: 4px; }
.icon-btn { border-radius: 4px; }
.icon-btn.active { color: #409eff; border-color: #b3d8ff; background: #ecf5ff; }

.panel { border: 0; border-radius: 4px; background: #fff; box-shadow: 0 0 12px rgba(0,0,0,.05); }
.panel-head { min-height: 56px; padding: 13px 18px; border-bottom: 1px solid #ebeef5; }
.panel-head h3 { color: #303133; font-size: 16px; font-weight: 500; }
.panel-head p { color: #909399; }
.panel-body { padding: 20px; }
.filter-panel { margin-bottom: 10px; }
.filters { padding: 16px 18px; gap: 10px; }
.control { height: 40px; min-width: 150px; padding: 0 12px; color: #606266; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; box-shadow: none; }
.control:hover { border-color: #c0c4cc; }
.control:focus { border-color: #409eff; box-shadow: none; outline: none; }
textarea.control { min-height: 90px; padding-top: 10px; }
.search-control { min-width: 220px; }
.search-control svg { color: #c0c4cc; }
.date-range { gap: 7px; }
.field label { color: #606266; font-weight: 400; }

.table-wrap { overflow: auto; }
.data-table { color: #606266; }
.data-table th { height: 48px; padding: 0 12px; color: #909399; background: #f5f7fa; border-bottom: 1px solid #ebeef5; font-size: 13px; font-weight: 500; }
.data-table td { padding: 12px; border-bottom: 1px solid #ebeef5; }
.data-table tbody tr:hover td { background: #f5f7fa; }
.cell-main { color: #303133; font-weight: 400; }
.cell-sub { color: #909399; }
.user-avatar { border-radius: 50%; box-shadow: none; }
.badge { padding: 3px 8px; border: 1px solid #dcdfe6; border-radius: 4px; color: #909399; background: #f4f4f5; font-weight: 400; }
.badge.green { color: #67c23a; border-color: #c2e7b0; background: #f0f9eb; }
.badge.orange { color: #e6a23c; border-color: #f5dab1; background: #fdf6ec; }
.badge.red { color: #f56c6c; border-color: #fbc4c4; background: #fef0f0; }
.badge.blue, .badge.purple { color: #409eff; border-color: #b3d8ff; background: #ecf5ff; }
.row-actions { gap: 1px; }
.row-actions .action-btn { width: auto; min-width: 30px; height: 30px; padding: 0 6px; color: #409eff; border: 0; border-radius: 3px; background: transparent; }
.row-actions .action-btn:hover { background: #ecf5ff; }
.row-actions .action-btn.danger { color: #f56c6c; }
.pagination { min-height: 54px; padding: 10px 14px; color: #909399; border-top: 0; }
.page-btn { width: 30px; height: 30px; border-radius: 3px; background: #f4f4f5; }
.page-btn.active { color: #fff; background: #409eff; }

.mini-kpis { gap: 12px; margin: 10px 0; }
.mini-kpi { min-height: 82px; padding: 15px 20px; border: 0; border-radius: 40px; background: #fff; box-shadow: 0 0 12px rgba(0,0,0,.05); }
.mini-kpi span { color: #909399; }
.mini-kpi strong { margin-top: 5px; color: #303133; font-size: 22px; }
.analytics-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.analytics-metrics .mini-kpi { border-radius: 4px; }
.analytics-metrics .mini-kpi small { display: block; margin-top: 4px; color: #909399; font-size: 11px; }
.analytics-empty { width: 100%; display: grid; place-items: center; color: #909399; }
.analytics-grid, .dashboard-grid { gap: 10px; }
.kpi-grid { gap: 12px; margin-bottom: 10px; }
.kpi-card { min-height: 125px; padding: 18px; border: 0; border-radius: 4px; box-shadow: var(--shadow-sm); }
.kpi-card::after { display: none; }
.kpi-icon { border-radius: 4px; }
.kpi-value { font-size: 24px; }
.progress i, .bar { background: #409eff; }

.drama-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.drama-card { border: 0; border-radius: 4px; box-shadow: var(--shadow-sm); }
.drama-card:hover { transform: none; box-shadow: var(--shadow-md); }
.poster { height: 176px; }
.poster::after { opacity: .16; }
.drama-body { padding: 14px 16px; }
.drama-footer { padding: 10px 16px; }

.tracking-tabs { height: 50px; padding: 0 18px; gap: 22px; border-bottom: 1px solid #e4e7ed; }
.tab-btn { height: 50px; padding: 0 2px; border-radius: 0; }
.tab-btn.active { color: #409eff; background: transparent; }
.tab-btn.active::after { left: 0; right: 0; bottom: 0; height: 2px; background: #409eff; }
.settings-form { border: 1px solid #ebeef5; border-radius: 4px; }
.form-row { grid-template-columns: 210px minmax(0,560px); padding: 20px; border-color: #ebeef5; }
.form-label strong { color: #606266; font-weight: 400; }
.form-label small { color: #909399; }
.pixel-card { border-radius: 4px; background: #f5f7fa; }
.settings-save { padding: 20px 0 0; display: flex; justify-content: flex-end; }
.settings-save .btn { min-width: 80px; }
.reference-settings, .reference-appearance { min-height: 340px; }
.reference-settings .panel-body, .reference-appearance .panel-body { padding: 28px; }
.reference-settings .settings-form, .reference-appearance .settings-form { border: 0; }
.reference-settings .form-row, .reference-appearance .form-row { border: 0; border-bottom: 1px solid #ebeef5; }
.reference-settings .form-row:last-child, .reference-appearance .form-row:last-child { border-bottom: 0; }

.home-overview { min-height: 370px; padding: 18px 20px 22px; }
.home-title-row { display: flex; align-items: flex-start; justify-content: space-between; }
.home-title-row h1 { margin: 0; color: #303133; font-size: 18px; font-weight: 500; }
.home-title-row p { margin: 5px 0 0; color: #909399; font-size: 12px; }
.home-title-row .btn { min-height: 34px; height: 34px; padding: 0 12px; }
.home-section { margin-top: 17px; }
.home-section h2 { margin: 0 0 11px; color: #606266; font-size: 15px; font-weight: 500; }
.home-title-row p, .home-title-row .btn, .home-title-row + .home-section > h2 { display: none; }
.home-today-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 24px; }
.home-metric { min-width: 0; height: 112px; padding: 18px 12px; display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 0; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.10); }
.home-metric-icon, .home-total-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #409eff; background: #ecf5ff; }
.home-metric-icon svg, .home-total-icon svg { width: 20px; height: 20px; }
.metric-2 .home-metric-icon, .total-2 .home-total-icon { color: #67c23a; background: #f0f9eb; }
.metric-3 .home-metric-icon, .total-3 .home-total-icon { color: #e6a23c; background: #fdf6ec; }
.metric-4 .home-metric-icon, .total-4 .home-total-icon { color: #f56c6c; background: #fef0f0; }
.metric-5 .home-metric-icon { color: #8e6cdc; background: #f3effb; }
.home-metric-icon, .home-total-icon { display: none; }
.home-metric p, .home-total p { margin: 0 0 8px; color: #909399; font-size: 13px; white-space: nowrap; }
.home-metric p, .home-total p { color: #303133; font-size: 16px; }
.home-metric strong { display: block; overflow: hidden; color: #606266; font-size: 18px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.home-total-section { margin-top: 21px; }
.home-total-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 24px; }
.home-total { height: 108px; padding: 18px 12px; display: flex; align-items: center; justify-content: center; text-align: center; border: 0; border-radius: 0; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.10); }
.home-total strong { color: #606266; font-size: 18px; font-weight: 500; }

.dropdown { border: 1px solid #ebeef5; border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.modal { border: 0; border-radius: 4px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.modal.large { width: min(1040px,100%); }
.modal-head, .modal-foot { border-color: #ebeef5; }
.toast { border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.12); }

.episode-manage-btn { color: #409eff; border-color: #b3d8ff; background: #ecf5ff; white-space: nowrap; }
.episode-manage-btn:hover { color: #fff; border-color: #409eff; background: #409eff; }
.episode-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.episode-summary > div { padding: 13px 15px; border: 1px solid #ebeef5; border-radius: 4px; background: #f8fafc; }
.episode-summary span { display: block; color: #909399; font-size: 12px; }
.episode-summary strong { display: block; margin-top: 4px; color: #303133; font-size: 19px; font-weight: 500; }
.episode-upload-box { padding: 15px; display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 11px 14px; border: 1px dashed #b3d8ff; border-radius: 4px; background: #f5faff; }
.episode-upload-box .control { width: 100%; min-width: 0; }
.episode-file-field { min-width: 0; }
.episode-file-input { width: 100%; height: 40px; padding: 6px 9px; color: #606266; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; }
.episode-file-input::file-selector-button { height: 26px; margin-right: 10px; padding: 0 10px; color: #409eff; border: 1px solid #b3d8ff; border-radius: 3px; background: #ecf5ff; cursor: pointer; }
.episode-upload-box > p { grid-column: 1/-1; margin: 0; color: #909399; font-size: 12px; }
.episode-upload-status { grid-column: 1/-1; }
.episode-upload-status > div { margin-bottom: 6px; display: flex; justify-content: space-between; gap: 12px; color: #606266; font-size: 12px; }
.episode-progress { height: 7px; display: block; overflow: hidden; border-radius: 99px; background: #dfeefe; }
.episode-progress i { width: 0; height: 100%; display: block; border-radius: inherit; background: #409eff; transition: width .2s ease; }
.episode-preview { margin-top: 14px; padding: 12px; border: 1px solid #ebeef5; border-radius: 4px; background: #111827; }
.episode-preview-head { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; color: #fff; }
.episode-preview video { width: 100%; max-height: 360px; display: block; background: #000; }
.episode-table-wrap { max-height: 370px; margin-top: 14px; overflow: auto; border: 1px solid #ebeef5; border-radius: 4px; }
.episode-table { min-width: 820px; }
.episode-table th { position: sticky; top: 0; z-index: 2; }
.episode-table td { padding-top: 9px; padding-bottom: 9px; }
.episode-actions { flex-wrap: nowrap; }
.episode-row-upload { min-height: 30px; height: 30px; padding: 0 8px; color: #409eff; border-color: #b3d8ff; background: #ecf5ff; cursor: pointer; font-size: 12px; }
.episode-loading { min-height: 250px; display: grid; place-items: center; align-content: center; gap: 12px; color: #909399; }
.episode-loading p { margin: 0; }
.spinner { width: 30px; height: 30px; display: block; border: 3px solid #d9ecff; border-top-color: #409eff; border-radius: 50%; animation: episodeSpin .8s linear infinite; }
@keyframes episodeSpin { to { transform: rotate(360deg); } }

.compact-mode .content { padding-top: 14px; }
.compact-mode .page-head { margin-bottom: 12px; }
.compact-mode .filter-panel { padding: 10px 14px; }
.compact-mode .data-table td { padding-top: 8px; padding-bottom: 8px; }
.compact-mode .form-row { padding-top: 13px; padding-bottom: 13px; }
.drama-preview-detail { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 22px; align-items: start; }
.drama-preview-detail .poster { height: 270px; border-radius: 4px; }
.drama-preview-detail p { line-height: 1.8; }
.compact-empty { min-height: 150px; margin-top: 14px; border: 1px dashed #dcdfe6; }
.compare-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.compare-item { padding: 12px; align-items: flex-start; border: 1px solid #ebeef5; border-radius: 4px; background: #f8fafc; }
.compare-item span { display: block; min-width: 0; }
.compare-item strong, .compare-item small { display: block; }
.compare-item small { margin-top: 3px; color: #909399; }
.guide-list { margin: 0; padding-left: 24px; }
.guide-list li { margin: 0 0 18px; padding-left: 6px; }
.guide-list li:last-child { margin-bottom: 0; }
.guide-list p { margin: 4px 0 0; color: #909399; }
.profile-copy small { display: block; margin-top: 2px; color: #909399; font-size: 11px; font-weight: 400; }
.hierarchy-note { margin-bottom: 10px; }
.hierarchy-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.hierarchy-grid > div { padding: 14px 16px; border: 1px solid #ebeef5; border-radius: 6px; background: #f8fafc; }
.hierarchy-grid strong { display: block; color: #303133; }
.hierarchy-grid p { margin: 5px 0 0; color: #909399; font-size: 12px; line-height: 1.6; }

/* Reference login */
.login-page {
  width: min(1180px,calc(100vw - 80px)); min-height: 620px; margin: 40px auto;
  grid-template-columns: minmax(520px,1.12fr) minmax(410px,.88fr);
  overflow: hidden; background: #fff; border-radius: 4px; box-shadow: 0 14px 45px rgba(31,45,61,.12);
}
.login-visual { padding: 38px 46px; color: #303133; background: #f5f9ff; }
.login-visual::before, .login-visual::after { display: none; }
.login-brand { color: #303133; }
.login-brand .brand-mark { width: 32px; height: 32px; color: #409eff; }
.login-brand strong { font-size: 16px; font-weight: 600; }
.login-illustration { position: relative; z-index: 1; width: min(560px,100%); margin: auto; }
.login-illustration svg { width: 100%; height: auto; }
.login-form-side { padding: 46px; background: #fff; }
.login-card { width: min(390px,100%); padding: 34px 32px; border: 0; border-radius: 4px; background: #fff; box-shadow: 0 8px 32px rgba(31,45,61,.10); }
.login-card h2 { color: #303133; font-size: 25px; font-weight: 500; text-align: center; }
.login-card > p { margin: 8px 0 30px; color: #909399; text-align: center; }
.login-field { margin-bottom: 18px; }
.login-field label { margin-bottom: 8px; color: #606266; font-weight: 400; }
.input-shell { border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; }
.input-shell:focus-within { border-color: #409eff; box-shadow: none; }
.input-shell .control { height: 44px; }
.input-shell > svg { color: #c0c4cc; }
.login-options { margin: 3px 0 20px; color: #606266; }
.link-button { color: #409eff; }
.login-submit { height: 44px; border-radius: 4px; font-size: 15px; }
.demo-box { margin-top: 18px; padding: 9px 10px; color: #909399; border-radius: 4px; background: #f5f7fa; font-size: 11px; line-height: 1.7; text-align: center; }

.sidebar-collapsed { --sidebar-w: 64px; }
.sidebar-collapsed .brand { padding: 0 18px; }
.sidebar-collapsed .nav-item { padding: 0; }

@media (max-width: 1180px) {
  .home-today-grid, .home-total-grid { gap: 12px; }
  .home-metric { padding: 16px 12px; gap: 9px; }
  .home-metric-icon { width: 36px; height: 36px; }
  .drama-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .login-page { width: min(540px,calc(100vw - 32px)); min-height: auto; margin: 24px auto; grid-template-columns: 1fr; }
  .login-visual { min-height: 210px; padding: 24px; display: flex; }
  .login-illustration { width: 300px; max-height: 160px; overflow: hidden; }
  .login-form-side { min-height: auto; padding: 24px; }
  .sidebar { width: 210px; }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 0 12px; }
  .profile-copy { display: none; }
  .home-today-grid, .home-total-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .analytics-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .hierarchy-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .drama-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .content { padding: 8px; }
  .page-head { align-items: flex-start; padding: 12px; }
  .home-overview { padding: 15px 12px; }
  .home-today-grid, .home-total-grid, .mini-kpis { grid-template-columns: 1fr; }
  .analytics-metrics { grid-template-columns: 1fr; }
  .hierarchy-grid { grid-template-columns: 1fr; }
  .home-metric, .home-total { height: 92px; }
  .drama-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .profile-wrap { display: block; }
  .login-page { width: calc(100vw - 20px); margin: 10px auto; }
  .login-visual { display: none; }
  .login-form-side { padding: 18px; }
  .login-card { padding: 28px 20px; box-shadow: none; }
  .episode-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .episode-upload-box { grid-template-columns: 1fr; }
  .episode-upload-box > p, .episode-upload-status { grid-column: auto; }
  .drama-preview-detail, .compare-list { grid-template-columns: 1fr; }
  .drama-preview-detail .poster { height: 220px; }
}

/* Hierarchical data scope and per-account tracking */
.scope-wrap { position: relative; }
.scope-btn { height: 34px; max-width: 240px; padding: 0 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #dcdfe6; border-radius: 4px; color: #606266; background: #fff; cursor: pointer; }
.scope-btn:hover { color: #409eff; border-color: #a0cfff; background: #ecf5ff; }
.scope-btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.scope-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-dropdown { width: 390px; max-width: calc(100vw - 28px); padding: 0; overflow: hidden; }
.scope-dropdown-head { padding: 14px 16px 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ebeef5; }
.scope-dropdown-head strong, .scope-dropdown-head small { display: block; }
.scope-dropdown-head small { margin-top: 4px; color: #909399; font-size: 11px; line-height: 1.5; }
.scope-actions { padding: 8px 14px; display: flex; gap: 14px; border-bottom: 1px solid #ebeef5; }
.scope-actions .link-button { padding: 0; border: 0; background: transparent; cursor: pointer; }
.scope-account-list { max-height: 360px; padding: 6px 0; overflow: auto; }
.scope-account { min-height: 54px; padding: 8px 14px 8px calc(14px + var(--scope-depth,0) * 20px); display: flex; align-items: center; gap: 10px; cursor: pointer; }
.scope-account:hover { background: #f5f7fa; }
.scope-account input { width: 16px; height: 16px; accent-color: #409eff; }
.scope-account span, .scope-account strong, .scope-account small { min-width: 0; display: block; }
.scope-account strong { color: #303133; font-size: 13px; }
.scope-account small { margin-top: 3px; overflow: hidden; color: #909399; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.scope-footer { padding: 10px 14px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #ebeef5; background: #fafafa; }
.tracking-owner-panel { margin-bottom: 10px; }
.tracking-owner-row { display: grid; grid-template-columns: minmax(220px,1fr) minmax(320px,520px); align-items: center; gap: 20px; }
.tracking-owner-row p { margin: 5px 0 0; color: #909399; font-size: 12px; }
.binding-manager-row { align-items: start; }
.binding-toolbar { margin-bottom: 10px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #ebeef5; border-radius: 5px; background: #f8fafc; }
.binding-toolbar strong, .binding-toolbar p { display: block; }
.binding-toolbar p { margin: 4px 0 0; color: #909399; font-size: 12px; }
.binding-list { display: grid; gap: 8px; }
.binding-card { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #ebeef5; border-radius: 5px; background: #fff; }
.binding-card-main { min-width: 0; flex: 1; }
.binding-card-title { display: flex; align-items: center; gap: 8px; }
.binding-domains { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.domain-chip { max-width: 280px; padding: 3px 7px; overflow: hidden; border: 1px solid #d9ecff; border-radius: 3px; color: #409eff; background: #ecf5ff; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.binding-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; color: #909399; font-size: 11px; }
.domain-textarea { min-height: 104px; resize: vertical; line-height: 1.6; }
.field > small { margin-top: 5px; display: block; color: #909399; font-size: 11px; line-height: 1.5; }

@media (max-width: 900px) {
  .scope-btn { max-width: 150px; }
  .tracking-owner-row { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 640px) {
  .scope-btn { max-width: 42px; padding: 0 11px; }
  .scope-btn span, .scope-btn svg:last-child { display: none; }
  .scope-dropdown { position: fixed; top: 58px; right: 8px; left: 8px; width: auto; max-width: none; }
  .binding-toolbar, .binding-card { align-items: stretch; flex-direction: column; }
  .binding-toolbar .btn { width: 100%; }
}

.ad-console-panel { height: calc(100vh - 112px); min-height: 620px; overflow: hidden; border: 1px solid #ebeef5; border-radius: 5px; background: #f5f7fa; box-shadow: 0 1px 3px rgba(31,45,61,.05); }
.ad-console-frame { width: 100%; height: 100%; display: block; border: 0; background: #f5f7fa; }

@media (max-width: 900px) {
  .ad-console-panel { height: calc(100vh - 92px); min-height: 560px; border: 0; border-radius: 0; }
}
