/* 财务 AI 工作台 — 宝玉 design（baoyu-md default 主题基因）
   经典蓝 #0F4C81 · 白底卡片 · 1.75 行高 · 0.1em 字距 · 左竖边标题 · 引用块面板 */
:root {
  --bg: #f5f7fa;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #eef3f9;
  --border: #e3e8f0;
  --text: #3f3f3f;
  --text-dim: #6b7280;
  --accent: #0f4c81;
  --accent-light: rgba(15, 76, 129, .08);
  --orange: #d97757;
  --red: #fa5151;
  --green: #009874;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  --shadow: 0 1px 3px rgba(15, 76, 129, .06), 0 4px 14px rgba(15, 76, 129, .05);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  overflow: hidden;
}

#shell {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  height: 100vh;
}
#shell > * { min-width: 0; }  /* 防止 grid 子项被内容撑破 */

/* ---------- 左侧导航 ---------- */
#sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 20px; border-bottom: 2px solid var(--accent); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--accent);
  color: #fff; font-weight: 700; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.brand-sub { font-size: 10px; color: var(--text-dim); letter-spacing: 1.5px; margin-top: 2px; }

#block-nav { flex: 1; overflow-y: auto; padding-top: 14px; }
.nav-section { font-size: 11px; color: var(--text-dim); letter-spacing: 2px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 6px;
  color: var(--text-dim); text-decoration: none;
  font-size: 14px; margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.nav-icon { width: 22px; text-align: center; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; }
.ai-status { font-size: 12px; color: var(--text-dim); padding: 8px 10px; border-radius: 6px; background: #f7f7f7; line-height: 1.6; }
.ai-status.ok { color: var(--accent); }
.ai-status.local { color: var(--orange); }

/* ---------- 主区 ---------- */
#main { overflow-y: auto; padding: 30px 36px; }
.page-title {
  font-size: 20px; font-weight: 700; margin-bottom: 8px;
  display: table; padding: 0 .2em 4px;
  border-bottom: 2px solid var(--accent);
}
.page-desc { color: var(--text-dim); margin-bottom: 26px; font-size: 13px; letter-spacing: .05em; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; letter-spacing: .05em; }
.stat-value { font-size: 24px; font-weight: 700; font-family: var(--mono); }
.stat-value.accent { color: var(--accent); }
.stat-value.gold { color: var(--orange); }
.stat-note { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

.block-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 22px; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  text-decoration: none; color: var(--text); display: block;
}
.block-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 18px rgba(15,76,129,.12); }
.block-card .b-icon { font-size: 26px; margin-bottom: 12px; }
.block-card .b-name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.block-card .b-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; }
.block-card .b-ver { font-size: 10px; color: var(--accent); margin-top: 12px; font-family: var(--mono); opacity: .7; }

/* ---------- 右侧任务栏 ---------- */
#taskbar { background: var(--bg-panel); border-left: 1px solid var(--border); padding: 22px 16px; overflow-y: auto; }
.taskbar-title {
  font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 14px;
  padding-left: 8px; border-left: 3px solid var(--accent);
}
.task-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
  cursor: pointer; transition: border-color .15s; box-shadow: var(--shadow);
}
.task-item:hover { border-color: var(--accent); }
.task-file { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; word-break: break-all; }
.task-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); }
.task-summary { font-size: 11px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 30px 0; }

.channel-badge {
  display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 4px;
  font-family: var(--mono);
}
.channel-badge.deepseek { background: var(--accent-light); color: var(--accent); }
.channel-badge.local { background: rgba(217,119,87,.12); color: var(--orange); }

/* ---------- 积木页面通用 ---------- */
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.panel-title {
  font-size: 15px; font-weight: 700; margin-bottom: 18px;
  padding-left: 8px; border-left: 3px solid var(--accent);
}

.upload-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 48px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fbfcfe;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-light); }
.upload-zone .uz-icon { font-size: 34px; margin-bottom: 12px; }
.upload-zone .uz-text { color: var(--text-dim); font-size: 13px; line-height: 1.9; letter-spacing: .05em; }
.upload-zone .uz-text b { color: var(--accent); }

.btn {
  display: inline-block; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; padding: 9px 22px;
  font-size: 13px; font-weight: 600; cursor: pointer; letter-spacing: .05em;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.err-box {
  background: rgba(250,81,81,.06); border: 1px solid rgba(250,81,81,.35);
  border-left: 4px solid var(--red);
  border-radius: 6px; padding: 16px; color: var(--red);
  font-size: 13px; line-height: 1.7; margin-bottom: 18px;
}
.err-box pre { margin-top: 10px; font-size: 11px; color: var(--text-dim); white-space: pre-wrap; font-family: var(--mono); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; color: var(--text-dim); font-weight: 600;
  padding: 9px 12px; border-bottom: 2px solid var(--accent);
  font-size: 12px; letter-spacing: .05em;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
table.data td.num { font-family: var(--mono); text-align: right; }
table.data tr:hover td { background: var(--bg-hover); }

.tag { display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.tag.ok { background: rgba(0,152,116,.1); color: var(--green); }
.tag.bad { background: rgba(250,81,81,.1); color: var(--red); }

/* AI 解读：宝玉引用块风格 */
.ai-report {
  line-height: 1.9; font-size: 14px; white-space: pre-wrap;
  letter-spacing: .05em;
  padding: 18px; border-left: 4px solid var(--accent);
  border-radius: 6px; background: #f7f9fc;
}
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.mono { font-family: var(--mono); }
.dim { color: var(--text-dim); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d4e2; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录 ---------- */
#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px 30px; box-shadow: var(--shadow);
}
.login-tip { font-size: 12px; color: var(--text-dim); margin-bottom: 18px; letter-spacing: .05em; }
.login-card input {
  display: block; width: 100%; margin-bottom: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fbfcfe; color: var(--text);
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-err { color: var(--red); font-size: 12px; min-height: 20px; margin-bottom: 6px; }

/* ---------- 用户区 ---------- */
.user-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 10px; font-size: 12.5px; }
.user-row .u-name { font-weight: 600; }
.user-row a { color: var(--text-dim); text-decoration: none; font-size: 11.5px; margin-left: 8px; cursor: pointer; }
.user-row a:hover { color: var(--accent); }

/* ---------- 窄屏（手机）适配：纵向堆叠 ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  #shell { grid-template-columns: 1fr; grid-template-rows: auto auto auto; height: auto; }
  #sidebar {
    flex-direction: row; align-items: center; flex-wrap: wrap;
    padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
  }
  .brand { padding: 0; border-bottom: none; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 6px; }
  .brand-sub { display: none; }
  #block-nav { display: flex; align-items: center; gap: 4px; padding-top: 0; flex: 1; overflow-x: auto; }
  .nav-section { display: none; }
  .nav-item { white-space: nowrap; padding: 7px 10px; margin-bottom: 0; font-size: 12.5px; border-left: none; }
  .nav-item.active { border-left: none; }
  .sidebar-foot { border-top: none; padding-top: 0; }
  .ai-status { padding: 4px 8px; font-size: 11px; }
  #main { padding: 18px 14px; overflow-y: visible; }
  #taskbar { border-left: none; border-top: 1px solid var(--border); padding: 14px 12px; }
  .card-grid { grid-template-columns: 1fr; }
  .upload-zone { padding: 32px 14px; }
  table.data { min-width: 520px; }  /* 表格区横向滚动，不挤压变形 */
}
