:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e4e8ee;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2E7D32;
  --primary-light: #e8f5e9;
  --accent: #E53935;
  --warn: #f59e0b;
  --info: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Noto Sans CJK SC", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
}
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- 语音沟通 ---------- */
.speak-btn { margin-left: 8px; cursor: pointer; opacity: .55; font-size: 13px; }
.speak-btn:hover { opacity: 1; }
#micBtn { min-width: 38px; }
#micBtn.btn-accent { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,57,53,.4); } 70% { box-shadow: 0 0 0 8px rgba(229,57,53,0); } 100% { box-shadow: 0 0 0 0 rgba(229,57,53,0); } }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px; background: #1f2937; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 20px 18px 16px; border-bottom: 1px solid #374151;
}
.brand h1 { font-size: 15px; color: #fff; font-weight: 600; letter-spacing: .3px; }
.brand p { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  color: #cbd5e1; cursor: pointer; font-size: 13.5px; transition: .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: #374151; color: #fff; }
.nav-item.active {
  background: #2E7D32; color: #fff; border-left-color: #a5d6a7;
}
.nav-item .ico { width: 16px; text-align: center; font-size: 14px; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff; font-size: 10px;
  padding: 1px 6px; border-radius: 8px; min-width: 18px; text-align: center;
}
.sidebar-foot { padding: 12px 18px; border-top: 1px solid #374151; font-size: 11px; color: #6b7280; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px;
  height: 56px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 20px 24px 48px; flex: 1; }

/* ---------- 组件 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border-radius: 7px; font-size: 13px; background: #f3f4f6; color: var(--text);
  transition: .15s; white-space: nowrap;
}
.btn:hover { background: #e5e7eb; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #256428; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c62828; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2,1fr); } }

.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.stat .value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.stat .foot { font-size: 11.5px; color: var(--muted); }
.stat.green .value { color: var(--primary); }
.stat.red .value { color: var(--accent); }
.stat.blue .value { color: var(--info); }
.stat.warn .value { color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 12px; background: #f9fafb; font-weight: 600;
  color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; }
tr:hover td { background: #fafbfc; }

.tag {
  display: inline-block; padding: 1.5px 8px; border-radius: 5px; font-size: 11.5px;
  background: #eef2f7; color: #475569; margin-right: 4px; white-space: nowrap;
}
.tag-A { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.tag-B { background: #fef3c7; color: #b45309; font-weight: 600; }
.tag-C { background: #e0f2fe; color: #0369a1; }
.tag-D { background: #f1f5f9; color: #64748b; }
.tag-green { background: var(--primary-light); color: #1b5e20; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-gray { background: #f1f5f9; color: #64748b; }

.cap {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.cap-official { background: #dcfce7; color: #15803d; }
.cap-browser { background: #fef3c7; color: #b45309; }
.cap-manual { background: #e2e8f0; color: #475569; }

input, select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 13px; font-family: inherit; background: #fff;
  color: var(--text); transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,.1);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px; }
.asset-card {
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden;
  background: #fff; cursor: pointer; transition: .15s; position: relative;
}
.asset-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-2px); }
.asset-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.asset-thumb {
  width: 100%; aspect-ratio: 16/10; background: #eef2f7 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #94a3b8;
  font-size: 24px;
}
.asset-info { padding: 8px 10px; }
.asset-info .name {
  font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 3px;
}
.asset-info .meta { font-size: 11px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.asset-check {
  position: absolute; top: 7px; right: 7px; width: 20px; height: 20px;
  border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid #cbd5e1;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.asset-card.selected .asset-check { background: var(--primary); border-color: var(--primary); color: #fff; }

.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kanban-col { background: #eef1f5; border-radius: 9px; padding: 10px; min-height: 200px; }
.kanban-col h4 {
  font-size: 12.5px; color: var(--muted); margin-bottom: 9px;
  display: flex; justify-content: space-between;
}
.kcard {
  background: #fff; border-radius: 7px; padding: 10px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: grab; font-size: 12.5px;
}
.kcard:active { cursor: grabbing; }
.kcard .kname { font-weight: 600; margin-bottom: 3px; }
.kcard .kmeta { font-size: 11px; color: var(--muted); }
.kcard.dragover { outline: 2px dashed var(--primary); }

.chat-wrap { display: grid; grid-template-columns: 260px 1fr 300px; gap: 14px; height: calc(100vh - 140px); }
.chat-list { overflow-y: auto; }
.chat-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.chat-item:hover { background: #f9fafb; }
.chat-item.active { background: var(--primary-light); border-right: 3px solid var(--primary); }
.chat-item .cname { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.chat-item .cprev { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-main { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 9px; background: #fff; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; background: #f7f9fb; }
.msg { margin-bottom: 12px; display: flex; gap: 8px; }
.msg.user { flex-direction: row-reverse; }
.msg .bubble {
  max-width: 72%; padding: 9px 13px; border-radius: 12px; font-size: 13px;
  line-height: 1.6; word-break: break-word; background: #fff; border: 1px solid var(--border);
}
.msg.user .bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.msg.system .bubble { background: #fef3c7; color: #92400e; font-size: 12px; margin: 0 auto; }
.msg .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.msg.user .avatar { background: var(--primary); color: #fff; }
.chat-input { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.chat-input textarea { min-height: 40px; max-height: 100px; }
.chat-side { border: 1px solid var(--border); border-radius: 9px; background: #fff; padding: 14px; overflow-y: auto; }

.dim-bar { margin-bottom: 9px; }
.dim-bar .dl { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 3px; }
.dim-bar .db { height: 6px; background: #eef2f7; border-radius: 3px; overflow: hidden; }
.dim-bar .db > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: .3s; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; max-width: 720px; width: 100%;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.modal-head h3 { font-size: 15px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 20px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.progress { height: 7px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); transition: .3s; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 32px; display: block; margin-bottom: 8px; opacity: .5; }
.loading { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: slideDown .25s;
}
.toast.ok { background: var(--primary); }
.toast.err { background: var(--accent); }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%,-12px); } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 9px 16px; font-size: 13px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.hint {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  padding: 10px 14px; border-radius: 8px; font-size: 12.5px; line-height: 1.65;
}
.hint.blue { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.hint.green { background: var(--primary-light); border-color: #a5d6a7; color: #1b5e20; }

.funnel { display: flex; align-items: flex-end; gap: 10px; padding: 8px 0; }
.funnel-step { flex: 1; text-align: center; }
.funnel-bar {
  background: linear-gradient(180deg, #4caf50, #2E7D32); border-radius: 5px 5px 0 0;
  margin: 0 auto; width: 70%; transition: .4s; min-height: 4px;
}
.funnel-step .fl { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.funnel-step .fv { font-size: 17px; font-weight: 700; margin-bottom: 4px; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f1f3f6; font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.scroll-y { overflow-y: auto; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mb10 { margin-bottom: 10px; } .mb16 { margin-bottom: 16px; }
.mt10 { margin-top: 10px; } .mt16 { margin-top: 16px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px; }
.checkbox { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
