:root {
  --primary: #1B2A4A;
  --primary-light: #2E5090;
  --primary-dark: #142038;
  --accent: #C8963E;
  --accent-light: #E0B968;
  --accent-bg: #F8F0DC;
  --bg: #F0EEE8;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --muted: #6B7280;
  --border: #DDD9CE;
  --red: #9B2226;
  --red-bg: #FDF0F0;
  --green: #2D6A4F;
  --green-bg: #EDF6F0;
  --orange: #B8731E;
  --orange-bg: #FCF1E0;
  --blue-bg: #EEF3FA;
  --sidebar-w: 220px;
  --header-h: 56px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
h1,h2,h3,h4 { font-family: "Noto Serif SC", serif; }

/* ===== Header ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary);
  display: flex; align-items: center;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; margin-right: 30px; }
.logo-icon {
  width: 32px; height: 32px; background: var(--accent); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 16px; color: var(--primary);
}
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: 1px; }
.logo-text small { display: block; font-size: 10px; font-weight: 300; opacity: 0.6; letter-spacing: 2px; }
.header-center { flex: 1; display: flex; align-items: center; gap: 16px; }
.global-search { position: relative; width: 320px; }
.global-search input {
  width: 100%; padding: 7px 12px 7px 34px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #fff; font-size: 13px; outline: none;
}
.global-search input::placeholder { color: rgba(255,255,255,0.4); }
.global-search input:focus { background: rgba(255,255,255,0.15); border-color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 8px; }
.role-switcher {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; color: #fff; cursor: pointer; font-size: 13px;
}
.role-switcher:hover { background: rgba(255,255,255,0.18); }
.role-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7); cursor: pointer; position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.notif-badge {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: #e74c3c;
  border-radius: 50%; border: 1.5px solid var(--primary);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--primary-dark);
  overflow-y: auto; z-index: 900;
}
.sidebar-group { padding: 16px 0 4px; }
.sidebar-group-title { padding: 0 20px 6px; font-size: 10px; color: rgba(255,255,255,0.3); letter-spacing: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(255,255,255,0.65);
  cursor: pointer; font-size: 13px;
  border-left: 3px solid transparent; transition: all 0.15s;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(200,150,62,0.12); border-left-color: var(--accent); }
.nav-badge { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 8px; background: var(--accent); color: var(--primary); font-weight: 600; }

.de-widget {
  margin: 12px; padding: 14px;
  background: linear-gradient(135deg, rgba(200,150,62,0.15), rgba(46,80,144,0.15));
  border: 1px solid rgba(200,150,62,0.25);
  border-radius: 6px; cursor: pointer;
}
.de-widget:hover { border-color: var(--accent); }
.de-widget-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.de-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--primary);
}
.de-name { color: #fff; font-size: 13px; font-weight: 600; }
.de-role { color: rgba(255,255,255,0.5); font-size: 10px; }
.de-status { display: flex; align-items: center; gap: 5px; font-size: 11px; color: rgba(255,255,255,0.6); }
.de-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; }

/* ===== Main ===== */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  padding: 20px 24px 40px;
}
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--primary); }
.page-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; }
.btn { padding: 7px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; border: none; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: var(--primary); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 18px 20px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-tag { font-size: 10px; padding: 2px 6px; border-radius: 3px; background: var(--accent-bg); color: var(--accent); font-weight: 500; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 900; color: var(--primary); font-family: "Noto Serif SC", serif; line-height: 1.2; }
.kpi-value .unit { font-size: 13px; font-weight: 400; color: var(--muted); }
.kpi-change { font-size: 11px; margin-top: 4px; }
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--primary); color: #fff; padding: 9px 10px; text-align: left; font-weight: 500; font-size: 12px; white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:nth-child(even) td { background: #FAF9F6; }
tr:hover td { background: var(--accent-bg); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Tags */
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 500; }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-orange { background: var(--orange-bg); color: var(--orange); }
.tag-blue { background: var(--blue-bg); color: var(--primary-light); }
.tag-gold { background: var(--accent-bg); color: #8B6914; }
.tag-gray { background: #f0f0f0; color: #666; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab { padding: 8px 18px; font-size: 13px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--accent); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Progress */
.progress { height: 6px; background: #e8e8e8; border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 3px; }

/* Notification Panel */
.notif-panel {
  display: none; position: fixed; top: var(--header-h); right: 0;
  width: 360px; height: calc(100vh - var(--header-h));
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 950; overflow-y: auto;
}
.notif-panel.show { display: block; }
.notif-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.notif-item { padding: 12px 20px; border-bottom: 1px solid #f0f0f0; cursor: pointer; display: flex; gap: 10px; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--blue-bg); }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.notif-content { flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 10px; color: #999; margin-top: 4px; }

/* DE Chat Panel */
.de-panel {
  display: none; position: fixed; top: var(--header-h); right: 0;
  width: 380px; height: calc(100vh - var(--header-h));
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 960; flex-direction: column;
}
.de-panel.show { display: flex; }
.de-panel-header { padding: 14px 18px; background: var(--primary); color: #fff; display: flex; align-items: center; gap: 12px; }
.de-panel-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); }
.de-msg { margin-bottom: 14px; display: flex; gap: 8px; }
.de-msg-user { flex-direction: row-reverse; }
.de-msg-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.de-msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.de-msg-bot .de-msg-bubble { background: #fff; border: 1px solid var(--border); border-top-left-radius: 2px; }
.de-msg-user .de-msg-bubble { background: var(--primary); color: #fff; border-top-right-radius: 2px; }
.de-panel-input { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.de-panel-input input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; outline: none; }
.de-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.de-quick-btn { padding: 4px 10px; font-size: 11px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; color: var(--muted); }
.de-quick-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* Login page */
.login-body {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary) 60%, var(--primary-light));
}
.login-box {
  background: #fff; border-radius: 10px; padding: 40px;
  width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { width: 56px; height: 56px; font-size: 28px; margin: 0 auto 10px; border-radius: 10px; }
.login-logo h1 { font-size: 20px; color: var(--primary); }
.login-logo p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 4px; font-size: 14px; outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.login-btn { width: 100%; padding: 11px; background: var(--primary); color: #fff; border: none; border-radius: 4px; font-size: 15px; cursor: pointer; font-weight: 600; }
.login-btn:hover { background: var(--primary-light); }
.login-error { color: var(--red); font-size: 12px; margin-top: 10px; text-align: center; min-height: 18px; }
.login-hint { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); text-align: center; line-height: 1.8; }
