/* ==========================================================================
   智教星图 · 设计系统基础层
   线上教学评估及课程开发系统（course.ecube.tech）
   适配：电脑 / 平板 / 手机 / 小程序 H5
   ========================================================================== */

:root {
  /* 色彩 */
  --bg: #f4f7fc;
  --bg-soft: #eef2fb;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --ink: #16223c;
  --ink-2: #34425c;
  --ink-3: #55637d;
  --muted: #7d8ba4;
  --faint: #a4afc2;
  --line: #e7edf8;
  --line-2: #f0f4fb;

  --primary: #4f5bd5;
  --primary-600: #4450c6;
  --primary-soft: #eef0ff;
  --violet: #8367f0;
  --grad: linear-gradient(118deg, #4b57d4 0%, #6a5fe6 46%, #8f6cf2 100%);
  --grad-soft: linear-gradient(118deg, #eef0ff 0%, #f4f1ff 60%, #eef7ff 100%);

  --teal: #0fa79c;
  --teal-soft: #e6f7f5;
  --amber: #eda13c;
  --amber-soft: #fdf3e3;
  --rose: #ee5d69;
  --rose-soft: #fdecee;
  --green: #16b98d;
  --green-soft: #e7f8f2;
  --blue: #3b82f6;
  --blue-soft: #eaf2fe;

  /* 形状与阴影 */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(22, 34, 60, .04);
  --shadow-sm: 0 2px 8px rgba(30, 45, 80, .05);
  --shadow-md: 0 10px 28px rgba(30, 45, 80, .07);
  --shadow-lg: 0 18px 48px rgba(30, 45, 80, .12);

  /* 布局 */
  --side-w: 250px;
  --side-w-mini: 82px;
  --top-h: 68px;
  --maxw: 1500px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.015em; line-height: 1.32; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

::selection { background: #dfe3ff; }
:focus-visible { outline: 2px solid #9aa4f2; outline-offset: 2px; border-radius: 6px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3dced; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bcc8e0; background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 应用骨架 ============================ */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side-w);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width .22s ease, transform .26s ease;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 16px;
  min-height: var(--top-h);
}
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 12px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 91, 213, .28);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-sub { font-size: 10.5px; color: var(--faint); letter-spacing: .06em; white-space: nowrap; }

.nav {
  flex: 1; overflow-y: auto; padding: 6px 12px 18px;
  scrollbar-width: thin;
}
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label {
  font-size: 10.5px; color: var(--faint); letter-spacing: .1em;
  padding: 6px 12px 4px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 11px; color: var(--ink-3);
  font-size: 13.5px; font-weight: 500;
  transition: background .16s, color .16s;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .82; }
.nav-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-600); font-weight: 650; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-badge {
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--rose); color: #fff; line-height: 1.6;
}
.nav-badge.soft { background: var(--primary-soft); color: var(--primary); }

.side-foot { padding: 12px 14px 16px; border-top: 1px solid var(--line-2); }
.side-card {
  background: var(--grad-soft); border: 1px solid #e6e9ff;
  border-radius: var(--r-md); padding: 12px 13px;
  font-size: 11.5px; color: var(--ink-3); line-height: 1.7;
}
.side-card b { color: var(--primary-600); display: block; font-size: 12.5px; margin-bottom: 2px; }

/* 主区 */
.main {
  margin-left: var(--side-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left .22s ease;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.topbar .crumb b { color: var(--ink); font-weight: 650; }
.topbar .grow { flex: 1; }

.search-box {
  position: relative; width: 250px; max-width: 32vw;
}
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search-box input {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 9px 12px 9px 34px; font-size: 13px; outline: none;
  transition: border-color .16s, background .16s;
}
.search-box input:focus { border-color: #c3c9f5; background: #fff; box-shadow: 0 0 0 3px rgba(79, 91, 213, .09); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--ink-3); position: relative; transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); border: 1.5px solid #fff; }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.user-chip:hover { border-color: #ced5f0; box-shadow: var(--shadow-sm); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 32px; letter-spacing: 0;
}
.user-meta { line-height: 1.25; text-align: left; }
.user-meta b { font-size: 12.5px; font-weight: 650; display: block; }
.user-meta span { font-size: 10.5px; color: var(--muted); }

.content {
  flex: 1;
  padding: 24px 26px 90px;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
}

/* ============================ 页面标题 ============================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 23px; letter-spacing: -.03em; display: flex; align-items: center; gap: 10px; }
.page-title .tag { vertical-align: middle; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; max-width: 760px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 650;
  border: 1px solid transparent;
  transition: background .16s, box-shadow .16s, transform .12s, color .16s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--primary-600); box-shadow: 0 6px 16px rgba(79, 91, 213, .24); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { border-color: #ccd4ea; background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.btn.soft { background: var(--primary-soft); color: var(--primary-600); }
.btn.soft:hover { background: #e4e7ff; color: var(--primary-600); box-shadow: none; }
.btn.danger { background: var(--rose-soft); color: #cf3a48; }
.btn.danger:hover { background: #fbdfe2; box-shadow: none; color: #cf3a48; }
.btn.teal { background: var(--teal); }
.btn.teal:hover { background: #0c978d; box-shadow: 0 6px 16px rgba(15, 167, 156, .24); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn.lg { padding: 12px 22px; font-size: 14px; border-radius: 12px; }
.btn-grad { background: var(--grad); }
.btn-grad:hover { box-shadow: 0 10px 24px rgba(94, 85, 226, .3); background: var(--grad); }

/* ============================ 卡片 ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card.pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0;
}
.card-head.bordered { padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.card-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title small { font-weight: 500; color: var(--faint); font-size: 11.5px; }
.card-body { padding: 16px 20px 20px; }
.card-hover { transition: border-color .18s, box-shadow .2s, transform .18s; }
.card-hover:hover { border-color: #d5dcf2; box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ============================ 栅格 ============================ */
.grid { display: grid; gap: 16px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.grid-main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

/* ============================ KPI ============================ */
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px 16px; position: relative; overflow: hidden;
  transition: border-color .18s, box-shadow .2s;
}
.kpi:hover { border-color: #d8dff4; box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value { font-size: 25px; font-weight: 780; letter-spacing: -.03em; line-height: 1.15; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--faint); margin-top: 5px; }
.trend-up { color: var(--green); font-weight: 650; }
.trend-down { color: var(--rose); font-weight: 650; }
.kpi.tint-1 .kpi-icon { background: var(--teal-soft); color: var(--teal); }
.kpi.tint-2 .kpi-icon { background: var(--amber-soft); color: #c67f22; }
.kpi.tint-3 .kpi-icon { background: var(--rose-soft); color: #d44856; }
.kpi.tint-4 .kpi-icon { background: var(--green-soft); color: #0d9c76; }

/* ============================ 标签 / 徽章 ============================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 650; padding: 2px 8px;
  border-radius: 6px; background: var(--surface-2); color: var(--ink-3);
  border: 1px solid var(--line); white-space: nowrap; line-height: 1.65;
}
.tag.primary { background: var(--primary-soft); color: var(--primary-600); border-color: #dfe3ff; }
.tag.teal { background: var(--teal-soft); color: #0b8379; border-color: #cdeeea; }
.tag.amber { background: var(--amber-soft); color: #b87516; border-color: #f7e3c4; }
.tag.rose { background: var(--rose-soft); color: #cf3a48; border-color: #f8d7db; }
.tag.green { background: var(--green-soft); color: #0d9c76; border-color: #cdefe3; }
.tag.blue { background: var(--blue-soft); color: #2f6fd0; border-color: #d6e5fd; }
.tag.plain { background: transparent; border-color: transparent; color: var(--muted); padding-left: 0; }

.dot-status { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* 筛选胶囊 */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  padding: 6px 13px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 550;
  background: #fff; border: 1px solid var(--line); color: var(--ink-3);
  transition: all .16s;
}
.chip:hover { border-color: #ccd4ea; color: var(--ink); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active.soft { background: var(--primary-soft); color: var(--primary-600); border-color: #dfe3ff; }

/* 分段控件 */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .16s; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs); }

/* ============================ 表格 ============================ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-size: 11.5px; font-weight: 650; color: var(--muted);
  padding: 10px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0;
}
.tbl thead th:first-child { border-radius: 8px 0 0 8px; }
.tbl thead th:last-child { border-radius: 0 8px 8px 0; }
.tbl tbody td { padding: 12px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fbfcff; }
.tbl .t-strong { font-weight: 650; color: var(--ink); }
.tbl .t-sub { font-size: 11.5px; color: var(--faint); }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ============================ 表单 ============================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--faint); line-height: 1.6; }
.input, .select, textarea.input {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: #fff; font-size: 13.5px; outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.input::placeholder { color: #b3bdcd; }
.input:focus, .select:focus, textarea.input:focus {
  border-color: #bdc4f2; box-shadow: 0 0 0 3px rgba(79, 91, 213, .1);
}
textarea.input { resize: vertical; min-height: 92px; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8ba4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ============================ 进度 / 条形 ============================ */
.progress { height: 7px; background: var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--grad); transition: width .5s ease; }
.progress.teal > i { background: linear-gradient(90deg, #0fa79c, #4fd0c3); }
.progress.amber > i { background: linear-gradient(90deg, #eda13c, #f6c479); }
.progress.rose > i { background: linear-gradient(90deg, #ee5d69, #f7919a); }

.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 46px; align-items: center; gap: 10px; font-size: 12px; }
.bar-row .bar-label { color: var(--ink-3); }
.bar-row .bar-track { height: 8px; background: var(--line-2); border-radius: var(--r-pill); overflow: hidden; }
.bar-row .bar-fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--grad); }
.bar-row .bar-val { text-align: right; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================ 列表 ============================ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.list-item:last-child { border-bottom: 0; }
.list-item .li-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-3); flex: 0 0 34px;
}
.list-item .li-icon svg { width: 17px; height: 17px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.list-item .li-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.list-item .li-time { font-size: 11px; color: var(--faint); white-space: nowrap; }

/* ============================ 空状态 ============================ */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .empty-icon {
  width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px;
  display: grid; place-items: center; background: var(--surface-2); color: #b7c2d6;
}
.empty .empty-icon svg { width: 26px; height: 26px; }
.empty b { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 420px; margin: 0 auto; line-height: 1.75; }

/* ============================ 弹窗 ============================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(19, 27, 45, .42);
  backdrop-filter: blur(3px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .16s ease;
}
.modal {
  background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 560px;
  max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: popIn .2s ease;
}
.modal.wide { max-width: 860px; }
.modal-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 9px; }
.close-x { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.close-x:hover { background: var(--surface-2); color: var(--ink); }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

/* ============================ 轻提示 ============================ */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1e2740; color: #fff; padding: 10px 18px; border-radius: 11px;
  font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: slideUp .2s ease; max-width: 90vw;
}
.toast.err { background: #c8372f; }
.toast.ok { background: #0f8a6e; }
.toast svg { width: 16px; height: 16px; }

/* ============================ 图表 ============================ */
.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.radar-wrap { display: grid; place-items: center; padding: 4px 0; }
.radar-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.radar-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.legend-inline { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend-inline span { display: inline-flex; align-items: center; gap: 5px; }
.legend-inline i { width: 9px; height: 9px; border-radius: 3px; }

/* ============================ 手机底部导航 ============================ */
.tabbar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar-inner { display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 2px; color: var(--muted); font-size: 10px; font-weight: 550;
  border-radius: 10px; transition: color .16s;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.active { color: var(--primary); }
.tabbar button.active svg { stroke-width: 2.2; }

/* 抽屉（移动端侧栏） */
.mask-drawer { display: none; position: fixed; inset: 0; background: rgba(19, 27, 45, .4); z-index: 38; }
.mask-drawer.show { display: block; animation: fadeIn .18s; }

/* ============================ 响应式：平板 ============================ */
@media (max-width: 1180px) {
  :root { --side-w: var(--side-w-mini); }
  .brand { justify-content: center; padding: 18px 8px 12px; }
  .brand-text, .nav-label, .side-foot, .nav-item span, .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .nav-item.active::before { display: none; }
  .nav-group { margin-top: 6px; }
  .nav-group + .nav-group { border-top: 1px solid var(--line-2); padding-top: 6px; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; }
  .content { padding: 20px 20px 80px; }
  .topbar { padding: 0 20px; }
  .grid-main, .grid-main-r { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { width: 200px; }
}

/* ============================ 响应式：手机 ============================ */
@media (max-width: 820px) {
  :root { --top-h: 58px; }
  .sidebar {
    width: 264px; transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top);
  }
  .sidebar.open { transform: none; }
  .sidebar.open .brand-text, .sidebar.open .nav-label,
  .sidebar.open .side-foot, .sidebar.open .nav-item span,
  .sidebar.open .nav-badge { display: block; }
  .sidebar.open .nav-label { display: block; }
  .sidebar.open .brand { justify-content: flex-start; padding: 20px 20px 16px; }
  .sidebar.open .nav-item { justify-content: flex-start; padding: 11px 12px; }
  .sidebar.open .nav-item.active::before { display: block; }
  .sidebar.open .nav-group + .nav-group { border-top: 0; }

  .main { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar .crumb { display: none; }
  .search-box { flex: 1; width: auto; max-width: none; }
  .user-meta { display: none; }
  .user-chip { padding: 4px; border: 0; background: transparent; }
  .tabbar { display: block; }
  .content { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .page-title { font-size: 19px; }
  .page-sub { font-size: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .grid { gap: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .grid-auto { grid-template-columns: minmax(0, 1fr); }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 22px; }
  .modal { max-width: none; border-radius: 18px; }
  .modal-mask { padding: 12px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 24px); }
  .card.pad { padding: 15px 16px; }
  .card-head { padding: 14px 16px 0; }
  .card-body { padding: 14px 16px 16px; }

  /* 表格转卡片 */
  .tbl-cards thead { display: none; }
  .tbl-cards tbody tr {
    display: block; padding: 12px 14px; margin-bottom: 10px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
  }
  .tbl-cards tbody td {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 4px 0; border: 0; font-size: 12.5px;
  }
  .tbl-cards tbody td::before {
    content: attr(data-label); color: var(--muted); font-size: 11.5px; flex: 0 0 auto;
  }
  .tbl-cards tbody td:last-child { justify-content: flex-end; padding-top: 8px; }
}

@media (max-width: 420px) {
  .tabbar button span { font-size: 9.5px; }
  .kpi-value { font-size: 20px; }
}

/* ============================ 工具类 ============================ */
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.muted { color: var(--muted) } .faint { color: var(--faint) } .ink2 { color: var(--ink-2) }
.small { font-size: 12px } .tiny { font-size: 11px }
.bold { font-weight: 700 } .semibold { font-weight: 600 }
.center { text-align: center } .right { text-align: right }
.nowrap { white-space: nowrap }
.hide { display: none !important }
.mono { font-family: var(--mono); font-size: 12px }
.divider { height: 1px; background: var(--line-2); margin: 14px 0; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media print {
  .sidebar, .topbar, .tabbar, .page-actions, .btn { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
}
