/* ============================================================
   外设接入风险感知平台 · 基础样式
   ============================================================ */
@font-face { font-family: 'Sora'; src: url('/assets/fonts/sora-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('/assets/fonts/sora-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('/assets/fonts/sora-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('/assets/fonts/sora-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink-900: #081420;
  --ink-800: #0b1d2e;
  --ink-700: #10283d;
  --ink-600: #16344c;
  --ink: #0f2233;
  --text: #17262f;
  --text-2: #41525f;
  --sub: #6b7a86;
  --muted: #96a2ad;
  --paper: #eef1f6;
  --paper-2: #f6f8fb;
  --card: #ffffff;
  --line: rgba(15, 42, 66, .09);
  --line-strong: rgba(15, 42, 66, .16);
  --teal: #0f9d8f;
  --teal-deep: #0a7d72;
  --teal-soft: rgba(15, 157, 143, .10);
  --cyan: #2aa8c9;
  --amber: #d99a2b;
  --amber-soft: rgba(217, 154, 43, .12);
  --red: #cf3f35;
  --red-soft: rgba(207, 63, 53, .10);
  --violet: #6a55c9;
  --green: #1f7a5c;
  --shadow-sm: 0 1px 2px rgba(12, 32, 51, .05);
  --shadow: 0 10px 28px -14px rgba(12, 32, 51, .30), 0 2px 6px rgba(12, 32, 51, .04);
  --shadow-lg: 0 32px 70px -28px rgba(8, 24, 38, .45), 0 8px 24px -12px rgba(8, 24, 38, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --font-num: 'Sora', 'DIN Alternate', 'Segoe UI', sans-serif;
  --font-cn: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Source Han Sans SC', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-cn);
  color: var(--text);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; }
p { margin: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
::selection { background: rgba(15, 157, 143, .18); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 48, 72, .16); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 48, 72, .30); }

/* 通用工具 */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; font-size: 12px; }
.muted { color: var(--sub); }
.flex { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.w100 { width: 100%; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; white-space: nowrap; transition: all .18s ease;
  background: #fff; color: var(--text);
}
.btn i { font-size: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, #0f9d8f, #0a7d72);
  color: #fff; box-shadow: 0 8px 20px -10px rgba(15, 157, 143, .75);
}
.btn-primary:hover { box-shadow: 0 12px 26px -10px rgba(15, 157, 143, .85); filter: brightness(1.04); }
.btn-dark { background: linear-gradient(135deg, #17344a, #0d2032); color: #fff; box-shadow: 0 10px 22px -12px rgba(10, 30, 48, .8); }
.btn-line { border-color: var(--line-strong); background: #fff; color: var(--text-2); }
.btn-line:hover { border-color: rgba(15, 157, 143, .55); color: var(--teal-deep); background: rgba(15, 157, 143, .04); }
.btn-soft { background: var(--teal-soft); color: var(--teal-deep); }
.btn-soft:hover { background: rgba(15, 157, 143, .16); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: rgba(207, 63, 53, .16); }
.btn-ghost { background: transparent; color: var(--sub); }
.btn-ghost:hover { background: rgba(15, 42, 66, .05); color: var(--text); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-sm i { font-size: 14px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; gap: 4px; }
.btn-xs i { font-size: 13px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--text-2);
  transition: all .18s ease; position: relative;
}
.icon-btn:hover { border-color: rgba(15, 157, 143, .4); color: var(--teal-deep); background: rgba(15, 157, 143, .05); }
.icon-btn i { font-size: 18px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-item { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.form-item.span-2 { grid-column: span 2; }
.form-item.span-3 { grid-column: span 3; }
.form-item > label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.form-item > label em { color: var(--red); font-style: normal; margin-left: 3px; }
.form-item .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: #fbfcfe;
  padding: 9px 12px; height: 38px; font-size: 13.5px; outline: none; transition: all .16s ease;
}
.textarea { height: auto; min-height: 86px; resize: vertical; line-height: 1.7; padding: 10px 12px; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(15, 157, 143, .65); background: #fff; box-shadow: 0 0 0 3px rgba(15, 157, 143, .12); }
.input::placeholder, .textarea::placeholder { color: #a9b3bc; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a86' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.input-icon .input { padding-left: 36px; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 22px; background: #cfd8e0; border: none; transition: background .2s ease; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: all .2s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--teal); }
.switch.on::after { left: 21px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox-line input { width: 15px; height: 15px; accent-color: var(--teal); }

/* 标签 / 状态 */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px;
  border-radius: 7px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: rgba(15, 42, 66, .06); color: var(--text-2);
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-teal { background: var(--teal-soft); color: var(--teal-deep); }
.tag-amber { background: var(--amber-soft); color: #996a11; }
.tag-red { background: var(--red-soft); color: #a92f27; }
.tag-violet { background: rgba(106, 85, 201, .10); color: #5744ac; }
.tag-blue { background: rgba(42, 133, 201, .10); color: #1f6fa8; }
.tag-gray { background: rgba(15, 42, 66, .05); color: var(--sub); }

.lv-critical { background: rgba(207, 63, 53, .12); color: #b32a22; }
.lv-high { background: rgba(232, 89, 12, .12); color: #b8460b; }
.lv-mid { background: rgba(197, 138, 0, .13); color: #8f6400; }
.lv-low { background: rgba(31, 122, 92, .12); color: #17664b; }

.st-pending { background: rgba(217, 154, 43, .14); color: #8f6400; }
.st-doing { background: rgba(28, 111, 214, .11); color: #1b5ea8; }
.st-verify { background: rgba(106, 85, 201, .12); color: #5744ac; }
.st-done { background: rgba(31, 122, 92, .12); color: #17664b; }
.st-danger { background: rgba(207, 63, 53, .12); color: #b32a22; }
.st-muted { background: rgba(15, 42, 66, .06); color: var(--sub); }

/* 数据表格 */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; font-size: 13px; }
.data-table thead th {
  background: #f7f9fc; color: var(--sub); font-weight: 500; font-size: 12px; text-align: left;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: .02em;
}
.data-table thead th:first-child { border-top-left-radius: 10px; }
.data-table thead th:last-child { border-top-right-radius: 10px; }
.data-table tbody td { padding: 13px 14px; border-bottom: 1px solid rgba(15, 42, 66, .055); vertical-align: middle; color: var(--text-2); }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #fafcfd; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-main { color: var(--text); font-weight: 500; }
.data-table .cell-link { color: var(--teal-deep); font-weight: 500; cursor: pointer; }
.data-table .cell-link:hover { text-decoration: underline; }
.data-table .cell-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.data-table .ops { display: flex; gap: 4px; flex-wrap: nowrap; }
.op-link { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 6px; color: var(--teal-deep); font-size: 12.5px; cursor: pointer; }
.op-link:hover { background: var(--teal-soft); }
.op-link.danger { color: var(--red); }
.op-link.danger:hover { background: var(--red-soft); }
.table-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.table-empty i { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px 0; flex-wrap: wrap; }
.pager-info { font-size: 12.5px; color: var(--sub); }
.pager-btns { display: flex; align-items: center; gap: 5px; }
.pager-btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text-2); font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
.pager-btn:hover { border-color: rgba(15, 157, 143, .45); color: var(--teal-deep); }
.pager-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager-btn[disabled] { opacity: .4; pointer-events: none; }

/* 弹窗 */
.modal-root, .drawer-root { position: relative; z-index: 1200; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(7, 20, 32, .52); backdrop-filter: blur(5px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 20px;
  opacity: 0; transition: opacity .2s ease; overflow-y: auto; z-index: 1200;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: min(760px, 100%); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(.985); transition: transform .26s cubic-bezier(.2,.8,.3,1);
  overflow: hidden; position: relative;
}
.modal-mask.show .modal { transform: translateY(0) scale(1); }
.modal.sm { width: min(480px, 100%); }
.modal.lg { width: min(960px, 100%); }
.modal.xl { width: min(1120px, 100%); }
.modal-head {
  padding: 20px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line); position: relative;
  background: linear-gradient(180deg, #fbfdfd, #fff);
}
.modal-head::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--teal), #2aa8c9); }
.modal-head h3 { font-size: 16.5px; letter-spacing: .01em; }
.modal-head p { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.modal-close { width: 32px; height: 32px; border-radius: 9px; border: none; background: rgba(15, 42, 66, .05); color: var(--sub); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-close:hover { background: rgba(207, 63, 53, .1); color: var(--red); }
.modal-body { padding: 22px 24px; max-height: 68vh; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fbfcfe; }
.modal-note { display: flex; gap: 10px; padding: 11px 14px; border-radius: 10px; background: rgba(15, 157, 143, .06); border: 1px solid rgba(15, 157, 143, .16); color: #14695f; font-size: 12.5px; line-height: 1.6; }
.modal-note i { font-size: 16px; margin-top: 1px; }
.modal-note.warn { background: var(--amber-soft); border-color: rgba(217,154,43,.28); color: #8a5f0a; }

/* 抽屉 */
.drawer-mask { position: fixed; inset: 0; background: rgba(7, 20, 32, .45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .22s; z-index: 1100; }
.drawer-mask.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 94vw); background: #fff; z-index: 1101;
  box-shadow: -30px 0 70px -30px rgba(5, 18, 30, .5); transform: translateX(40px); opacity: 0;
  transition: all .28s cubic-bezier(.2,.8,.3,1); display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); opacity: 1; }
.drawer.wide { width: min(920px, 96vw); }
.drawer-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; background: linear-gradient(180deg, #fbfdfd, #fff); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 30px; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfe; display: flex; justify-content: flex-end; gap: 10px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-btn { padding: 10px 14px; font-size: 13px; color: var(--sub); border: none; background: transparent; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.on { color: var(--teal-deep); border-bottom-color: var(--teal); font-weight: 600; }

/* Toast */
.toast-root { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 12px;
  background: rgba(10, 26, 40, .94); color: #eaf4f2; font-size: 13px; box-shadow: var(--shadow-lg);
  animation: toastIn .28s cubic-bezier(.2,.8,.3,1) both; max-width: 520px;
  border: 1px solid rgba(255,255,255,.08);
}
.toast i { font-size: 17px; color: #3dd6bd; }
.toast.error i { color: #ff8d84; }
.toast.warn i { color: #ffcf6e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Skeleton */
.sk-line { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f6, #f7f9fb, #eef2f6); background-size: 200% 100%; animation: sk 1.2s infinite; }
.sk-line.w30 { width: 30%; height: 26px; }
.sk-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0; }
.sk-cards span { height: 104px; border-radius: 14px; background: linear-gradient(90deg, #eef2f6, #f7f9fb, #eef2f6); background-size: 200% 100%; animation: sk 1.2s infinite; }
.sk-block { height: 340px; border-radius: 16px; background: linear-gradient(90deg, #eef2f6, #f7f9fb, #eef2f6); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 空态 */
.empty-state { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty-state i { font-size: 40px; display: block; margin-bottom: 10px; opacity: .45; }

/* 独立错误页 */
.plain-body { background: radial-gradient(circle at 20% 0%, #e8f3f1, #eef1f6 55%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.plain-wrap { text-align: center; max-width: 460px; padding: 40px; }
.plain-icon { width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 22px; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); color: var(--teal-deep); font-size: 34px; }
.plain-wrap h1 { font-size: 22px; margin-bottom: 10px; }
.plain-wrap p { color: var(--sub); font-size: 13.5px; margin-bottom: 22px; }

/* 命令面板 */
.cmd-mask { position: fixed; inset: 0; background: rgba(6, 18, 29, .45); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 2000; }
.cmd-mask.show { opacity: 1; pointer-events: auto; }
.cmd-palette {
  position: fixed; top: 16vh; left: 50%; width: min(560px, 92vw); transform: translate(-50%, -8px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 2001; opacity: 0; pointer-events: none;
  transition: all .2s cubic-bezier(.2,.8,.3,1); overflow: hidden;
}
.cmd-palette.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmd-input i { font-size: 18px; color: var(--sub); }
.cmd-input input { flex: 1; border: none; outline: none; font-size: 14px; background: transparent; }
.cmd-input kbd { font-family: var(--font-num); font-size: 10px; color: var(--sub); border: 1px solid var(--line-strong); padding: 3px 6px; border-radius: 5px; }
.cmd-list { max-height: 340px; overflow-y: auto; padding: 8px; }
.cmd-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.cmd-item:hover, .cmd-item.on { background: rgba(15, 157, 143, .08); }
.cmd-item i { color: var(--teal-deep); font-size: 16px; }
.cmd-item .cmd-group { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.cmd-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }

/* 响应式 */
@media (max-width: 1200px) {
  .sk-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-item.span-2, .form-item.span-3 { grid-column: auto; }
}
