:root {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #262f3d;
  background: #e5e9f0;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --nav: #4e5d78;
  --nav-deep: #2d3953;
  --marketing-nav: #061e32;
  --blue: #2878ee;
  --blue-hover: #1768d6;
  --line: #e1e6ed;
  --muted: #8b96a6;
  --panel: #fff;
  --page: #e5e9f0;
  --success: #2ba66a;
  --warning: #e59d2a;
  --danger: #e15b64;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-width: 1024px; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--page); font-size: 12px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-decoration: none; }

.admin-shell { display: grid; grid-template-rows: 36px 56px minmax(0, 1fr); width: 100%; height: 100%; overflow: hidden; background: var(--page); }
.module-strip { display: flex; align-items: flex-end; gap: 2px; padding-left: 178px; color: #dce4f2; background: var(--nav-deep); }
.module-tab { min-width: 118px; height: 36px; border: 0; border-radius: 8px 8px 0 0; color: #dfe6f2; background: transparent; font-size: 12px; }
.module-tab.is-active { color: #60708b; background: #fff; font-weight: 700; }
.global-header { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid #e2e6ec; background: #fff; }
.brand-block { display: flex; height: 56px; align-items: center; padding: 0 20px; color: #fff; background: var(--nav); font-size: 17px; font-weight: 700; }
.admin-shell.is-marketing .brand-block { background: var(--marketing-nav); }
.header-spacer { height: 100%; }
.shop-tools { display: flex; align-items: center; gap: 10px; padding-right: 18px; }
.account-chip { display: grid; min-width: 90px; gap: 1px; padding-left: 10px; border-left: 1px solid #e3e7ed; }
.account-chip b { color: #4d5b70; font-size: 11px; }
.account-chip small { color: #98a2b1; font-size: 9px; }
.logout-button { height: 29px; border: 1px solid #dce2ea; border-radius: 3px; padding: 0 9px; color: #68758a; background: #fff; font-size: 10px; }
.logout-button:hover { color: #bd4c52; background: #fff4f4; }
.status { display: inline-flex; align-items: center; border-radius: 3px; padding: 3px 7px; color: #7b8798; background: #f0f2f5; font-size: 10px; }
.status.success { color: #287751; background: #eaf7f0; }
.status.danger { color: #b4474e; background: #fff0f1; }
.compact-metrics { margin-bottom: 14px; }
.global-search { display: flex; width: 210px; height: 29px; align-items: center; border: 1px solid #d8dee8; background: #fff; }
.global-search input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; padding: 0 9px; color: #59677b; }
.global-search button { width: 32px; height: 100%; border: 0; color: #fff; background: var(--blue); }
.shop-switch { display: flex; height: 29px; align-items: center; gap: 7px; border: 1px solid #dfe4ec; border-radius: 3px; padding: 0 10px; color: #4c596d; background: #fff; }
.shop-switch img { width: 16px; height: 16px; object-fit: contain; }
.publish-button { height: 29px; border: 1px solid var(--blue); border-radius: 3px; padding: 0 12px; color: var(--blue); background: #fff; }

.workspace { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 0; }
.sidebar { display: flex; min-height: 0; flex-direction: column; color: #d7deea; background: var(--nav); overflow: hidden; }
.admin-shell.is-marketing .sidebar { background: var(--marketing-nav); }
.sidebar-scroll { min-height: 0; flex: 1; overflow: auto; padding: 7px 0 16px; scrollbar-width: thin; }
.nav-group-title, .nav-item { display: flex; width: 100%; min-height: 36px; align-items: center; border: 0; text-align: left; }
.nav-group-title { justify-content: space-between; padding: 0 15px; color: #eef2f8; background: transparent; font-weight: 700; }
.nav-group-title span:first-child { display: flex; align-items: center; gap: 9px; }
.nav-group-title i { width: 15px; color: #c9d3e2; font-style: normal; text-align: center; }
.nav-group-title small { color: #b8c3d4; font-size: 10px; }
.nav-group-items { padding-bottom: 3px; }
.nav-item { position: relative; padding: 0 14px 0 40px; color: #d4dbe7; background: transparent; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.is-active { margin: 0 4px; width: calc(100% - 8px); border-radius: 3px; color: #53627c; background: #fff; font-weight: 700; }
.nav-item.is-active::before { position: absolute; left: -4px; width: 3px; height: 22px; background: var(--blue); content: ""; }
.sidebar-status { display: flex; height: 42px; flex: 0 0 auto; align-items: center; gap: 8px; border-top: 1px solid rgba(255,255,255,.11); padding: 0 13px; color: #d9e3ef; font-size: 10px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #36c985; box-shadow: 0 0 0 3px rgba(54,201,133,.13); }

.content { min-width: 0; min-height: 0; overflow: auto; padding: 0 12px 18px; background: var(--page); }
.page-tabs { position: sticky; top: 0; z-index: 4; display: flex; min-height: 49px; align-items: flex-end; gap: 30px; border-bottom: 1px solid #e2e7ee; padding: 0 18px; background: #fff; }
.page-tabs button { position: relative; height: 49px; border: 0; color: #667185; background: transparent; }
.page-tabs button.is-active { color: var(--blue); font-weight: 700; }
.page-tabs button.is-active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--blue); content: ""; }
.page-container { padding-top: 12px; }
.page-heading { display: flex; min-height: 38px; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; padding: 0 3px; }
.page-heading h1 { margin: 0; color: #263040; font-size: 15px; line-height: 26px; }
.page-heading p { margin: 2px 0 0; color: var(--muted); line-height: 1.6; }
.heading-actions, .toolbar-actions { display: flex; align-items: center; gap: 8px; }

.button { display: inline-flex; min-height: 29px; align-items: center; justify-content: center; border: 1px solid #d7dee8; border-radius: 3px; padding: 0 11px; color: #58667a; background: #fff; white-space: nowrap; }
.button:hover { border-color: #8bb4ee; color: var(--blue); }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.primary:hover { background: var(--blue-hover); }
.button.danger { color: var(--danger); }
.button.wide { width: 100%; }
.button.icon-only { width: 30px; padding: 0; font-size: 16px; }
.text-button { border: 0; padding: 0 5px; color: var(--blue); background: transparent; }
.text-button.danger { color: var(--danger); }
.icon-button { width: 30px; height: 30px; border: 0; color: #778296; background: transparent; font-size: 20px; }
.icon-button:hover { color: #2a3546; background: #f1f3f7; }

.panel { margin-bottom: 12px; border: 1px solid #e1e6ed; border-radius: 3px; background: #fff; }
.panel-header { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e6eaf0; padding: 0 16px; }
.panel-header h2 { margin: 0; font-size: 13px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); }
.panel-body { padding: 15px 17px; }
.panel-body.flush { padding: 0; }
.notice { display: flex; min-height: 42px; align-items: center; gap: 10px; margin-bottom: 12px; border: 1px solid #cfe0f7; border-radius: 3px; padding: 0 14px; color: #4d6f9c; background: #eef6ff; }
.notice.warning { border-color: #f2dfb4; color: #91661c; background: #fff8e9; }
.notice.success { border-color: #c9ead9; color: #277a50; background: #edf9f3; }

.toolbar { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #e1e6ed; border-radius: 3px; margin-bottom: 10px; padding: 10px 14px; background: #fff; }
.toolbar-main { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-field { display: flex; width: 260px; height: 31px; align-items: center; border: 1px solid #d8dfe9; border-radius: 3px; background: #fff; }
.search-field input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; padding: 0 10px; }
.search-field button { width: 32px; height: 100%; border: 0; color: #7a8798; background: transparent; }
.select, .input { height: 31px; border: 1px solid #d8dfe9; border-radius: 3px; outline: 0; padding: 0 9px; color: #536176; background: #fff; }
.select:focus, .input:focus, textarea:focus { border-color: #76a9ed; box-shadow: 0 0 0 2px rgba(40,120,238,.08); }
.segmented { display: inline-flex; height: 31px; border: 1px solid #d8dfe9; border-radius: 3px; padding: 2px; background: #f5f7fa; }
.segmented button { min-width: 52px; border: 0; border-radius: 2px; padding: 0 9px; color: #667285; background: transparent; }
.segmented button.is-active { color: var(--blue); background: #fff; box-shadow: 0 1px 3px rgba(37,54,80,.1); font-weight: 700; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chip { display: inline-flex; min-height: 24px; align-items: center; border-radius: 3px; padding: 0 8px; color: #6f7d91; background: #f0f3f7; }
.chip.blue { color: #3170c7; background: #e9f2ff; }
.chip.green { color: #2b8a5b; background: #e9f7f0; }
.chip.orange { color: #a86b16; background: #fff3dd; }
.chip.red { color: #b84f55; background: #fcecee; }
.count { display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 9px; padding: 0 5px; color: #fff; background: #ef555d; font-size: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.metric { min-height: 100px; border: 1px solid #e1e6ed; border-radius: 3px; padding: 16px; background: #fff; }
.metric span { color: #7d8999; }
.metric strong { display: block; margin-top: 12px; color: #263246; font-size: 26px; font-weight: 500; }
.metric small { margin-left: 5px; color: #9ba4b2; }
.metric em { display: block; margin-top: 7px; color: #2c9a67; font-style: normal; }
.dashboard-grid { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 12px; }
.donut-box { min-height: 448px; padding: 20px 16px 14px; background: #edf5ff; }
.donut-row { display: grid; grid-template-columns: 142px minmax(0, 1fr); align-items: center; gap: 12px; }
.donut { display: grid; width: 128px; height: 128px; place-items: center; border: 23px solid #7eaaf5; border-radius: 50%; background: #fff; }
.donut strong { color: #2b3b54; font-size: 24px; }
.donut-legend { display: grid; gap: 12px; }
.donut-legend div { border-left: 3px solid #7eaaf5; padding-left: 10px; }
.donut-legend div:nth-child(2) { border-color: #ee9b86; }
.donut-legend b, .donut-legend span { display: block; }
.donut-legend span { margin-top: 4px; color: #8894a4; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.mode-card { min-height: 170px; border: 1px solid #bcd5fb; border-radius: 3px; padding: 12px; color: #536177; background: #fff; }
.mode-card.is-duty { border-color: #f2c9bf; }
.mode-card > b { display: block; margin-bottom: 12px; color: #4b86dd; text-align: center; }
.mode-card.is-duty > b { color: #df745c; }
.mode-card span { display: block; margin-top: 10px; padding-left: 9px; border-left: 3px solid #7da9f2; }
.mode-card span:nth-of-type(2) { border-color: #eea07e; }
.mode-card span:nth-of-type(3) { border-color: #ed7080; }
.manpower-note { margin-top: 10px; border-radius: 18px; padding: 9px 12px; color: #8a674a; background: #ffe7da; text-align: center; }
.chart-wrap { min-height: 448px; padding: 8px 14px 5px; }
.chart-wrap.double { display: grid; grid-template-rows: 1fr 1fr; gap: 5px; }
.chart-wrap canvas { width: 100%; height: 210px; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-pair .panel-body { min-height: 180px; }
.large-number { margin: 18px 0 5px; color: #263449; font-size: 34px; font-weight: 500; }
.progress { width: 100%; height: 8px; border-radius: 4px; background: #edf0f4; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 4px; background: #70a3f3; }

.table-wrap { width: 100%; overflow: auto; border: 1px solid #e1e6ed; border-radius: 3px; background: #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 42px; padding: 0 12px; color: #4b5768; background: #e5e9f0; text-align: left; font-weight: 700; }
td { height: 48px; border-top: 1px solid #ebeff4; padding: 8px 12px; color: #596678; vertical-align: middle; }
tbody tr:hover td { background: #f8fafc; }
td.muted { color: #9aa3b0; }
.cell-title { display: block; color: #374456; font-weight: 700; }
.cell-subtitle { display: block; margin-top: 4px; color: #98a2b0; font-size: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.product-cell { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 10px; }
.product-cell img { width: 58px; height: 58px; border: 1px solid #e2e6ec; object-fit: cover; }
.product-cell b { display: block; color: #3c4858; font-weight: 500; line-height: 1.5; }
.product-cell small { display: block; margin-top: 4px; color: #939eae; }
.product-table td { height: 75px; }
.empty-state { display: grid; min-height: 210px; place-content: center; gap: 8px; color: #a0a9b6; text-align: center; }
.empty-state b { color: #758195; font-size: 13px; }

.scene-list { display: grid; gap: 10px; }
.scene-card { border: 1px solid #e0e5ec; border-radius: 3px; background: #fff; }
.scene-card-header { display: flex; min-height: 43px; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0f4; padding: 0 14px; background: #f8f6ff; }
.scene-card-header h3 { margin: 0; font-size: 12px; }
.scene-card-body { display: grid; grid-template-columns: 28% 34% minmax(0, 1fr); min-height: 116px; }
.scene-column { border-right: 1px solid #edf0f4; padding: 13px 14px; }
.scene-column:last-child { border-right: 0; }
.scene-label { display: block; margin-bottom: 9px; color: #8793a3; font-size: 10px; }
.keywords { display: flex; flex-wrap: wrap; gap: 5px; }
.keywords span { border-radius: 2px; padding: 3px 6px; color: #3972bc; background: #eaf2ff; }
.reply-bubble { border-radius: 3px; padding: 10px 12px; color: #526073; background: #f4f6f8; line-height: 1.6; }
.switch { display: inline-flex; align-items: center; gap: 6px; color: #69778b; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: relative; display: block; width: 32px; height: 18px; border-radius: 9px; background: #bdc6d2; }
.switch i::after { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; content: ""; transition: transform .15s ease; }
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::after { transform: translateX(14px); }

.settings-form { display: grid; gap: 0; }
.setting-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 90px; border-bottom: 1px solid #edf0f4; padding: 16px 18px; }
.setting-row:last-child { border-bottom: 0; }
.setting-label b { display: block; color: #394557; }
.setting-label span { display: block; margin-top: 6px; color: #98a2b1; line-height: 1.6; }
.setting-control { display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 12px; color: #596679; }
.radio-row { display: flex; flex-wrap: wrap; gap: 18px; }
.radio-row label { display: flex; align-items: center; gap: 6px; }
.field-note { width: 100%; border-left: 3px solid #91baf1; padding: 8px 10px; color: #6d7b8f; background: #eef6ff; }
.stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; border: 1px solid #e1e6ed; background: #fff; }
.step { display: flex; min-height: 64px; align-items: center; gap: 10px; padding: 0 20px; color: #8b96a6; }
.step b { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid #cfd7e2; border-radius: 50%; }
.step.is-active { color: var(--blue); }
.step.is-active b { border-color: var(--blue); color: #fff; background: var(--blue); }
.seat-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.seat-metric { border: 1px solid #e1e6ed; border-radius: 3px; padding: 18px; background: #fff; }
.seat-metric strong { display: block; margin-top: 9px; font-size: 26px; font-weight: 500; }
.seat-metric span { color: #7e8a9b; }

.marketing-flow { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 14px; margin-bottom: 12px; padding: 12px; border: 1px solid #e1e6ed; background: #fff; }
.flow-item { position: relative; display: grid; min-height: 88px; place-content: center; gap: 8px; border-radius: 3px; color: #536176; background: #f4f6f9; text-align: center; }
.flow-item.is-active { color: #fff; background: #7b6ed0; }
.flow-item strong { font-size: 14px; }
.ai-compose { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; }
.ai-sidebar { min-height: 520px; border: 1px solid #e1e6ed; padding: 18px; background: #fff; }
.ai-sidebar h2 { margin: 0 0 18px; font-size: 15px; }
.ai-main { min-height: 520px; border: 1px solid #e1e6ed; padding: 24px; background: #fff; }
.ai-welcome { display: grid; min-height: 160px; place-content: center; gap: 8px; text-align: center; }
.ai-welcome img { width: 50px; height: 50px; margin: 0 auto; object-fit: contain; }
.ai-main textarea { width: 100%; min-height: 170px; border: 1px solid #d9e0e9; border-radius: 3px; padding: 12px; resize: vertical; }

.editor-drawer { position: fixed; z-index: 30; top: 0; right: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(720px, 62vw); height: 100%; background: #fff; box-shadow: -12px 0 36px rgba(28,40,59,.18); transform: translateX(105%); transition: transform .18s ease; }
.editor-drawer.is-open { transform: translateX(0); }
.editor-drawer > header { display: flex; min-height: 62px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid #e3e7ed; padding: 15px 18px; }
.editor-drawer h2 { margin: 0; font-size: 14px; }
.editor-drawer header p { margin: 5px 0 0; color: #8f99a8; font-size: 10px; }
.drawer-body { min-height: 0; overflow: auto; padding: 18px; }
.editor-drawer > footer { display: flex; min-height: 58px; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid #e3e7ed; padding: 0 18px; }
.backdrop { position: fixed; z-index: 29; inset: 0; background: rgba(21,29,42,.53); }
.drawer-section { margin-bottom: 22px; }
.drawer-section h3 { margin: 0 0 13px; color: #344052; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; color: #5f6c7e; }
.field.span-two { grid-column: span 2; }
.field > span b { color: var(--danger); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d8dfe8; border-radius: 3px; outline: 0; color: #3e4a5b; background: #fff; }
.field input, .field select { height: 34px; padding: 0 9px; }
.field textarea { min-height: 96px; padding: 9px; resize: vertical; line-height: 1.6; }
.field small { color: #9aa3b0; }
.check-grid { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.check-grid label { display: flex; align-items: center; gap: 6px; color: #657286; }

dialog { border: 0; border-radius: 6px; padding: 0; box-shadow: 0 22px 70px rgba(24,36,55,.28); }
dialog::backdrop { background: rgba(21,29,42,.48); }
.auth-dialog { width: 390px; }
.auth-dialog form { padding: 22px; }
.auth-dialog header { margin-bottom: 18px; }
.auth-dialog h2 { margin: 0; font-size: 17px; }
.auth-dialog p { margin: 6px 0 0; color: #8994a4; }
.auth-dialog .field { margin-bottom: 12px; }
.form-error { color: var(--danger) !important; }
.toast { position: fixed; z-index: 60; right: 22px; bottom: 22px; max-width: 360px; border: 1px solid #c8e7d7; border-radius: 3px; padding: 11px 14px; color: #26724d; background: #effaf4; box-shadow: 0 8px 24px rgba(34,66,49,.12); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .16s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: #ecc9cc; color: #a74349; background: #fff4f4; }

@media (max-width: 1180px) {
  html, body, #app { min-width: 900px; }
  .workspace { grid-template-columns: 142px minmax(0, 1fr); }
  .global-header { grid-template-columns: 142px minmax(0, 1fr) auto; }
  .brand-block { padding: 0 12px; font-size: 15px; }
  .module-strip { padding-left: 126px; }
  .dashboard-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-tools .global-search { display: none; }
}

@media (max-width: 760px) {
  html, body, #app { min-width: 0; }
  .admin-shell { grid-template-rows: 38px 48px minmax(0, 1fr); }
  .module-strip { padding-left: 0; }
  .module-tab { min-width: 50%; height: 38px; }
  .global-header { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-block { background: var(--nav-deep); }
  .header-spacer, .publish-button { display: none; }
  .workspace { grid-template-columns: 54px minmax(0, 1fr); }
  .sidebar { overflow: visible; }
  .nav-group-title { justify-content: center; padding: 0; }
  .nav-group-title span:first-child { gap: 0; }
  .nav-group-title span:first-child span, .nav-group-title small, .nav-group-items, .sidebar-status span { display: none; }
  .nav-group-title i { font-size: 15px; }
  .sidebar-status { justify-content: center; padding: 0; }
  .content { padding-right: 7px; padding-left: 7px; }
  .page-tabs { gap: 18px; overflow-x: auto; padding: 0 10px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-main { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .metric-grid, .stat-pair, .seat-metrics, .ai-compose { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .scene-card-body { grid-template-columns: 1fr; }
  .scene-column { border-right: 0; border-bottom: 1px solid #edf0f4; }
  .setting-row { grid-template-columns: 1fr; gap: 12px; }
  .marketing-flow { grid-template-columns: 1fr 1fr; }
  .editor-drawer { width: 100%; }
}
