/* ============================================================
   证知道 · 管理后台样式（线框 / 简约商务 / 大屏适配）
   ============================================================ */
:root {
  --c-primary: #2f5c8f;
  --c-primary-dark: #244a75;
  --c-primary-light: #eaf1f8;
  --c-normal: #2e9e6b;
  --c-near: #cf8a1f;
  --c-urgent: #d9622b;
  --c-expired: #c0392b;
  --text: #1f2329;
  --text-2: #68707c;
  --text-3: #9aa1ab;
  --border: #e2e6ea;
  --border-strong: #cfd5dc;
  --bg: #f3f5f7;
  --bg-subtle: #eef1f4;
  --card: #ffffff;
  --radius: 4px;
  --topbar-h: 58px;
  --sidebar-w: 226px;
  --sidebar-w-mini: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-primary); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text); font-size: 13px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--bg-subtle); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.btn-danger { background: var(--c-expired); border-color: var(--c-expired); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .9; }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

.input, .select {
  min-height: 34px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; outline: none;
}
.input:focus, .select:focus { border-color: var(--c-primary); }
textarea.input { resize: vertical; }
.search-input { width: 240px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.card-hd h3 { font-size: 15px; font-weight: 600; }
.card-bd { padding: 16px; }
.hd-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--text-2); }
.normal-text, .near-text, .urgent-text, .danger-text { font-weight: 600; }
.normal-text { color: var(--c-normal); }
.near-text { color: var(--c-near); }
.urgent-text { color: var(--c-urgent); }
.danger-text { color: var(--c-expired); }
.danger-link { color: var(--c-expired); }

.note-line {
  margin-top: 12px; padding: 10px 12px;
  background: var(--c-primary-light); border-left: 3px solid var(--c-primary);
  color: var(--text-2); font-size: 13px; border-radius: 2px;
}

.status-tag {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 12px; line-height: 1.6; white-space: nowrap; border: 1px solid transparent;
}
.st-normal { color: var(--c-normal); background: #eaf6f0; border-color: #c9e8d9; }
.st-near { color: var(--c-near); background: #fdf5e6; border-color: #f0dcb4; }
.st-urgent { color: var(--c-urgent); background: #fdf0ea; border-color: #f2cbb8; }
.st-expired { color: var(--c-expired); background: #fbecea; border-color: #eccbc7; }

.edu { font-size: 12.5px; color: var(--text-2); }
.edu-completed { color: var(--c-normal); }
.edu-pending { color: var(--c-near); }
.edu-overdue { color: var(--c-expired); }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: #fff; border-bottom: 1px solid var(--border);
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 260px; }
.brand-mark {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-primary); color: #fff; border-radius: 3px; font-weight: 700; font-size: 16px;
}
.brand-mark.large { width: 44px; height: 44px; font-size: 22px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-domain { font-size: 12px; color: var(--text-3); padding-left: 8px; border-left: 1px solid var(--border); }
.topbar-center { display: flex; align-items: center; gap: 10px; }
.top-label { font-size: 12.5px; color: var(--text-2); }
.tenant-select { min-width: 180px; }
.icon-btn {
  position: relative; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.icon-btn:hover { background: var(--bg-subtle); }
.bell-dot {
  position: absolute; top: -5px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--c-expired); color: #fff; border-radius: 9px; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-right { min-width: 260px; display: flex; justify-content: flex-end; }
.account-wrap { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
}
.account-btn:hover { background: var(--bg-subtle); border-color: var(--border); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--c-primary-light);
  color: var(--c-primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600;
}
.account-name { font-size: 13px; }
.role-chip { font-size: 11.5px; color: var(--text-2); background: var(--bg-subtle); padding: 1px 7px; border-radius: 9px; }
.caret { color: var(--text-3); font-size: 11px; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 154px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(31,35,41,.08); padding: 4px; z-index: 60;
}
.account-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: transparent; border: 0; border-radius: 2px; font-size: 13px;
}
.account-menu button:hover { background: var(--bg-subtle); }
.account-menu button.danger { color: var(--c-expired); }

/* ---------- 主体布局 ---------- */
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between;
  transition: width .15s, flex-basis .15s; z-index: 40;
}
.side-menu { padding: 12px 8px; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; margin-bottom: 2px;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--text); text-align: left; font-size: 13.5px;
}
.side-item:hover { background: var(--bg-subtle); }
.side-item.active { background: var(--c-primary-light); color: var(--c-primary); font-weight: 600; }
.side-icon { width: 18px; text-align: center; color: var(--text-2); font-size: 15px; }
.side-item.active .side-icon { color: var(--c-primary); }
.side-foot { border-top: 1px solid var(--border); padding: 8px; }
.collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: transparent; border: 0; color: var(--text-2); font-size: 13px; border-radius: var(--radius);
}
.collapse-btn:hover { background: var(--bg-subtle); }
.ver { text-align: center; color: var(--text-3); font-size: 11px; padding: 6px 0; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-mini); flex-basis: var(--sidebar-w-mini); }
body.sidebar-collapsed .side-text { display: none; }
body.sidebar-collapsed .side-item { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .collapse-btn { justify-content: center; padding: 8px 0; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left .15s; }
body.sidebar-collapsed .main { margin-left: var(--sidebar-w-mini); }
.breadcrumb {
  height: 42px; display: flex; align-items: center; gap: 8px;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border);
  color: var(--text-2); font-size: 12.5px;
}
.breadcrumb .sep { color: var(--text-3); }
.breadcrumb [data-crumb] { color: var(--text); }
.content-inner { padding: 20px 24px 40px; }

/* ---------- 页面通用 ---------- */
.page-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-hd h1 { font-size: 20px; font-weight: 600; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.boot-screen, .loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-2); }
.boot-spinner {
  width: 18px; height: 18px; border: 2px solid var(--border-strong);
  border-top-color: var(--c-primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-block { padding: 20px; background: #fbecea; border: 1px solid #eccbc7; border-radius: var(--radius); color: var(--c-expired); }

.stat-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-height: 132px; }
.stat-hd { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.stat-main { font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.stat-main small { font-size: 13px; font-weight: 400; color: var(--text-2); }
.stat-rows { display: grid; gap: 3px; }
.stat-rows > div { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.stat-rows strong { color: var(--text); font-weight: 600; }
.stat-foot { margin-top: 6px; font-size: 11.5px; color: var(--text-3); }

.stat-bar {
  display: flex; flex-wrap: wrap; gap: 0;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px;
}
.sb-item { flex: 1; min-width: 110px; padding: 12px 18px; border-right: 1px solid var(--border); }
.sb-item:last-child { border-right: 0; }
.sb-item span { display: block; color: var(--text-2); font-size: 12.5px; }
.sb-item strong { display: block; font-size: 20px; margin-top: 2px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-spacer { flex: 1; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 11px 12px; background: var(--bg-subtle);
  border-bottom: 1px solid var(--border); color: var(--text-2); font-weight: 600; white-space: nowrap;
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .ops { white-space: nowrap; }
.mini-btn {
  padding: 3px 8px; margin-right: 4px; font-size: 12px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: 3px; color: var(--c-primary);
}
.mini-btn:hover { background: var(--c-primary-light); }
.mini-btn.danger-link { color: var(--c-expired); }
.link-btn { background: none; border: 0; padding: 0; color: var(--c-primary); text-align: left; }
.link-btn:hover { text-decoration: underline; }
.follow-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 0 0; color: var(--text-2); font-size: 12.5px; }

.empty-state { padding: 52px 20px; text-align: center; color: var(--text-2); }
.empty-icon {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--bg-subtle); color: var(--text-3); display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.empty-title { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty-hint { font-size: 13px; margin-bottom: 14px; }

/* ---------- 环形图 ---------- */
.donut-layout { display: flex; align-items: center; gap: 44px; flex-wrap: wrap; }
.donut { width: 190px; height: 190px; }
.legend { min-width: 260px; display: grid; gap: 10px; }
.lg-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lg-num { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(24,28,33,.36);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; z-index: 100;
  overflow-y: auto;
}
.modal {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 5px;
  box-shadow: 0 12px 40px rgba(24,28,33,.16); display: flex; flex-direction: column; max-height: 88vh;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-hd h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--text-2); }
.modal-close:hover { color: var(--text); }
.modal-bd { padding: 18px; overflow-y: auto; }
.modal-ft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.confirm-text { font-size: 14px; color: var(--text-2); padding: 6px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--text-2); }
.field.full, .form-tip.full { grid-column: 1 / -1; }
.form-tip { font-size: 12px; color: var(--text-2); background: var(--bg-subtle); padding: 8px 10px; border-radius: 3px; }

.info-list { display: grid; gap: 10px; }
.info-list > div { display: flex; gap: 12px; font-size: 13px; }
.info-list span { color: var(--text-2); min-width: 88px; }
.info-list.horizontal { grid-template-columns: repeat(3, 1fr); }

.pop-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.pop-tab { padding: 8px 16px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-2); font-size: 13.5px; }
.pop-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); font-weight: 600; }
.follow-target { padding: 9px 12px; background: var(--bg-subtle); border-radius: 3px; font-size: 13px; margin-bottom: 14px; }

/* ---------- 详情 / 时间线 ---------- */
.detail-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; background: var(--bg-subtle); border-radius: var(--radius); margin-bottom: 16px;
}
.detail-cat { font-size: 15px; font-weight: 600; }
.detail-certno { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.detail-status { display: flex; align-items: center; gap: 12px; }
.days-left { font-size: 13px; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 18px; }
.detail-grid > div { display: flex; gap: 10px; font-size: 13px; }
.detail-grid span { color: var(--text-2); min-width: 76px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.detail-section-hd { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.attach-list { display: grid; gap: 8px; }
.attach-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; }
.attach-ic { width: 24px; height: 24px; background: var(--c-primary-light); color: var(--c-primary); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.attach-item .muted { margin-left: auto; font-size: 12px; }
.archive-hint { margin-top: 8px; color: var(--text-3); font-size: 12px; }

.timeline { display: grid; gap: 0; }
.tl-item { position: relative; padding: 0 0 16px 20px; border-left: 1px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-dot { position: absolute; left: -5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--c-primary); }
.tl-meta { font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.tl-content { font-size: 13px; }
.tl-next { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 72px; right: 20px; z-index: 200; display: grid; gap: 8px; }
.toast {
  min-width: 220px; max-width: 380px; padding: 10px 14px;
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--c-primary);
  border-radius: var(--radius); box-shadow: 0 4px 16px rgba(24,28,33,.1);
  font-size: 13px; opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { border-left-color: var(--c-expired); }
.toast-info { border-left-color: var(--c-primary); }

/* ---------- 登录页 ---------- */
.login-page { display: flex; min-height: 100vh; background: #fff; }
.login-panel { width: 460px; padding: 7vh 46px 32px; display: flex; flex-direction: column; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-title { font-size: 24px; font-weight: 700; }
.login-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.login-form { display: grid; gap: 16px; }
.login-msg { padding: 8px 10px; background: #fbecea; color: var(--c-expired); font-size: 12.5px; border-radius: 3px; }
.demo-box { margin-top: 26px; border: 1px solid var(--border); border-radius: var(--radius); }
.demo-hd { padding: 9px 12px; background: var(--bg-subtle); font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.demo-row { display: grid; grid-template-columns: 86px 116px 1fr; gap: 6px; width: 100%; padding: 8px 12px; background: #fff; border: 0; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; }
.demo-row:last-child { border-bottom: 0; }
.demo-row:hover { background: var(--c-primary-light); }
.demo-user { font-weight: 600; color: var(--c-primary); }
.demo-pwd { color: var(--text-2); }
.demo-desc { color: var(--text-3); }
.login-foot { margin-top: auto; padding-top: 20px; color: var(--text-3); font-size: 11.5px; }
.login-aside {
  flex: 1; background: var(--c-primary); color: #fff;
  padding: 11vh 60px; display: flex; flex-direction: column; justify-content: center;
}
.aside-title { font-size: 30px; font-weight: 700; margin-bottom: 12px; }
.aside-slogan { font-size: 20px; line-height: 1.8; opacity: .95; }
.aside-points { margin-top: 48px; display: grid; gap: 14px; font-size: 14px; opacity: .9; }
.aside-points > div::before { content: '· '; font-weight: 700; }

/* ---------- 附件 / 导入 / 审计 新增样式 ---------- */
.attach-name { background: none; border: none; padding: 0; cursor: pointer; color: var(--c-primary); font-size: inherit; text-align: left; }
.attach-name:hover { text-decoration: underline; }
.attach-item .danger-link { margin-left: auto; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; line-height: 1.6; }
.tag-plain { background: var(--bg-subtle); color: var(--text-2); border: 1px solid var(--border); }
.import-guide { display: grid; gap: 16px; }
.import-step { border: 1px solid var(--border); border-radius: 4px; padding: 14px 16px; }
.import-step strong { color: var(--text); font-size: 14px; }
.import-step p { margin: 6px 0 10px; color: var(--text-2); font-size: 12.5px; line-height: 1.7; }
.import-result { margin-top: 4px; border: 1px solid var(--border); border-radius: 4px; padding: 12px 16px; background: var(--bg-subtle); }
.import-summary { font-size: 13.5px; }
.import-fail { margin-top: 8px; max-height: 140px; overflow: auto; color: var(--c-expired); font-size: 12px; line-height: 1.8; }

/* ---------- 大屏与窄屏 ---------- */
@media (min-width: 1600px) {
  .content-inner { padding: 24px 32px 48px; max-width: 1920px; }
  .data-table { font-size: 13.5px; }
  .data-table th, .data-table td { padding: 14px 16px; }
}
@media (max-width: 1100px) {
  .stat-groups { grid-template-columns: repeat(2, 1fr); }
  .info-list.horizontal { grid-template-columns: repeat(2, 1fr); }
  .login-aside { display: none; }
  .login-panel { width: 100%; max-width: 460px; margin: 0 auto; }
}
@media (max-width: 760px) {
  .stat-groups { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
