/* ================= 通用组件 ================= */

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  padding: 0 14px; height: 34px; white-space: nowrap;
  transition: all var(--fast) var(--ease); user-select: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #F4FAF6; box-shadow: 0 1px 2px rgba(10,85,66,.35), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-soft { background: var(--brand-wash); color: var(--brand-ink); }
.btn-soft:hover { background: #D5E9DF; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--line-3); }
.btn-danger { background: var(--danger); color: #FDF3EE; }
.btn-danger:hover { background: var(--danger-deep); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-danger-ghost:hover { background: var(--danger-wash); }
.btn-warn { background: var(--warn-wash); color: var(--warn-deep); border-color: var(--warn-line); }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; border-radius: var(--r-md); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-xs); }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); display: inline-grid; place-items: center; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* —— 标签 / 徽标 —— */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; }
.chip-b { background: var(--brand-wash); color: var(--brand-ink); }
.chip-r { background: var(--danger-wash); color: var(--danger-deep); }
.chip-w { background: var(--warn-wash); color: var(--warn-deep); }
.chip-i { background: var(--info-wash); color: var(--info); }
.chip-g { background: var(--paper-2); color: var(--ink-2); }
.chip-o { background: var(--ok-wash); color: var(--brand-ink); }
.chip-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-sens {
  background: var(--danger-wash); color: var(--danger-deep);
  border: 1px dashed var(--danger-line);
  letter-spacing: .06em;
}
.chip-sens svg { width: 11px; height: 11px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
}
.status-pill .sp-dot { width: 8px; height: 8px; border-radius: 50%; }
.st-ok .sp-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-wash); }
.st-warn .sp-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-wash); }
.st-dang .sp-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }
.st-idle .sp-dot { background: #A6B0A8; box-shadow: 0 0 0 3px #ECEFEC; }
.st-inv .sp-dot { background: var(--info); box-shadow: 0 0 0 3px var(--info-wash); }
.st-ok { color: var(--brand-ink); } .st-warn { color: var(--warn-deep); }
.st-dang { color: var(--danger-deep); } .st-idle { color: var(--ink-3); } .st-inv { color: var(--info); }

/* —— 头像 —— */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  display: inline-grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.avatar.xs { width: 24px; height: 24px; flex-basis: 24px; font-size: 10px; border-radius: 7px; }
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 18px; }
.avatar.xl { width: 76px; height: 76px; flex-basis: 76px; font-size: 26px; }
.avatar .offline-dot { position: relative; }
.avatar-wrap { position: relative; display: inline-block; }
.avatar-wrap .presence {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  border-radius: 50%; border: 2px solid var(--surface);
}
.presence.on { background: #34A67A; }
.presence.off { background: #B9C0BA; }

/* —— 面板 / 卡片 —— */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 14.5px; }
.panel-head .ph-sub { font-size: 12px; color: var(--ink-3); }
.panel-head .grow { flex: 1; }
.panel-body { padding: 16px 18px; }
.panel + .panel { margin-top: 18px; }

.soft-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px 16px;
  transition: box-shadow var(--fast), transform var(--fast), border-color var(--fast);
}
.soft-card.hoverable { cursor: pointer; }
.soft-card.hoverable:hover {
  border-color: var(--line-3); box-shadow: var(--shadow-1); transform: translateY(-1px);
}

/* —— 表格 —— */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--ink-3);
  text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line-2);
  background: var(--surface-2); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background var(--fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.row-click { cursor: pointer; }
.tbl .td-main { font-weight: 600; color: var(--ink); }
.tbl .td-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.tbl-num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.tbl .tbl-actions { text-align: right; white-space: nowrap; }
.anchor-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--brand-ink);
}
.anchor-btn:hover { text-decoration: underline; }
.anchor-btn.danger { color: var(--danger); }

/* —— 表单 —— */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .f-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }
.input, .select, textarea.input {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); font-size: 13px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand-bright);
  box-shadow: 0 0 0 3px rgba(47,143,116,.13);
}
.input.err { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(193,75,43,.12); }
textarea.input { height: auto; padding: 9px 12px; line-height: 1.6; resize: vertical; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.input-icon .icon-right { left: auto; right: 11px; }
.input-icon .input.pr { padding-right: 34px; }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .sw-track {
  width: 36px; height: 21px; border-radius: var(--r-full);
  background: #C9CBBF; transition: background var(--fast); position: relative; flex: 0 0 36px;
}
.switch .sw-track::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; transition: left var(--fast) var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .sw-track { background: var(--brand); }
.switch input:checked + .sw-track::after { left: 18px; }
.switch input:disabled + .sw-track { opacity: .45; cursor: not-allowed; }
.switch .sw-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }

/* 分段控件 tabs */
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; padding: 5px 14px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all var(--fast);
}
.seg button svg { width: 13px; height: 13px; }
.seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(23,36,30,.12); }

/* 详情行 */
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: break-word; }
.kv dd.mono { font-family: var(--font-display); font-size: 12.5px; }

/* —— 下拉菜单 —— */
.menu-pop {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 90;
  animation: qz-pop var(--mid) var(--ease) both;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink); cursor: pointer; text-align: left;
}
.menu-item svg { width: 15px; height: 15px; color: var(--ink-3); }
.menu-item:hover { background: var(--brand-wash-2); color: var(--brand-ink); }
.menu-item:hover svg { color: var(--brand); }
.menu-item .mi-role { margin-left: auto; font-size: 10.5px; color: var(--ink-3); }
.menu-item.active-m { background: var(--brand-wash); color: var(--brand-ink); font-weight: 600; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.menu-head { padding: 7px 10px 4px; font-size: 10.5px; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; }

/* —— 抽屉 —— */
.scrim { position: fixed; inset: 0; background: rgba(15,30,24,.42); z-index: 100; animation: qz-fade var(--fast) both; backdrop-filter: blur(1.5px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--paper); z-index: 110; display: flex; flex-direction: column;
  box-shadow: -18px 0 50px -20px rgba(15,30,24,.35);
  animation: qz-slide-r var(--mid) var(--ease) both;
}
.drawer.wide { width: min(760px, 96vw); }
.drawer-head {
  padding: 18px 22px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 14px;
}
.drawer-head h2 { font-size: 17px; }
.drawer-head .dh-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.drawer-head .close { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; }
.drawer-foot {
  padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* —— 对话框 —— */
.modal-box {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px;
}
.modal-box .scrim { z-index: -1; }
.dialog {
  width: min(460px, 94vw); background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--shadow-2);
  animation: qz-pop var(--mid) var(--ease) both; overflow: hidden;
}
.dialog-head { padding: 20px 22px 0; }
.dialog-head .dh-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; }
.dialog-head .dh-ico svg { width: 19px; height: 19px; }
.dialog-head h3 { font-size: 16.5px; }
.dialog-body { padding: 10px 22px 4px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.dialog-body .danger-note {
  margin-top: 12px; padding: 9px 12px; background: var(--danger-wash);
  border: 1px solid var(--danger-line); border-radius: var(--r-md);
  color: var(--danger-deep); font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start;
}
.dialog-body .danger-note svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 2px; }
.dialog-foot { padding: 16px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* —— Toast —— */
.toast-stack { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--ink); color: #F2F6F2; font-size: 13px;
  padding: 10px 16px 10px 12px; border-radius: var(--r-full);
  box-shadow: var(--shadow-pop); animation: qz-toast var(--fast) var(--ease) both;
  max-width: 78vw;
}
.toast svg { width: 16px; height: 16px; flex: 0 0 16px; }
.toast.t-success svg { color: #7FD8B4; }
.toast.t-danger svg { color: #F29A78; }
.toast.t-info svg { color: #9CC4DA; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all var(--mid); }

/* —— 空态 —— */
.empty {
  padding: 44px 24px 40px; text-align: center; color: var(--ink-3);
}
.empty .e-illus { width: 120px; height: 96px; margin: 0 auto 14px; opacity: .9; }
.empty h4 { color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 12.5px; max-width: 380px; margin: 0 auto 14px; line-height: 1.7; }

/* —— 分步向导 —— */
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.step { flex: 1; position: relative; }
.step::after {
  content: ""; position: absolute; top: 13px; left: 34px; right: -8px; height: 2px;
  background: var(--line-2); border-radius: 2px;
}
.step:last-child::after { display: none; }
.step .st-node {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--line-2); color: #fff; font-size: 12px; font-weight: 700; font-family: var(--font-display);
}
.step.done .st-node { background: var(--brand); }
.step.done::after { background: var(--brand-bright); }
.step.cur .st-node { background: var(--brand-bright); box-shadow: 0 0 0 4px var(--brand-wash); }
.step .st-label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.step .st-sub { font-size: 11px; color: var(--ink-3); }

/* —— 进度条 —— */
.bar { height: 6px; background: var(--paper-2); border-radius: var(--r-full); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-bright), var(--brand)); border-radius: var(--r-full); transition: width .5s var(--ease); }

/* —— 徽章条 / 区块提示 —— */
.notice {
  display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--r-md);
  font-size: 12.5px; line-height: 1.6; align-items: flex-start;
}
.notice svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.notice-b { background: var(--brand-wash); color: var(--brand-ink); }
.notice-w { background: var(--warn-wash); color: var(--warn-deep); }
.notice-r { background: var(--danger-wash); color: var(--danger-deep); }
.notice-i { background: var(--info-wash); color: var(--info); }
.notice b { font-weight: 700; }

/* 敏感标签带（页面顶部的数据红黄牌） */
.sens-strip {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: linear-gradient(180deg, #FFFDF9, #FDF8EE);
  border: 1px solid var(--warn-line); border-left: 3px solid var(--warn);
  border-radius: var(--r-md); padding: 9px 12px; font-size: 12px; color: var(--warn-deep);
}
.sens-strip .ss-x { margin-left: 2px; }

/* —— PRD 对照浮钮 & 面板 —— */
.prd-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: #EAF3EE; border: 0; cursor: pointer;
  padding: 10px 16px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-pop); transition: all var(--fast);
}
.prd-fab svg { width: 16px; height: 16px; }
.prd-fab:hover { background: var(--brand-ink); transform: translateY(-2px); }
.prd-panel { width: min(560px, 96vw); }
.prd-kv { margin-top: 10px; }
.prd-tag { display: inline-block; font-family: var(--font-display); font-size: 11px; font-weight: 700; background: var(--paper-2); border: 1px solid var(--line-2); color: var(--brand-ink); padding: 2px 8px; border-radius: var(--r-xs); margin: 0 6px 6px 0; }
.interaction-list { list-style: none; padding: 0; margin: 8px 0 0; }
.interaction-list li { display: flex; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 4px 0; line-height: 1.6; }
.interaction-list svg { width: 14px; height: 14px; color: var(--brand); flex: 0 0 14px; margin-top: 3px; }

/* 行内小标签图标 */
.tip-ico { width: 14px; height: 14px; vertical-align: -2px; color: var(--ink-3); cursor: help; }

/* 权限矩阵通用 */
.mtx-table th, .mtx-table td { padding: 9px 10px; font-size: 12.5px; }
.mtx-table td.c { text-align: center; }
.mtx-cell { display: inline-grid; place-items: center; }
.mtx-check { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--line-3); background: var(--surface); position: relative; }
.mtx-check.on { background: var(--brand); border-color: var(--brand); }
.mtx-check.on::after { content: ""; width: 8px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.mtx-check.part { background: var(--brand-wash); border-color: var(--brand-bright); }
.mtx-check.part::after { content: ""; width: 7px; height: 2px; background: var(--brand); border-radius: 2px; }
.mtx-check.sens-lock { background: var(--danger-wash); border-color: var(--danger-line); }
.mtx-check.sens-lock svg { width: 9px; height: 9px; color: var(--danger); }

@media (max-width: 900px) {
  .topbar-search { display: none; }
  .pagehead { grid-template-columns: 1fr; }
  .content { padding: 18px 16px 90px; }
}
