/* ============================================================
   毕业论文智能检查系统 —— 样式表（浅色主题）
   ============================================================ */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e5e7eb;
  --border-strong: #d5d8de;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9099a8;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --danger: #dc2626;
  --danger-600: #b91c1c;
  --danger-50: #fef2f2;
  --success: #15803d;
  --success-50: #f0fdf4;
  --warn: #b45309;
  --warn-50: #fffbeb;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 8px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* 图标默认尺寸：具体场景（导航、按钮、空状态等）由更具体的规则覆盖 */
svg { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: middle; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--primary-100); }

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

/* ============================================================
   登录页
   ============================================================ */
.login { display: grid; grid-template-columns: 1.06fr .94fr; min-height: 100vh; }
.login-hero {
  position: relative; overflow: hidden; color: #fff; padding: 56px 60px;
  background: linear-gradient(150deg, #312e81 0%, #4338ca 42%, #6d28d9 100%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(560px 320px at 82% 8%, rgba(255,255,255,.18), transparent 62%),
    radial-gradient(460px 300px at 6% 96%, rgba(129,140,248,.35), transparent 62%);
}
.login-hero > * { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  backdrop-filter: blur(6px);
}
.brand-name { font-size: 16px; font-weight: 650; }
.brand-sub { font-size: 12px; opacity: .72; letter-spacing: .04em; }
.hero-body { max-width: 480px; }
.hero-body h1 { font-size: 34px; line-height: 1.3; margin-bottom: 16px; letter-spacing: -.02em; }
.hero-body p { font-size: 14.5px; opacity: .84; margin: 0 0 30px; }
.hero-list { display: grid; gap: 14px; }
.hero-item { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; opacity: .95; }
.hero-item .dot {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto; margin-top: 1px;
  background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.hero-foot { font-size: 12px; opacity: .58; }

.login-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 372px; }
.login-card h2 { font-size: 23px; margin-bottom: 6px; }
.login-card .lead { color: var(--text-3); font-size: 13.5px; margin: 0 0 28px; }
.login-tip {
  margin-top: 22px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  font-size: 12.5px; color: var(--text-2); line-height: 1.8;
}
.login-tip code { font-family: var(--mono); background: #fff; border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }

/* ============================================================
   表单控件
   ============================================================ */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 560; color: var(--text-2); margin-bottom: 7px; }
.field .req { color: var(--danger); margin-left: 3px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #b9bec7; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: #fff; color: var(--text); cursor: pointer; font-weight: 560; font-size: 13.5px;
  transition: all .15s; white-space: nowrap; box-shadow: var(--shadow-xs);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: #b9bec7; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.32); }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { color: var(--danger); border-color: #f3c6c6; background: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-50); border-color: #eba9a9; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: #eef0f4; border-color: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 12px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-weight: 560; font-size: 13.5px; }
.btn-link:hover { text-decoration: underline; }

/* ---------- 徽标 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border-radius: 999px; font-size: 12px; font-weight: 560; line-height: 1.7;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-gray { background: #f1f3f6; color: var(--text-2); border-color: #e4e7eb; }
.badge-primary { background: var(--primary-50); color: var(--primary-600); border-color: var(--primary-100); }
.badge-success { background: var(--success-50); color: var(--success); border-color: #bbf7d0; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: #fecaca; }
.badge-warn { background: var(--warn-50); color: var(--warn); border-color: #fde68a; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge svg { width: 13px; height: 13px; }

/* ============================================================
   应用外壳
   ============================================================ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--border); }
.sb-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(140deg, #4f46e5, #7c3aed); color: #fff; font-size: 14px; display: grid; place-items: center; font-weight: 700; }
.sb-brand-name { font-size: 14px; font-weight: 650; line-height: 1.3; }
.sb-brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .03em; }
.sb-nav { padding: 14px 12px; display: grid; gap: 3px; align-content: start; overflow-y: auto; flex: 1; }
.sb-group { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .07em; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: var(--text-2); cursor: pointer; font-weight: 540; transition: background .13s, color .13s;
  border: none; background: none; text-align: left; width: 100%; font-size: 13.5px;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .78; }
.nav-item:hover { background: #f3f4f7; color: var(--text); }
.nav-item.active { background: var(--primary-50); color: var(--primary-600); font-weight: 620; }
.nav-item.active svg { opacity: 1; }
.sb-foot { padding: 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 62px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
  padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 16.5px; }
.topbar .tb-sub { font-size: 12.5px; color: var(--text-3); font-weight: 400; margin-left: 2px; }
.tb-spacer { flex: 1; }
.hamburger { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 11px 5px 5px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; transition: all .15s; position: relative;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: linear-gradient(140deg, #4f46e5, #7c3aed); color: #fff; font-size: 12.5px; font-weight: 650;
}
.user-chip .uc-name { font-size: 13px; font-weight: 580; line-height: 1.25; }
.user-chip .uc-role { font-size: 11px; color: var(--text-3); line-height: 1.25; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 176px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 7px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; color: var(--text-2);
}
.dropdown button:hover { background: #f3f4f7; color: var(--text); }
.dropdown button svg { opacity: .72; }
.dropdown button.danger { color: var(--danger); }
.dropdown button.danger:hover { background: var(--danger-50); }
.dropdown hr { border: none; border-top: 1px solid var(--border); margin: 5px 2px; }

.view { flex: 1; padding: 24px 26px 60px; max-width: 1320px; width: 100%; }

/* ============================================================
   卡片 / 区块
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card + .card { margin-top: 18px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 14.5px; }
.card-head .desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.section-title { font-size: 14.5px; font-weight: 650; margin: 26px 0 12px; display: flex; align-items: center; gap: 9px; }
.section-title:first-child { margin-top: 0; }
.section-title .count { font-size: 12px; color: var(--text-3); font-weight: 500; }

.grid { display: grid; gap: 16px; }
.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)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-end { margin-left: auto; }

/* ---------- 统计卡 ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-xs); }
.stat .k { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.stat .k svg { width: 14px; height: 14px; opacity: .8; }
.stat .v { font-size: 26px; font-weight: 680; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .u { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 3px; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); background: var(--surface-2);
  padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12.5px;
  position: sticky; top: 0; z-index: 2;
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: #fafbfe; }
table.tbl .num { font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
table.tbl .title-cell { max-width: 380px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }

/* ---------- 空状态 ---------- */
.empty { padding: 54px 20px; text-align: center; color: var(--text-3); }
.empty .ico { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; background: #f1f3f7; display: grid; place-items: center; }
.empty .ico svg { width: 24px; height: 24px; color: #aab2bf; }
.empty .t { font-size: 14px; color: var(--text-2); font-weight: 560; }
.empty .s { font-size: 12.5px; margin-top: 4px; }
.center { text-align: center; }

/* ---------- 骨架屏 ---------- */
.skeleton { background: linear-gradient(90deg, #eef0f4 25%, #f6f7f9 37%, #eef0f4 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 7px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============================================================
   上传区
   ============================================================ */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 26px 20px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: all .18s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-50); }
.dropzone.dragover { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.dropzone .dz-ico { width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 12px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; }
.dropzone .dz-ico svg { width: 20px; height: 20px; color: var(--primary); }
.dropzone .dz-t { font-size: 13.5px; font-weight: 580; }
.dropzone .dz-s { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 10px 7px 12px;
  background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: 9px;
  font-size: 13px; color: var(--primary-600); max-width: 100%;
}
.file-chip .fc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; font-weight: 560; }
.file-chip svg { width: 15px; height: 15px; flex: 0 0 auto; }
.bubble .attach svg { width: 14px; height: 14px; }
.c-hint svg { width: 13px; height: 13px; }
.file-chip .fc-size { font-size: 11.5px; color: #6366f1; opacity: .8; flex: 0 0 auto; }
.file-chip .fc-x { border: none; background: none; cursor: pointer; color: #6366f1; display: grid; place-items: center; padding: 2px; border-radius: 5px; }
.file-chip .fc-x:hover { background: rgba(99,102,241,.16); }

.progress { height: 6px; border-radius: 999px; background: #e9ebf0; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 999px; transition: width .4s ease; }

/* ============================================================
   对话窗（上传论文页）
   ============================================================ */
.chat { display: flex; flex-direction: column; height: calc(100vh - 62px - 48px); min-height: 520px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; flex-wrap: wrap; }
.chat-head .ch-title { font-size: 14.5px; font-weight: 650; }
.chat-head .ch-sub { font-size: 12px; color: var(--text-3); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 16px; }
.chat-foot { border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 14px 18px 16px; }

.msg { display: flex; gap: 11px; max-width: 88%; }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg .m-av { width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto; display: grid; place-items: center; font-size: 11.5px; font-weight: 650; }
.msg.bot .m-av { background: linear-gradient(140deg, #4f46e5, #7c3aed); color: #fff; }
.msg.user .m-av { background: #e8eaf0; color: var(--text-2); }
.bubble {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-xs); min-width: 0; font-size: 13.5px; line-height: 1.72;
}
.msg.user .bubble { background: var(--primary); border-color: var(--primary); color: #fff; }
.msg.user .bubble a { color: #e0e7ff; }
.bubble .b-title { font-weight: 620; margin-bottom: 5px; }
.bubble .b-meta { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.msg.user .bubble .b-meta { color: rgba(255,255,255,.72); }
.bubble .attach { display: inline-flex; align-items: center; gap: 7px; margin-top: 7px; padding: 5px 10px; border-radius: 8px; background: rgba(255,255,255,.16); font-size: 12.5px; }
.msg.bot .bubble .attach { background: var(--surface-2); border: 1px solid var(--border); }
.steps { display: grid; gap: 7px; margin-top: 8px; }
.step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.step .sp { width: 15px; height: 15px; flex: 0 0 auto; display: grid; place-items: center; }
.spin { width: 14px; height: 14px; border: 2px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #b6bcc6; animation: td 1.1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .16s; }
.typing-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes td { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { display: grid; gap: 10px; }
.composer .c-row1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px;
  resize: none; min-height: 62px; max-height: 180px; outline: none; line-height: 1.7; transition: border-color .15s, box-shadow .15s;
}
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.13); }
.composer .c-row3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.composer .c-hint { font-size: 12px; color: var(--text-3); }
.model-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.model-pill .mp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: 0 0 auto; }
.model-pill .mp-dot.off { background: var(--text-3); }

/* ============================================================
   问题记录（Markdown 渲染）
   ============================================================ */
.md { font-size: 14px; line-height: 1.85; color: var(--text); word-wrap: break-word; }
.md > *:first-child { margin-top: 0; }
.md h1, .md h2 { font-size: 16px; margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.md h3 { font-size: 14.5px; margin: 20px 0 9px; }
.md h4 { font-size: 13.5px; margin: 16px 0 7px; color: var(--text-2); }
.md p { margin: 10px 0; }
.md ul, .md ol { margin: 10px 0; padding-left: 22px; }
.md li { margin: 5px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.md strong { font-weight: 640; color: #0b1220; }
.md code { font-family: var(--mono); font-size: 12.5px; background: #f1f3f7; border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
.md pre { background: #f7f8fa; border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; overflow-x: auto; }
.md pre code { background: none; border: none; padding: 0; }
.md blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--primary-100); background: var(--primary-50); color: var(--text-2); border-radius: 0 8px 8px 0; }
.md .table-scroll { overflow-x: auto; margin: 14px 0; border: 1px solid var(--border); border-radius: var(--radius); }
.md table { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: collapse; font-size: 13px; background: #fff; }
.md table th { background: var(--surface-2); text-align: left; font-weight: 620; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.md table td { padding: 10px 12px; border-bottom: 1px solid #f0f1f4; vertical-align: top; line-height: 1.7; word-break: break-word; overflow-wrap: anywhere; }
.md table th:nth-child(1), .md table td:nth-child(1) { width: 58px; }
.md table th:nth-child(2), .md table td:nth-child(2) { width: 104px; }
.md table th:nth-child(6), .md table td:nth-child(6) { width: 88px; }
.md table tr:last-child td { border-bottom: none; }
.md table tr:hover td { background: #fafbfe; }

.report-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 22px; }
.report-head .rh { min-width: 0; }
.report-head .rh .k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.report-head .rh .v { font-size: 13.5px; font-weight: 560; word-break: break-word; }

/* ============================================================
   Toast / Modal
   ============================================================ */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 9px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 15px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: tin .22s ease; max-width: 460px; pointer-events: auto;
}
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.out { animation: tout .2s ease forwards; }
@keyframes tout { to { opacity: 0; transform: translateY(-8px); } }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--primary); }
.toast.warn svg { color: var(--warn); }

.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.42); backdrop-filter: blur(2px); z-index: 150; display: grid; place-items: center; padding: 20px; animation: tin .16s ease; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; overflow: hidden; }
.modal.wide { max-width: 620px; }
.modal-head { padding: 17px 20px 0; font-size: 15px; font-weight: 650; }
.modal-body { padding: 12px 20px 4px; color: var(--text-2); font-size: 13.5px; }
.modal-body .field:last-child { margin-bottom: 4px; }
.modal-foot { padding: 16px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   响应式
   ============================================================ */
.sb-mask { display: none; }
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .hamburger { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sb-mask { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.35); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .24s; }
  .sb-mask.open { opacity: 1; pointer-events: auto; }
  .view { padding: 18px 16px 60px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .chat { height: auto; min-height: 0; }
  .chat-body { max-height: 60vh; }
  .msg { max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .tb-sub { display: none; }
  .user-chip { padding: 4px; gap: 0; }
  .user-chip .uc-name, .user-chip .uc-role { display: none; }
  .report-head { grid-template-columns: 1fr; gap: 10px; }
  .view { padding: 14px 12px 50px; }
  .card-head { padding: 14px 14px; }
  .card-body { padding: 14px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .view { padding: 0; }
  .card { border: none; box-shadow: none; }
}
