/* ============================================================
   shell-theme.css — 壳层样式 + 主题变量覆盖
   默认主题：nebula-purple（星云紫，贴合国力物流紫色系规范）
   ============================================================ */

:root {
  /* 主题令牌（默认 = 星云紫） */
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-active: #5b21b6;
  --primary-subtle: #ede9fe;
  --border-focus: #7c3aed;
  --bg-active: #ede9fe;
  --text: #111827;
  --text-secondary: #344054;
  --text-weak: #667085;
  --text-disabled: #98a2b3;
  --border-default: #e5e7eb;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --ring: rgba(124, 58, 237, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e5e7eb;
  --header-bg: #ffffff;
  --header-border: #e5e7eb;
  --tab-active-bg: #ede9fe;
  --scrollbar: #d1d5db;
}

/* ---------- 主题：云蓝 ---------- */
[data-theme="classic-cloud-blue"] {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-subtle: #dbeafe;
  --border-focus: #2563eb;
  --bg-active: #dbeafe;
  --ring: rgba(37, 99, 235, 0.1);
  --tab-active-bg: #dbeafe;
}

/* ---------- 主题：绯红 ---------- */
[data-theme="crimson-red"] {
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --primary-active: #991b1b;
  --primary-subtle: #fee2e2;
  --border-focus: #dc2626;
  --bg-active: #fee2e2;
  --ring: rgba(220, 38, 38, 0.1);
  --tab-active-bg: #fee2e2;
}

/* ---------- 主题：星云紫（默认） ---------- */
[data-theme="nebula-purple"] {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-active: #5b21b6;
  --primary-subtle: #ede9fe;
  --border-focus: #7c3aed;
  --bg-active: #ede9fe;
  --ring: rgba(124, 58, 237, 0.1);
  --tab-active-bg: #ede9fe;
}

/* ---------- 主题：增长绿 ---------- */
[data-theme="wechat-growth-green"] {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-active: #047857;
  --primary-subtle: #d1fae5;
  --border-focus: #10b981;
  --bg-active: #d1fae5;
  --ring: rgba(16, 185, 129, 0.1);
  --tab-active-bg: #d1fae5;
}

/* ============================================================
   壳层布局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* iframe 内模块页面同样继承字体族 */
.shell-content iframe { font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif; }

/* ---------- 整体布局 ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.shell-sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  transition: width .2s;
}
.shell-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- 品牌区 ---------- */
.shell-brand { padding: 16px 20px; border-bottom: 1px solid var(--sidebar-border); display: flex; align-items: center; gap: 10px; }
.shell-brand-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.shell-brand-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.2; }
.shell-brand-sub { font-size: 11px; color: var(--text-secondary); }

/* ---------- 菜单搜索 ---------- */
.shell-search { padding: 12px 16px; border-bottom: 1px solid var(--sidebar-border); }
.shell-search input {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--border-default); border-radius: 6px;
  font-size: 13px; background: var(--bg); color: var(--text);
  outline: none;
}
.shell-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* ---------- 导航树 ---------- */
.shell-nav { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.shell-nav::-webkit-scrollbar { width: 6px; }
.shell-nav::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.shell-domain { margin-bottom: 4px; }
.shell-domain-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.shell-domain-head:hover { background: var(--bg); }
.shell-domain-head .arrow { margin-left: auto; font-size: 10px; color: var(--text-secondary); transition: transform .15s; }
.shell-domain.collapsed .arrow { transform: rotate(-90deg); }
.shell-domain-icon { width: 16px; text-align: center; color: var(--text-secondary); }

.shell-section { padding: 6px 16px 2px; font-size: 11px; color: var(--text-secondary); letter-spacing: .5px; }
.shell-page-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 34px; cursor: pointer;
  font-size: 13px; color: var(--text);
  border-left: 2px solid transparent;
}
.shell-page-item:hover { background: var(--bg); }
.shell-page-item.active { background: var(--bg-active); color: var(--primary); font-weight: 600; border-left-color: var(--primary); }
.shell-page-status { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #f3f4f6; color: #6b7280; margin-left: auto; }

/* ---------- 顶栏 ---------- */
.shell-header {
  height: 48px; background: var(--header-bg); border-bottom: 1px solid var(--header-border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
}
.shell-breadcrumb { font-size: 13px; color: var(--text-secondary); }
.shell-breadcrumb b { color: var(--text); font-weight: 600; }
.shell-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.shell-chip { font-size: 11px; padding: 2px 10px; border-radius: 10px; background: var(--primary-subtle); color: var(--primary); }
.shell-icon-btn {
  width: 30px; height: 30px; border: 1px solid var(--border-default); border-radius: 6px;
  background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.shell-icon-btn:hover { background: var(--bg-active); color: var(--primary); }

/* ---------- 页签栏 ---------- */
.shell-tabs {
  height: 36px; background: var(--bg);
  border-bottom: 1px solid var(--border-default);
  display: flex; align-items: center; padding: 0 8px; gap: 4px;
  overflow-x: auto;
}
.shell-tabs::-webkit-scrollbar { height: 4px; }
.shell-tabs::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }
.shell-tab-item {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 6px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  white-space: nowrap; border: 1px solid transparent;
}
.shell-tab-item:hover { background: var(--bg-active); color: var(--text); }
.shell-tab-item.active { background: var(--tab-active-bg); color: var(--primary); font-weight: 600; }
.shell-tab-close { width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; line-height: 1; }
.shell-tab-close:hover { background: rgba(0,0,0,.12); }

/* ---------- 内容区 ---------- */
.shell-content { flex: 1; overflow: hidden; position: relative; background: var(--bg); }
.shell-content iframe { width: 100%; height: 100%; border: none; display: block; background: var(--bg); }
.shell-content-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--danger); font-size: 14px; background: var(--bg);
}

/* ---------- Toast ---------- */
.shell-toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.shell-toast {
  background: var(--text); color: #fff; padding: 8px 16px; border-radius: 6px;
  font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: shellToastIn .2s ease;
}
@keyframes shellToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 抽屉 ---------- */
.shell-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .2s; }
.shell-overlay.open { opacity: 1; pointer-events: auto; }
.shell-drawer {
  position: fixed; top: 0; right: 0; width: 320px; height: 100vh; background: var(--card-bg);
  z-index: 1001; box-shadow: -4px 0 16px rgba(0,0,0,.1);
  transform: translateX(100%); transition: transform .2s ease;
  display: flex; flex-direction: column;
}
.shell-drawer.open { transform: translateX(0); }
.shell-drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border-default); font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.shell-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.shell-drawer-body h4 { font-size: 13px; color: var(--text-secondary); margin: 16px 0 8px; }
.shell-drawer-body h4:first-child { margin-top: 0; }
.theme-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border-default); border-radius: 15px; cursor: pointer;
  font-size: 13px; margin: 0 8px 8px 0; background: var(--card-bg); color: var(--text);
}
.theme-chip.active { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); font-weight: 600; }
.theme-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); }
.shell-drawer-close { border: none; background: none; cursor: pointer; font-size: 16px; color: var(--text-secondary); }

/* ---------- 右键菜单 ---------- */
.shell-ctx-menu {
  position: fixed; z-index: 9998; min-width: 140px; background: var(--card-bg);
  border: 1px solid var(--border-default); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: 4px; display: none;
}
.shell-ctx-menu.open { display: block; }
.shell-ctx-item { padding: 7px 12px; font-size: 13px; border-radius: 4px; cursor: pointer; color: var(--text); }
.shell-ctx-item:hover { background: var(--bg-active); color: var(--primary); }
.shell-ctx-item.disabled { color: var(--text-secondary); cursor: not-allowed; }

/* ---------- 统一预算控制组件 ---------- */
.bc-card { margin-top: 14px; }
.bc-card.collapsed .bc-body { display: none; }
.bc-card.collapsed { border-color: color-mix(in srgb, var(--primary) 32%, var(--border-default)); }
.bc-head-actions { display: flex; align-items: center; gap: 8px; }
.bc-decision-strip { display: grid; grid-template-columns: 1.05fr repeat(4,minmax(112px,1fr)) auto; align-items: center; gap: 0; margin: 0 14px 14px; border: 1px solid #a7e3ca; border-left: 4px solid #16835b; border-radius: 6px; background: #f4fbf8; overflow: hidden; }
.bc-decision-strip.warn { border-color: #f3c776; border-left-color: #d98b00; background: #fffaf0; }
.bc-decision-strip.block { border-color: #f0aaa6; border-left-color: var(--danger); background: #fff6f5; }
.bc-decision-strip > div { min-width: 0; padding: 9px 11px; border-right: 1px solid var(--border-default); }
.bc-decision-strip > div > span { display: block; margin-bottom: 3px; color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.bc-decision-strip > div > b { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.bc-decision-strip .bc-decision-title span { color: var(--text); font-size: 12px; font-weight: 700; }
.bc-decision-strip > button { margin: 0 10px; white-space: nowrap; }
.bc-warn-text { color: #9a6200; }
.bc-body { padding: 14px 16px; }
.bc-top { display: grid; grid-template-columns: .8fr 1.5fr .8fr .8fr; gap: 10px; margin-bottom: 12px; }
.bc-route { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: 6px; background: var(--primary-subtle); font-size: 12px; color: var(--text-secondary); }
.bc-route b { color: var(--text); margin-right: 4px; }
.bc-route span { padding: 3px 7px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--card-bg); }
.bc-route i { color: var(--primary); font-style: normal; }
.bc-table { min-width: 1080px; }
.bc-table input { min-width: 100px; }
.bc-code { margin-top: 3px; color: var(--text-weak); font-size: 10px; }
.bc-kind { display: inline-flex; padding: 2px 7px; border-radius: 10px; color: #0b6bcb; background: #e8f3ff; font-size: 11px; white-space: nowrap; }
.bc-kind.fund { color: #7a4b00; background: #fff3d6; }
.bc-transfer { color: var(--primary); font-size: 11px; font-weight: 600; white-space: nowrap; }
.bc-result { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 11px 14px; border: 1px solid #a7e3ca; border-radius: 6px; background: #ecfdf5; color: #087a55; }
.bc-result.warn { border-color: #f3c776; background: #fff7e6; color: #925400; }
.bc-result.block { border-color: #f0aaa6; background: #fff0f0; color: #b42318; }
.bc-result p { margin: 4px 0 0; font-size: 12px; }
.bc-result strong { white-space: nowrap; }
.bc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bc-actions > span { color: var(--text-weak); font-size: 11px; }
.bc-aside-card { border-top: 3px solid var(--primary); }
.bc-aside-card.warn { border-top-color: #d98b00; }
.bc-aside-card.block { border-top-color: var(--danger); }
.bc-aside-card .erp-side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bc-aside-amount { padding: 2px 0 9px; border-bottom: 1px dashed var(--border-default); }
.bc-aside-amount span { display: block; margin-bottom: 3px; color: var(--text-secondary); font-size: 11px; }
.bc-aside-amount strong { color: var(--primary); font-size: 21px; font-variant-numeric: tabular-nums; }
.bc-aside-open { width: 100%; margin-top: 10px; }
@media (max-width: 1100px) { .bc-aside-card { display: none; } }
@media (max-width: 900px) { .bc-top { grid-template-columns: repeat(2, 1fr); } .bc-decision-strip { grid-template-columns: repeat(2,1fr); } .bc-decision-strip > button { margin: 8px 10px; } }
