/* ============================================================================
 * 云聊 YunChat 管理中台 — Style 15: 电光蓝高科 (SaaS Pro / High-Tech SaaS Boutique)
 * 遵循 ui-ux-pro-max (#72 SaaS Boutique & #86 Fluent 2) + Tasteskill v2 规范:
 * - 冰川灰蓝工作台底色 (#F4F7FB) + 纯白建筑感几何面板 (#FFFFFF)
 * - 1px 冷钢蓝灰分割线 (#DBE4F0 / #C2D1E5) + 6px 紧凑圆角，零毛玻璃/零彩球光斑
 * - 硅谷电光蓝 (#0052FF) 强调色 + 14px 极细线性图标 + IBM Plex Mono 等宽数字对齐
 * ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Albert+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Style 15: 电光蓝高科 (SaaS Pro Default) */
  --ground: #f4f7fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --raised: #edf2f9;
  --active: #ebf2ff;
  --border: #dbe4f0;
  --border-strong: #c2d1e5;
  --rule: #e2e8f0;
  --control: #cbd5e1;
  --card-shadow: none;
  --card-shadow-lg: 0 4px 12px rgba(10, 25, 47, 0.06);

  --text: #0a192f;
  --muted: #334155;
  --faint: #334155;
  --primary: #0052ff;
  --primary-2: #0045d8;
  --primary-hover: #0045d8;
  --primary-soft: #ebf2ff;
  --primary-border: #bfd4ff;
  --accent: #0052ff;
  --positive: #059669;
  --negative: #dc2626;
  --warning: #d97706;
  --chart-1: #0052ff;
  --chart-2: #0284c7;
  --chart-3: #059669;

  --pill-positive-bg: #ecfdf5;
  --pill-positive-ink: #047857;
  --pill-positive-border: #a7f3d0;
  --pill-negative-bg: #fef2f2;
  --pill-negative-ink: #b91c1c;
  --pill-negative-border: #fecaca;
  --pill-warning-bg: #fffbeb;
  --pill-warning-ink: #b45309;
  --pill-warning-border: #fde68a;
  --pill-neutral-bg: #ebf2ff;
  --pill-neutral-ink: #0052ff;
  --pill-neutral-border: #bfd4ff;

  --radius-sheet: 6px;
  --radius-card: 6px;
  --radius-control: 5px;
  --sheet-inset: 10px;
  --sidebar-width: 232px;
  --header-height: 48px;
  --tabs-height: 38px;
  --gap: 14px;
  --pad: 18px;
  --row-height: 44px;
  --control-height: 32px;
  --cell-py: 10px;
  --cell-px: 14px;

  --font: "Albert Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Albert Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;

  --fs-title: 18px;
  --fs-section: 14px;
  --fs-kpi: 24px;
  --fs-body: 13.5px;
  --fs-small: 13px;
}

/* 青灰护眼主题 (Polaris Emerald Flat) */
[data-theme="mint"] {
  --ground: #f1f5f4;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --raised: #e6efec;
  --active: #e6f4ef;
  --border: #cfe0da;
  --border-strong: #b5cec5;
  --primary: #008060;
  --primary-2: #006e52;
  --primary-hover: #006e52;
  --primary-soft: #e6f4ef;
  --primary-border: #a7d7c5;
  --accent: #008060;
  --chart-1: #008060;
}

/* 纯黑终端主题 (Linear Carbon Dark) */
[data-theme="dark"] {
  --ground: #08090a;
  --surface: #111318;
  --surface-elevated: #151821;
  --raised: #1a1e29;
  --active: rgba(0, 82, 255, 0.22);
  --border: #222634;
  --border-strong: #2e3446;
  --rule: #1e2230;
  --control: #334155;
  --card-shadow: none;
  --card-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);

  --text: #f1f5f9;
  --muted: #94a3b8;
  --faint: #64748b;
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-border: rgba(59, 130, 246, 0.36);
  --accent: #3b82f6;
  --chart-1: #3b82f6;

  --pill-positive-bg: rgba(16, 185, 129, 0.14);
  --pill-positive-ink: #34d399;
  --pill-positive-border: rgba(16, 185, 129, 0.30);
  --pill-negative-bg: rgba(239, 68, 68, 0.14);
  --pill-negative-ink: #f87171;
  --pill-negative-border: rgba(239, 68, 68, 0.30);
  --pill-warning-bg: rgba(245, 158, 11, 0.14);
  --pill-warning-ink: #fbbf24;
  --pill-warning-border: rgba(245, 158, 11, 0.30);
  --pill-neutral-bg: rgba(59, 130, 246, 0.16);
  --pill-neutral-ink: #60a5fa;
  --pill-neutral-border: rgba(59, 130, 246, 0.34);
}

[data-density="compact"] {
  --cell-py: 7px;
  --cell-px: 11px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font);
  background: var(--ground);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 数字等宽对齐 */
.num,
.kpi-value,
.node-addr,
.cms-table td.num,
.cms-table th.num,
#navOnlineBadge,
#kpiTotalUsers,
#kpiTotalMessages,
#kpiRedPacketAmount,
#kpiRedPacketCount,
#kpiNodesOnline,
#kpiMysqlTables,
#rpTotalAmount,
#rpTotalCount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 整体全屏工作台布局 (零悬浮彩球/零毛玻璃) */
.cms-layout {
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  background: var(--ground);
  overflow: hidden;
}

/* 左侧高科建筑感导航栏 */
.cms-sidebar {
  width: var(--sidebar-width);
  margin: var(--sheet-inset) 0 var(--sheet-inset) var(--sheet-inset);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  box-shadow: var(--card-shadow);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 30;
  padding: 8px 0 10px;
  transition: width 0.18s ease, transform 0.18s ease;
}

.cms-layout.collapsed .cms-sidebar {
  width: 60px;
}

.cms-layout.collapsed .brand-text,
.cms-layout.collapsed .nav-label,
.cms-layout.collapsed .nav-group-title,
.cms-layout.collapsed .nav-badge,
.cms-layout.collapsed .sidebar-footer-info {
  display: none;
}

.sidebar-brand {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text .brand-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-text span {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--faint);
  display: block;
  white-space: nowrap;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
}

.nav-group-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--faint);
  padding: 14px 8px 5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-group-title:first-child {
  padding-top: 4px;
}

.nav-item {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.nav-item:hover {
  background: var(--raised);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: currentColor;
}

.nav-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  margin: 6px 10px 0;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  background: var(--raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  flex-shrink: 0;
}

/* 右侧主工作区 */
.cms-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  padding: var(--sheet-inset);
  gap: 10px;
}

/* 顶部 48px 建筑感工具栏 */
.cms-header {
  height: var(--header-height);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  transition: all 140ms ease;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.icon-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb h1 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 角色快速切换器 */
.role-switcher {
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--raised);
  border: 1px solid var(--border);
  padding: 0 10px;
  border-radius: var(--radius-control);
  font-size: 13px;
  color: var(--muted);
}

.role-switcher select {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* 主工作区画布 */
.cms-sheet {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* 顶栏下方多页签栏 */
.cms-tabs-bar {
  height: var(--tabs-height);
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all 120ms ease;
}

.tab-chip:hover {
  background: var(--surface);
  color: var(--text);
}

.tab-chip.active {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--primary);
  font-weight: 600;
}

.tab-chip .close-tab {
  font-size: 13px;
  color: var(--faint);
  padding: 0 2px;
}

.tab-chip .close-tab:hover {
  color: var(--negative);
}

/* 内容滚动区 */
.cms-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--pad);
  background: var(--ground);
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* 页面标题行 */
.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-title-main {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-title-sub {
  font-size: 13px;
  color: var(--muted);
  margin-left: 8px;
}

/* KPI 矩阵卡片 (SaaS Pro Architectural KPI Grid) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: var(--gap);
}

.kpi-card {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  transition: border-color 140ms ease;
}

.kpi-card:hover {
  border-color: var(--border-strong);
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: var(--fs-kpi);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-value.money {
  color: var(--primary);
}

.kpi-foot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-icon {
  display: none;
}

/* 通用业务面板卡片 (Flat SaaS Panels) */
.panel-grid-2 {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
  align-items: stretch;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  margin-bottom: var(--gap);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 12px 16px;
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.panel-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* 按钮与表单控件 */
.btn {
  height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-danger {
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
  border-color: var(--pill-negative-border);
}

.btn-danger:hover {
  background: var(--negative);
  border-color: var(--negative);
  color: #ffffff;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.input, .select, .textarea {
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.textarea {
  height: auto;
  padding: 8px 11px;
  line-height: 1.5;
  resize: vertical;
}

.input::placeholder, .textarea::placeholder {
  color: var(--faint);
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 82, 255, 0.14);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 数据表格 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.cms-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cms-table th {
  background: var(--raised);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 9px var(--cell-px);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cms-table td {
  padding: var(--cell-py) var(--cell-px);
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  transition: background-color 120ms ease;
}

.cms-table tbody tr:last-child td {
  border-bottom: none;
}

.cms-table tbody tr:hover td {
  background: var(--active);
}

.cms-table th.num,
.cms-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.mono-id {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 状态标签 (Crisp Technical Badges) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}

.tag-success {
  background: var(--pill-positive-bg);
  color: var(--pill-positive-ink);
  border-color: var(--pill-positive-border);
}

.tag-warning {
  background: var(--pill-warning-bg);
  color: var(--pill-warning-ink);
  border-color: var(--pill-warning-border);
}

.tag-danger {
  background: var(--pill-negative-bg);
  color: var(--pill-negative-ink);
  border-color: var(--pill-negative-border);
}

.tag-info {
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
  border-color: var(--pill-neutral-border);
}

/* 用户方形技术徽章头像 */
.user-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 19 节点健康监控网格 (Architectural Node Tiles) */
.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.node-box {
  padding: 10px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 140ms ease;
}

.node-box:hover {
  border-color: var(--primary-border);
  background: var(--raised);
}

.node-info {
  min-width: 0;
  flex: 1;
}

.node-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-addr {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Switch 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--control);
  transition: background-color 0.18s ease;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: transform 0.18s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* 浮层抽屉与弹窗 */
.drawer-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 47, 0.45);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.drawer-backdrop.open, .modal-backdrop.open {
  display: flex;
}

.theme-drawer {
  position: fixed;
  right: 10px;
  top: 10px;
  bottom: 10px;
  width: 300px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow-lg);
  padding: 18px;
  z-index: 110;
  overflow-y: auto;
}

.color-swatches {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 120ms ease;
}

.color-swatch:hover {
  transform: scale(1.06);
}

.color-swatch.active {
  border-color: var(--text);
}

.modal-card {
  width: 460px;
  max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow-lg);
  overflow: hidden;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.form-row .input, .form-row .select, .form-row .textarea {
  width: 100%;
}

/* 权限矩阵网格 */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.perm-item:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

/* Toast 提示 */
.cms-toast {
  position: fixed;
  top: 16px;
  right: 20px;
  background: #0a192f;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 12px rgba(10, 25, 47, 0.08);
  color: #ffffff;
  padding: 9px 14px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cms-toast.show {
  opacity: 1;
  transform: translateY(0);
}

body:has(#cmsLoginOverlay.open) #cmsLayout {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* 平板与手机响应式折叠 */
@media (max-width: 1024px) {
  .cms-sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    bottom: 10px;
    margin: 0;
    background: var(--surface);
    transform: translateX(-115%);
  }

  .cms-layout.collapsed .cms-sidebar {
    width: var(--sidebar-width);
    transform: translateX(0);
  }

  .cms-layout.collapsed .brand-text,
  .cms-layout.collapsed .nav-label,
  .cms-layout.collapsed .nav-group-title,
  .cms-layout.collapsed .nav-badge,
  .cms-layout.collapsed .sidebar-footer-info {
    display: block;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-grid-2 {
    grid-template-columns: 1fr;
  }

  .hide-tablet {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .cms-main {
    padding: 8px;
  }

  .cms-header {
    padding: 0 16px;
    gap: 8px;
  }

  .breadcrumb > span,
  .role-switcher,
  #btnRefreshGlobal,
  #btnOpenThemeDrawer {
    display: none !important;
  }

  .header-right {
    gap: 6px;
  }

  .cms-content {
    padding: 14px;
  }

  .cms-tabs-bar {
    padding: 0 14px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
