:root {
  --bg: #f4f6f9;
  --surface-2: #f8fafc;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 60px rgba(2, 6, 23, 0.28);
}

body { font-size: 13.5px; line-height: 1.5; }
svg.ic { width: 15px; height: 15px; }
svg.ic-sm { width: 13px; height: 13px; }

/* ===== 顶部全局效率条 ===== */
.topbar {
  height: 50px; background: #090e1a; color: #e2e8f0; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 70; border-bottom: 1px solid #1e293b;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: #fff; }
.top-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: #1e293b; color: #94a3b8; border: 1px solid #334155; font-weight: 600;
}
.cmd-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #0f172a; border: 1px solid #334155; color: #94a3b8; padding: 5px 12px;
  border-radius: 8px; font-size: 12.5px; cursor: pointer; min-width: 280px; transition: 0.15s;
}
.cmd-btn:hover { border-color: #60a5fa; color: #f8fafc; }
.kbd {
  background: #1e293b; border: 1px solid #475569; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; color: #cbd5e1; font-family: ui-monospace, Consolas, monospace;
}
.role-select {
  background: #0f172a; color: #fde68a; border: 1px solid #334155; padding: 5px 10px;
  border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; outline: none;
}
.top-link {
  display: inline-flex; align-items: center; gap: 5px; color: #93c5fd; text-decoration: none;
  font-size: 12px; font-weight: 600; padding: 5px 11px; background: #1e293b; border: 1px solid #334155;
  border-radius: 7px; transition: 0.15s;
}
.top-link:hover { background: #334155; color: #fff; }

/* ===== 主框架与企业级精致深色侧栏 ===== */
.layout { display: flex; min-height: calc(100vh - 50px); }
.sidebar {
  width: 248px; background: #0b1120; color: #94a3b8; display: flex; flex-direction: column;
  position: sticky; top: 50px; height: calc(100vh - 50px); border-right: 1px solid #1e293b;
  flex-shrink: 0; transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1); z-index: 50;
}
.sidebar.collapsed { width: 64px; }
.sb-top {
  padding: 12px 12px 10px; border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar.collapsed .sb-top { justify-content: center; padding: 12px 8px; }
.sb-brand-mini { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sb-logo {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff; font-weight: 800; font-size: 11px; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(59,130,246,0.35);
}
.sb-collapse-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); color: #94a3b8; display: grid; place-items: center;
  cursor: pointer; transition: 0.15s; flex-shrink: 0;
}
.sb-collapse-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sb-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0 14px; }
.sb-scroll::-webkit-scrollbar { width: 4px; }
.sb-scroll::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 99px; }

.sb-tenant-box {
  margin: 6px 10px 10px; padding: 9px 10px; border-radius: 9px;
  background: rgba(30, 41, 59, 0.55); border: 1px solid rgba(148, 163, 184, 0.14);
}
.sb-tenant-select {
  width: 100%; background: #0f172a; color: #f8fafc; border: 1px solid #334155;
  border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 500;
  margin-top: 6px; cursor: pointer; outline: none; font-family: inherit;
}
.sb-tenant-select:focus { border-color: #60a5fa; }

.nav-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 4px; font-size: 11px; font-weight: 600; color: #64748b;
  letter-spacing: 0.4px; cursor: pointer; user-select: none; transition: 0.15s;
}
.nav-group-hd:hover { color: #94a3b8; }
.nav-group-chevron { transition: transform 0.18s; display: inline-flex; opacity: 0.7; }
.nav-group-hd.closed .nav-group-chevron { transform: rotate(-90deg); }
.sidebar.collapsed .nav-group-hd { padding: 8px 0 4px; justify-content: center; pointer-events: none; }
.sidebar.collapsed .nav-group-hd::before { content: ""; width: 24px; height: 1px; background: rgba(148,163,184,0.18); }
.sidebar.collapsed .nav-group-hd span { display: none; }
.sidebar.collapsed .sb-hide { display: none !important; }

.nav-item {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  margin: 2px 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  color: #cbd5e1; font-size: 13px; font-weight: 500; transition: all 0.15s ease;
}
.nav-item .nav-left { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.nav-item .nav-left svg { color: #64748b; transition: color 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #f8fafc; }
.nav-item:hover .nav-left svg { color: #cbd5e1; }
.nav-item.active {
  background: rgba(37, 99, 235, 0.18); color: #ffffff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.32);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -9px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: #3b82f6;
}
.nav-item.active .nav-left svg { color: #60a5fa; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; margin: 3px 9px; }

.nav-subtree {
  margin: 2px 10px 6px 22px; padding-left: 10px;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
}
.nav-subitem {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 9px; border-radius: 6px; margin-bottom: 1px; cursor: pointer;
  font-size: 12px; color: #94a3b8; transition: 0.14s;
}
.nav-subitem:hover { background: rgba(255,255,255,0.05); color: #f1f5f9; }
.nav-subitem.active { background: rgba(59,130,246,0.16); color: #93c5fd; font-weight: 600; }

.nav-cnt {
  font-size: 10.5px; padding: 1px 6.5px; border-radius: 99px; font-weight: 600;
  background: rgba(148, 163, 184, 0.14); color: #cbd5e1; line-height: 1.45;
}
.nav-cnt.red { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.nav-cnt.warn { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.nav-cnt.green { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.28); }
.nav-dot {
  position: absolute; top: 6px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; box-shadow: 0 0 0 2px #0b1120; display: none;
}
.sidebar.collapsed .nav-dot { display: block; }

.sb-foot { margin-top: auto; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.06); background: #080d18; }
.sb-user {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); cursor: pointer; transition: 0.15s;
}
.sb-user:hover { background: rgba(255,255,255,0.06); }
.sb-avatar {
  width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar.collapsed .sb-foot { padding: 10px 8px; }
.sidebar.collapsed .sb-user { justify-content: center; padding: 6px 0; }

.mob-menu-btn {
  display: none; background: #1e293b; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 6px; width: 30px; height: 30px; place-items: center; cursor: pointer;
}
.sb-backdrop { display: none; position: fixed; inset: 50px 0 0 0; background: rgba(2,6,23,0.55); z-index: 48; }
.sb-backdrop.open { display: block; }

.main { flex: 1; padding: 20px 26px 84px; min-width: 0; max-width: 1620px; margin: 0 auto; width: 100%; }
.admin-workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-pagetabs {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 6px 20px 0;
  display: flex; align-items: center; gap: 4px; overflow-x: auto; position: sticky; top: 50px; z-index: 45;
}
.admin-pagetabs::-webkit-scrollbar { height: 3px; }
.admin-pagetab {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; font-size: 12px; font-weight: 500;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; cursor: pointer; white-space: nowrap; transition: 0.14s; margin-bottom: -1px;
}
.admin-pagetab:hover { color: var(--text); background: #fff; }
.admin-pagetab.active { color: var(--primary); background: var(--bg); font-weight: 700; border-color: var(--border); padding-bottom: 8px; }
.admin-pagetab-close {
  width: 16px; height: 16px; border-radius: 4px; border: none; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; font-size: 12px; line-height: 1;
}
.admin-pagetab-close:hover { background: rgba(15,23,42,0.08); color: var(--danger); }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.14s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; display: flex; align-items: center; gap: 8px; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ===== 运营后台控件覆写 ===== */
.grid { display: grid; gap: 14px; }
.grid-4, .grid-3, .grid-2 { gap: 14px; }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: 1.55fr 1fr; }

.card { padding: 16px 18px; min-width: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.card-head { margin-bottom: 12px; gap: 8px; }
.card-title { font-size: 14px; }

.kpi-label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.kpi-num { font-size: 26px; font-weight: 800; margin: 5px 0 3px; letter-spacing: -0.5px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); }

.btn { gap: 5px; padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12.5px; }
.btn-xs { padding: 3.5px 8px; font-size: 11.5px; border-radius: 6px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.tag.blue { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.tag.green { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.tag.red { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.tag.ai { background: var(--ai-soft); color: var(--ai); border-color: var(--ai-border); }

.input, .select, .textarea { padding: 7px 10px; font-size: 12.5px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text-2); }
.w-full { width: 100%; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tabs { border-radius: 8px; }
.tab {
  padding: 5px 12px; border-radius: 6px; border: none; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; transition: 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }

table { font-size: 12.5px; }
th { padding: 9px 10px; font-size: 11.5px; background: var(--surface-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }
td { padding: 10px; }
tr.suspended td { background: #fff5f5; opacity: 0.8; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between; padding-top: 12px;
  margin-top: 6px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--muted);
}

.alert-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; border-radius: 9px; border: 1px solid var(--border); margin-bottom: 8px; font-size: 12.5px;
}
.alert-row.err { background: var(--danger-soft); border-color: var(--danger-border); }
.alert-row.warn { background: var(--warn-soft); border-color: var(--warn-border); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.ok { background: var(--success); }
.status-dot.warn { background: var(--warn); }
.status-dot.err { background: var(--danger); }

.bulk-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px;
  display: none; align-items: center; gap: 10px; box-shadow: 0 14px 36px rgba(2,6,23,0.35); z-index: 65;
}
.bulk-bar.show { display: flex; animation: fadeIn 0.15s ease; }

/* 抽屉与弹窗覆写 */
.drawer-mask { background: rgba(2,6,23,0.48); z-index: 80; }
.drawer { width: 820px; box-shadow: -12px 0 36px rgba(0,0,0,0.22); }
.drawer.narrow { width: 580px; }
.drawer-head { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); gap: 10px; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; justify-content: flex-end; gap: 8px; }

.modal-mask { background: rgba(2,6,23,0.52); }
.modal { border-radius: 14px; max-width: 600px; max-height: 88vh; }
.modal.wide { max-width: 820px; }
.modal-head { padding: 14px 18px; }
.modal-body { padding: 16px 18px; }
.modal-foot { padding: 12px 18px; background: var(--surface-2); }

/* Cmd+K 命令面板 */
.cmd-modal { max-width: 640px; margin-top: -12vh; }
.cmd-input { width: 100%; border: none; border-bottom: 1px solid var(--border); padding: 14px 18px; font-size: 14px; outline: none; font-family: inherit; }
.cmd-item { padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.cmd-item:hover, .cmd-item.selected { background: var(--primary-soft); }

.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.asset-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.asset-thumb { height: 96px; padding: 10px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; }

.word-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border);
}
.word-chip button { border: none; background: transparent; color: inherit; cursor: pointer; font-weight: 700; padding: 1px 5px; border-radius: 99px; line-height: 1.1; }
.word-chip button:hover { background: rgba(220, 38, 38, 0.14); }

code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; color: #0f172a; }
pre.code-block {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px;
  font-size: 11.5px; font-family: ui-monospace, Consolas, monospace; overflow-x: auto; line-height: 1.55;
}

.toast { bottom: 22px; right: 22px; padding: 10px 16px; border-radius: 9px; font-size: 12.5px; max-width: 460px; }
.toast.show { animation: fadeIn 0.16s; }
.empty-state { padding: 36px 20px; border-radius: 10px; background: var(--surface-2); }

/* 租户网站全能代管工作台专用样式 */
.studio-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #f8fafc;
  border-radius: 12px; padding: 16px 20px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.studio-tabs-bar { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; margin-bottom: 14px; display: flex; gap: 4px; flex-wrap: wrap; }
.studio-tab {
  padding: 7px 13px; border-radius: 7px; border: none; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: 0.15s;
}
.studio-tab:hover { background: var(--surface-2); color: var(--text); }
.studio-tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(37,99,235,0.28); }

.split-studio { display: grid; grid-template-columns: 1.05fr 1fr; gap: 14px; align-items: start; }
.preview-shell { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); position: sticky; top: 96px; transition: max-width 0.2s; }
.preview-shell.mobile { max-width: 390px; margin: 0 auto; border: 7px solid #1e293b; border-radius: 28px; }
.preview-chrome { background: #f1f5f9; border-bottom: 1px solid var(--border); padding: 7px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.switch { width: 36px; height: 20px; background: #cbd5e1; border-radius: 99px; position: relative; cursor: pointer; transition: 0.2s; display: inline-block; flex-shrink: 0; border: none; }
.switch.on { background: var(--success); }
.switch:disabled { opacity: 0.45; cursor: not-allowed; }
.switch::after { content: ""; width: 14px; height: 14px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: 0.2s; }
.switch.on::after { left: 19px; }

.editor-bar { display: flex; gap: 5px; flex-wrap: wrap; padding: 7px 9px; background: var(--surface-2); border: 1px solid var(--border); border-bottom: none; border-radius: 7px 7px 0 0; }

@media (max-width: 1180px) {
  .grid-4, .grid-5, .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side, .grid-3, .grid-2, .split-studio { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .mob-menu-btn { display: grid; }
  .sidebar { position: fixed; left: 0; top: 50px; bottom: 0; height: calc(100vh - 50px); transform: translateX(-100%); transition: transform 0.2s ease; width: 256px !important; }
  .sidebar.mob-open { transform: translateX(0); box-shadow: 12px 0 32px rgba(2,6,23,0.4); }
  .cmd-btn { min-width: 140px; }
  .top-badge { display: none; }
}
