/* ============================================================
   超高壓倉儲智能管理系統 — 設計系統
   淺色駕駛艙 · 電力藍 → 能源青綠 · 玻璃質感
   ============================================================ */

:root {
  /* —— 背景 —— */
  --bg:        #EAEFF6;
  --bg-2:      #F2F5FA;
  --bg-mesh-a: rgba(27,107,255,0.10);
  --bg-mesh-b: rgba(6,182,164,0.10);

  /* —— 表面 / 玻璃 —— */
  --surface:        #FFFFFF;
  --surface-2:      #F7F9FC;
  --glass:          rgba(255,255,255,0.66);
  --glass-strong:   rgba(255,255,255,0.82);
  --glass-border:   rgba(255,255,255,0.7);

  /* —— 文字 —— */
  --ink:    #0E1A2B;
  --ink-2:  #3C4A5E;
  --ink-3:  #6B7A90;
  --ink-4:  #98A4B5;

  /* —— 線 —— */
  --line:       #E1E8F1;
  --line-soft:  rgba(14,26,43,0.06);

  /* —— 品牌：電力藍 → 能源青綠 —— */
  --blue:       #1B6BFF;
  --blue-deep:  #0B4ED6;
  --blue-soft:  #EAF1FF;
  --teal:       #07B6A2;
  --teal-deep:  #059684;
  --teal-soft:  #E2F7F3;
  --grad:       linear-gradient(120deg, #1B6BFF 0%, #1294E6 48%, #07B6A2 100%);
  --grad-soft:  linear-gradient(120deg, rgba(27,107,255,0.12), rgba(7,182,162,0.12));
  --grad-text:  linear-gradient(120deg, #1B6BFF, #07B6A2);

  /* —— 狀態 —— */
  --ok:      #10B981;  --ok-soft:     #E4F8F0;
  --warn:    #F59E0B;  --warn-soft:   #FEF3DD;
  --danger:  #EF4444;  --danger-soft: #FDE7E7;
  --yellow:  #EAB308;  --yellow-soft: #FBF4D9;
  --info:    #3B82F6;  --info-soft:   #E6EFFE;
  --purple:  #8B5CF6;  --purple-soft: #EFEAFE;

  /* —— 陰影 —— */
  --sh-sm:  0 1px 2px rgba(14,26,43,0.05), 0 2px 6px rgba(14,26,43,0.04);
  --sh:     0 1px 2px rgba(14,26,43,0.04), 0 10px 28px rgba(14,26,43,0.07);
  --sh-lg:  0 24px 60px rgba(14,26,43,0.14);
  --sh-blue:0 12px 30px rgba(27,107,255,0.28);

  /* —— 圓角 —— */
  --r-xs: 8px;  --r-sm: 12px;  --r: 16px;  --r-lg: 22px;  --r-xl: 28px;  --r-pill: 999px;

  /* —— 字體 —— */
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "Space Grotesk", "Noto Sans SC", system-ui, sans-serif;

  --side-w: 244px;
  --top-h: 70px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

#root { height: 100vh; }

/* 背景柔光 mesh — 駕駛艙氛圍 */
.app-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -8%, var(--bg-mesh-a), transparent 60%),
    radial-gradient(820px 560px at 100% 0%, var(--bg-mesh-b), transparent 58%),
    radial-gradient(700px 700px at 60% 120%, rgba(27,107,255,0.06), transparent 60%);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(14,26,43,0.16); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(14,26,43,0.28); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

/* —— 玻璃卡片 —— */
.glass {
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--sh);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh);
}

/* —— 文字漸變 —— */
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* —— 通用工具 —— */
.num { font-family: var(--font-num); font-feature-settings: "tnum" 1; letter-spacing: -0.01em; }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.spread { justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }
.muted { color: var(--ink-3); }
.mut2 { color: var(--ink-4); }

/* —— 徽章 —— */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok     { color: var(--ok);     background: var(--ok-soft); }
.badge-warn   { color: #B7791F;       background: var(--warn-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.badge-yellow { color: #A16207;       background: var(--yellow-soft); }
.badge-info   { color: var(--info);   background: var(--info-soft); }
.badge-purple { color: var(--purple); background: var(--purple-soft); }
.badge-gray   { color: var(--ink-3);  background: #EEF2F7; }

/* —— 按鈕 —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: #CBD5E3; box-shadow: var(--sh-sm); transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  color: #fff; background: var(--grad); border: none;
  box-shadow: var(--sh-blue);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 14px 34px rgba(27,107,255,0.36); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: rgba(14,26,43,0.05); box-shadow: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: #fff; background: linear-gradient(120deg,#FB6B6B,#EF4444); border: none; }

/* —— 進入動畫 —— */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }
.fade-in { animation: fadeIn .4s ease both; }

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
  70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.pulse-danger { animation: pulse-ring 2s infinite; }

@keyframes sweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* —— 區塊標題 —— */
.sec-title { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-4);
}

/* —— 表格 —— */
.tbl {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}
.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-4);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 13px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2);
  white-space: nowrap;
  vertical-align: middle;
}
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.table-scroll,
.card:has(.tbl) {
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.ledger-drag-scroll {
  cursor: grab;
  user-select: none;
  scrollbar-gutter: stable both-edges;
}
.ledger-drag-scroll.dragging {
  cursor: grabbing;
}
.force-x-scroll {
  overflow-x: scroll !important;
  padding-bottom: 6px;
}
.force-x-scroll::-webkit-scrollbar {
  height: 14px;
}
.force-x-scroll::-webkit-scrollbar-thumb {
  background: rgba(27,107,255,0.38);
  border: 3px solid rgba(255,255,255,0.85);
  background-clip: content-box;
}
.force-x-scroll::-webkit-scrollbar-track {
  background: rgba(14,26,43,0.06);
  border-radius: 999px;
}
.ai-ledger-float {
  position: fixed;
  right: 26px;
  bottom: 24px;
  z-index: 40;
}
.ai-ledger-fab {
  height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  background: var(--grad);
  box-shadow: var(--sh-blue);
  font-size: 13.5px;
  font-weight: 800;
}
.ai-ledger-window {
  width: min(430px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 110px));
  overflow: auto;
  border-radius: 16px;
  box-shadow: var(--sh-lg);
}
.ai-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ai-edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 700;
}
.ai-edit-grid .input {
  height: 34px;
  font-size: 12.5px;
  padding: 0 10px;
}
.mini-chat-log {
  min-height: 170px;
  max-height: 270px;
  overflow: auto;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.mini-chat-empty {
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
}
.mini-chat-msg {
  display: flex;
  margin-bottom: 9px;
}
.mini-chat-msg > div {
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.mini-chat-msg.user {
  justify-content: flex-end;
}
.mini-chat-msg.user > div {
  color: #fff;
  background: var(--blue);
}
.mini-chat-msg.assistant {
  justify-content: flex-start;
}
.mini-chat-msg.assistant > div {
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-soft);
}
.mini-chat-msg strong {
  color: var(--ink);
  font-weight: 800;
}
.mini-md-heading {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  margin: 2px 0 6px;
}
.mini-md-list {
  position: relative;
  padding-left: 14px;
  margin: 3px 0;
}
.mini-md-list::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

/* —— 輸入 —— */
.input {
  height: 40px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; color: var(--ink); width: 100%; transition: all .15s;
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,107,255,0.14); }
.input::placeholder { color: var(--ink-4); }

/* —— 滾動區 —— */
.scroll-y { overflow-y: auto; overflow-x: auto; }
.main-scroll { overflow-x: auto !important; }

/* —— 倉庫 GIS:點選坐標時的十字準星 —— */
.leaflet-container.gis-picking,
.leaflet-container.gis-picking .leaflet-grab,
.leaflet-container.gis-picking .leaflet-interactive { cursor: crosshair !important; }
.gis-pick-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 500; padding: 9px 16px; border-radius: 999px; pointer-events: none;
  background: rgba(27,107,255,0.95); color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(27,107,255,0.35); white-space: nowrap;
  animation: fadeIn .2s ease;
}

/* —— 倉庫 GIS 工作台 —— */
.gis-workbench {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.gis-notice {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: var(--surface);
}
.gis-notice-error { color: var(--danger); border-color: rgba(239,68,68,.22); background: var(--danger-soft); }
.gis-notice-ok { color: var(--ok); border-color: rgba(16,185,129,.22); background: var(--ok-soft); }
.gis-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.gis-metric {
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 6px 10px;
  align-items: center;
  box-shadow: var(--sh-sm);
}
.gis-metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}
.gis-metric-label {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 800;
}
.gis-metric strong {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}
.gis-metric small {
  grid-column: 1 / -1;
  color: var(--ink-4);
  font-size: 12px;
}
.gis-main {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.gis-map-shell {
  position: sticky;
  top: 0;
  min-height: 650px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sh-sm);
}
.gis-map-canvas {
  height: 650px;
  width: 100%;
  background: var(--surface-2);
}
.gis-map-top {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.gis-segments,
.gis-tool-row {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 5px;
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  pointer-events: auto;
}
.gis-segments button,
.gis-tool-row button {
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.gis-segments button.active,
.gis-tool-row button.active {
  background: var(--blue);
  color: #fff;
}
.gis-map-fallback {
  position: absolute;
  inset: 70px 18px auto 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  z-index: 3;
}
.gis-measure-readout,
.gis-area-save {
  position: absolute;
  z-index: 3;
  left: 14px;
  bottom: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: var(--sh-sm);
  font-size: 13px;
}
.gis-area-save {
  display: grid;
  grid-template-columns: 180px auto;
  gap: 8px;
  align-items: center;
}
.gis-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 650px;
  overflow-y: auto;
  padding-right: 2px;
}
.gis-panel,
.gis-detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--sh-sm);
  padding: 14px;
}
.gis-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}
.gis-panel-head > span {
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
}
.gis-panel-head small {
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.gis-warehouse-list,
.gis-alert-list,
.gis-geocode-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.gis-warehouse-row {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.gis-warehouse-row.active {
  border-color: rgba(27,107,255,.46);
  background: var(--blue-soft);
}
.gis-warehouse-row b {
  display: block;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gis-warehouse-row small {
  display: block;
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 11.5px;
}
.gis-pill {
  min-width: 30px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.gis-pill.ok { background: var(--ok-soft); color: var(--ok); }
.gis-pill.warn { background: var(--warn-soft); color: var(--warn); }
.gis-pill.danger { background: var(--danger-soft); color: var(--danger); }
.gis-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.gis-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
}
.gis-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.gis-geocode-list {
  margin-top: 8px;
  max-height: 150px;
  overflow: auto;
}
.gis-ai-textarea {
  min-height: 78px;
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
.gis-ai-result {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.gis-ai-result button {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}
.gis-ai-result b {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
}
.gis-ai-result small {
  display: block;
  margin-top: 3px;
  color: var(--ink-4);
  line-height: 1.35;
  font-size: 11.5px;
}
.gis-geocode-list button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
}
.gis-alert-row {
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  display: grid;
  gap: 3px;
}
.gis-alert-row.red { border-left-color: var(--danger); }
.gis-alert-row.orange { border-left-color: var(--warn); }
.gis-alert-row.yellow { border-left-color: #EAB308; }
.gis-alert-row span {
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 900;
}
.gis-alert-row b {
  font-size: 12.5px;
  color: var(--ink);
}
.gis-alert-row small {
  color: var(--ink-3);
  line-height: 1.45;
  font-size: 11.5px;
}
.gis-detail-grid {
  display: grid;
  grid-template-columns: minmax(330px, .8fr) minmax(520px, 1.2fr);
  gap: 16px;
}
.gis-kpi-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.gis-kpi-line div {
  min-height: 70px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.gis-kpi-line small {
  display: block;
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
}
.gis-kpi-line b {
  color: var(--ink);
  font-size: 20px;
}
.gis-kpi-line b.ok { color: var(--ok); }
.gis-kpi-line b.warn { color: var(--warn); }
.gis-kpi-line b.danger { color: var(--danger); }
.gis-zone-strip {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gis-zone-strip span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
}
.gis-zone-strip b {
  margin-right: 6px;
  color: var(--ink);
}
.gis-filterline {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 132px auto auto;
  gap: 8px;
  align-items: center;
  width: min(620px, 100%);
}
.gis-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
  gap: 9px;
  max-height: 470px;
  overflow-y: auto;
  padding-right: 3px;
}
.gis-location-cell {
  min-height: 116px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 5px;
  position: relative;
  cursor: pointer;
}
.gis-location-cell:hover {
  border-color: rgba(27,107,255,.38);
  box-shadow: var(--sh-sm);
}
.gis-location-cell.danger {
  background: var(--danger-soft);
  border-color: rgba(239,68,68,.2);
}
.gis-location-cell.ok {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}
.gis-location-code {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink);
}
.gis-location-meta,
.gis-location-items {
  color: var(--ink-4);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gis-capbar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: #E6ECF5;
}
.gis-capbar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #10B981, #1B6BFF);
}
.gis-location-cell.danger .gis-capbar i {
  background: linear-gradient(90deg, #F59E0B, #EF4444);
}
.gis-location-cell em {
  position: absolute;
  right: 8px;
  top: 8px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}
.gis-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.gis-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15,23,42,.42);
}
.gis-modal-body {
  width: min(620px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh);
}

/* —— 智能預警工作台 —— */
.alerts-workbench { min-width: 0; }
.alerts-hero {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.35fr);
  gap: 18px;
  align-items: stretch;
}
.alerts-hero-main {
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}
.alerts-hero-title {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  color: var(--ink);
}
.alerts-hero-sub {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-3);
}
.alerts-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
/* 類別概覽橫排(取代雷達)*/
.alerts-overview {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.alerts-overview-card {
  flex: 0 0 auto;
  min-width: 104px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s ease;
}
.alerts-overview-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.alerts-overview-card.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: var(--sh-sm); }
.alerts-overview-name { font-size: 12.5px; color: var(--ink-2); font-weight: 700; }
.alerts-overview-count { font-size: 22px; font-weight: 800; color: var(--ink); }
.alerts-overview-card.active .alerts-overview-count { color: var(--blue-deep); }

/* AI 工作台面板 */
.alerts-ai { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.alerts-ai-head { display: flex; align-items: center; justify-content: space-between; }
.alerts-ai-empty { font-size: 12.5px; color: var(--ink-3); }
.alerts-ai-log { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; padding: 4px 2px; }
.alerts-ai-msg { display: flex; flex-direction: column; gap: 6px; }
.alerts-ai-msg.user { align-items: flex-end; }
.alerts-ai-bubble { max-width: 90%; padding: 10px 13px; border-radius: 13px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.alerts-ai-msg.user .alerts-ai-bubble { background: var(--blue); color: #fff; }
.alerts-ai-msg.assistant .alerts-ai-bubble { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.alerts-ai-step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); padding-left: 2px; }
.alerts-ai-spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.alerts-ai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.alerts-ai-chips button { font-size: 12px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--blue-deep); cursor: pointer; }
.alerts-ai-chips button:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.alerts-ai-chips button:disabled { opacity: .5; cursor: default; }
.alerts-ai-input { display: flex; gap: 8px; }
.alerts-ai-input input { flex: 1; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; color: var(--ink); }
.alerts-ai-input input:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.alerts-ai-card { margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--warn); background: var(--warn-soft); max-width: 92%; }
.alerts-ai-card-head { display: flex; align-items: center; gap: 8px; }
/* 今日簡報卡 */
.alerts-brief { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: linear-gradient(180deg, var(--blue-soft), #fff); border-color: var(--blue-soft); }
.alerts-brief-main { flex: 1; min-width: 0; }
.alerts-brief-line { font-size: 13.5px; color: var(--ink); line-height: 1.6; font-weight: 600; }

/* ============ 智能預警 · AI Co-pilot 風險態勢頁 ============ */
.risk-page { display: flex; flex-direction: column; gap: 16px; }
.risk-topbar { display: flex; align-items: flex-start; justify-content: space-between; }
.risk-title { font-size: 22px; font-weight: 800; color: var(--ink); }
.risk-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.risk-err { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 13px; }
.risk-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.risk-canvas { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Hero */
.risk-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; background: linear-gradient(135deg, #fbfdff, #f3f7fc); }
.risk-hero-eyebrow { font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.risk-hero-word { font-size: 34px; font-weight: 900; line-height: 1.1; margin: 4px 0 8px; }
.risk-hero-line { font-size: 13.5px; color: var(--ink-2); line-height: 1.65; max-width: 46ch; }
.risk-hero-r { text-align: right; flex: 0 0 auto; }
.risk-hero-big { font-size: 46px; font-weight: 900; line-height: 1; }
.risk-hero-cap { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.risk-today { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px; background: var(--warn-soft); color: #B45309; font-size: 11.5px; font-weight: 700; }

.risk-sec { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }
.risk-clear { font-size: 12px; color: var(--blue); font-weight: 700; }

/* 分級色帶 */
.risk-bands { padding: 16px 18px; }
.risk-band { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 4px; background: none; cursor: pointer; border-radius: 8px; }
.risk-band:hover { background: var(--surface-2); }
.risk-band.on { background: var(--blue-soft); }
.risk-band-name { flex: 0 0 56px; text-align: left; font-size: 13px; font-weight: 700; }
.risk-band-track { flex: 1; height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.risk-band-fill { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; min-width: 3px; }
.risk-band-n { flex: 0 0 36px; text-align: right; font-size: 15px; font-weight: 800; color: var(--ink); }
.risk-bands-foot { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }

/* 類別條 */
.risk-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.risk-cat { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: all .14s; }
.risk-cat:hover { border-color: var(--blue); transform: translateY(-1px); }
.risk-cat.on { border-color: var(--blue); background: var(--blue-soft); }
.risk-cat-name { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.risk-cat-n { font-size: 14px; font-weight: 800; color: var(--ink); }
/* 態勢圖表 */
.risk-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; }
.risk-chart { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.risk-chart-title { font-size: 13px; font-weight: 800; color: var(--ink); }
.risk-chart-body { display: flex; align-items: center; gap: 14px; }
.risk-donut { position: relative; flex: 0 0 auto; }
.risk-donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.risk-donut-center b { font-size: 19px; font-weight: 800; color: var(--ink); }
.risk-donut-center span { font-size: 10px; color: var(--ink-3); }
.risk-donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.risk-leg { display: flex; align-items: center; gap: 6px; background: none; border: none; padding: 3px 5px; border-radius: 7px; font-size: 12px; color: var(--ink-2); width: 100%; }
button.risk-leg:hover:not(:disabled) { background: var(--surface-2); }
.risk-leg.on { background: var(--blue-soft); color: var(--blue-deep); font-weight: 700; }
.risk-leg-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.risk-leg-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.risk-leg-v { font-weight: 700; color: var(--ink); }
.risk-chart-foot { font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--line-soft); padding-top: 8px; }
/* 列表工具條 + 表格 / 卡片網格 / 分組 */
.risk-listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 2px; flex-wrap: wrap; }
.risk-listbar-l { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.risk-listbar-r { display: flex; align-items: center; gap: 8px; }
.risk-seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.risk-seg button { border: none; background: #fff; padding: 6px 13px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.risk-seg button.on { background: var(--blue); color: #fff; }
.risk-select { border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 12.5px; background: #fff; color: var(--ink-2); cursor: pointer; }
.risk-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.risk-more { grid-column: 1/-1; font-size: 12px; color: var(--ink-3); padding: 8px 4px; }
.risk-table { padding: 0; overflow: hidden; }
.risk-trow { display: grid; grid-template-columns: 24px minmax(0, 1fr) 96px 56px 92px 108px; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 0 14px; background: #fff; border: none; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.risk-trow:hover { background: #f8fbff; }
.risk-thead { height: 38px; background: #f5f8fc; font-weight: 800; color: var(--ink); position: sticky; top: 0; z-index: 1; cursor: default; }
.risk-thead:hover { background: #f5f8fc; }
.risk-tbody { overflow-y: auto; }
.risk-trow .c-item { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.risk-trow .c-cat, .risk-trow .c-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); }
.risk-trow .c-sev, .risk-trow .c-due { text-align: right; }
.risk-groups { display: flex; flex-direction: column; gap: 8px; }
.risk-group { padding: 0; overflow: hidden; }
.risk-group-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; background: #fff; border: none; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.risk-group-head:hover { background: #f8fbff; }
.risk-group-n { margin-left: 2px; color: var(--ink-3); font-weight: 700; }
.risk-group-caret { margin-left: auto; color: var(--ink-4); }
.risk-group-body { border-top: 1px solid var(--line); }
.risk-group-body .risk-table, .risk-group-body .risk-cardgrid { padding: 10px; }
.risk-group-body .risk-table { border: none; box-shadow: none; border-radius: 0; }
/* 預警規則抽屜 */
.rules-aibar { background: var(--blue-soft); border: 1px solid #d6e4ff; border-radius: 12px; padding: 12px 14px; }
.rules-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.rules-card-head { display: flex; align-items: center; justify-content: space-between; }
.rules-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.rules-pill.on { background: var(--ok-soft); color: #047857; }
.rules-pill.off { background: #eef2f7; color: var(--ink-3); }
.rules-what { font-size: 12.5px; color: var(--ink-2); }
.rules-conds { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }
.rules-cond { font-size: 12px; color: var(--ink); }
.rules-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.rules-field { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 11.5px; color: var(--ink-3); }
.rules-field b { color: var(--ink); }
.rules-card-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.rules-edit { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--blue); background: var(--blue-soft); border: none; border-radius: 8px; padding: 5px 11px; cursor: pointer; }
.rules-reset { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.rules-reset:hover { color: var(--ink); }
.rules-pill.cust { background: var(--warn-soft); color: #B45309; }
.rules-group { display: flex; flex-direction: column; gap: 10px; }
.rules-group-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: var(--ink-3); letter-spacing: .03em; margin-top: 4px; }
.rules-group-title .num { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--ink-2); }
.kpi-hint { font-size: 12px; color: var(--ink-2); background: var(--blue-soft); border: 1px solid #d6e4ff; border-radius: 10px; padding: 10px 12px; line-height: 1.6; }
.kpi-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.kpi-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.kpi-del { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-3); cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; }
.kpi-del:hover { color: var(--danger); border-color: var(--danger); }
/* P4 超時升級 + 可解釋嚴重度 */
.risk-esc { font-size: 10.5px; font-weight: 800; color: #B91C1C; background: #FEE2E2; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.risk-esc-banner { background: #FEE2E2; color: #B91C1C; border-radius: 10px; padding: 10px 13px; font-size: 12.5px; font-weight: 700; }
.risk-why { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.risk-why-label { font-size: 11px; font-weight: 800; color: var(--ink-3); }
.risk-why-tag { font-size: 11.5px; font-weight: 700; color: #B45309; background: var(--warn-soft); border-radius: 999px; padding: 2px 9px; }
.risk-why-score { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--ink); }
/* 規則→受影響貨物 鑽取 */
.rules-drill { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--blue); background: none; border: none; cursor: pointer; padding: 2px 0; }
.rules-drill-body { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.rules-wh-title { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--ink-2); padding: 2px 0; }
.rules-wh-title .num { background: var(--surface); border-radius: 999px; padding: 0 7px; font-size: 10.5px; color: var(--ink-3); }
.rules-wh-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.rules-wh-row:hover { border-color: var(--blue); background: #f8fbff; }
.rules-wh-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.rules-wh-item { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 庫存管理 預警徽標 */
.inv-alert-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 800; color: #fff; border-radius: 999px; padding: 1px 7px; cursor: pointer; }
.risk-inv-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; font-weight: 700; color: var(--blue); background: var(--blue-soft); border: none; border-radius: 10px; padding: 8px 13px; cursor: pointer; }
.risk-inv-link:hover { background: #d6e4ff; }

/* 紅色高危 */
.risk-critical { padding: 14px 16px; border-left: 4px solid #B91C1C; background: linear-gradient(180deg, #fef2f2, #fff); }
.risk-critical-list { display: flex; flex-direction: column; gap: 5px; }
.risk-critical-item { font-size: 12.5px; color: var(--ink-2); }

/* 預警卡 */
.risk-list-head { margin-top: 2px; }
.risk-card { display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: box-shadow .15s, transform .15s; box-shadow: var(--sh-sm); }
.risk-card:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.risk-card-dot { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.risk-card-body { flex: 1; min-width: 0; }
.risk-card-title { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 800; color: var(--ink); }
.risk-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.risk-card-sug { font-size: 12.5px; color: var(--ink-2); margin: 3px 0; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.risk-card-meta { font-size: 11px; color: var(--ink-3); }
.risk-card-score { font-size: 22px; font-weight: 900; flex: 0 0 auto; }
.risk-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; text-align: center; }

/* AI 指揮台 */
.risk-copilot { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; max-height: calc(100vh - 96px); padding: 0; overflow: hidden; }
.risk-cop-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.risk-cop-chat { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 280px; }
.risk-cop-hello { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.risk-cop-chip { align-self: flex-start; font-size: 12.5px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--blue-deep); cursor: pointer; }
.risk-cop-chip:hover { border-color: var(--blue); background: var(--blue-soft); }
.risk-msg { display: flex; flex-direction: column; gap: 6px; }
.risk-msg.user { align-items: flex-end; }
.risk-bubble { max-width: 92%; padding: 10px 13px; border-radius: 13px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.risk-msg.user .risk-bubble { background: var(--blue); color: #fff; }
.risk-msg.assistant .risk-bubble { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.risk-step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.risk-spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.risk-prop { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--warn); background: var(--warn-soft); display: flex; flex-direction: column; gap: 6px; max-width: 96%; }
.risk-cop-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.risk-cop-input input { flex: 1; height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; color: var(--ink); }
.risk-cop-input input:focus { outline: none; border-color: var(--blue); background: var(--surface); }

/* 詳情抽屜 */
.risk-drawer-mask { position: fixed; inset: 0; background: rgba(14,26,43,.34); z-index: 60; display: flex; justify-content: flex-end; }
.risk-drawer { width: 460px; max-width: 92vw; height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15); animation: drawerIn .22s ease; }
@keyframes drawerIn { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.risk-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.risk-drawer-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.risk-drawer-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.risk-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.risk-kpis > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; display: flex; flex-direction: column; gap: 3px; }
.risk-kpis span { font-size: 11.5px; color: var(--ink-3); }
.risk-kpis b { font-size: 17px; color: var(--ink); }
.risk-drawer-sug { background: var(--blue-soft); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.risk-evidence { display: flex; flex-direction: column; gap: 6px; }
.risk-evidence > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.risk-evidence span { color: var(--ink-3); flex: 0 0 auto; }
.risk-evidence b { color: var(--ink); text-align: right; word-break: break-all; }
.risk-drawer-foot { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.risk-drawer-foot .btn { flex: 1; }
@media (max-width: 1024px) { .risk-grid { grid-template-columns: 1fr; } .risk-copilot { position: static; max-height: none; } }

/* ============ 法務合規 · AI 秘書工作台 ============ */
.legal-page { display: flex; flex-direction: column; gap: 16px; color: var(--ink); }
.legal-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .85fr); gap: 16px; align-items: start; }
.legal-canvas { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.legal-card { padding: 16px; border-radius: 14px; }
.legal-hero { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px 24px; background: linear-gradient(135deg, #fbfdff, #f4f9f7); overflow: hidden; }
.legal-hero-main { min-width: 0; }
.legal-hero-word { font-size: 34px; font-weight: 900; line-height: 1.1; margin: 4px 0 8px; }
.legal-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.legal-hero-score { flex: 0 0 auto; text-align: right; padding-left: 16px; border-left: 1px solid var(--line-soft); }
.legal-hero-score .num { font-size: 50px; font-weight: 900; line-height: .95; }
.legal-hero-score span { display: block; margin-top: 5px; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.legal-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.legal-metric { min-width: 0; min-height: 86px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-sm); }
.legal-metric-label { font-size: 12px; color: var(--ink-3); margin-bottom: 12px; font-weight: 700; }
.legal-metric-value { font-size: 22px; font-weight: 900; overflow-wrap: anywhere; }
.legal-signal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.legal-signal { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 15px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.legal-signal:hover { box-shadow: var(--sh); transform: translateY(-1px); border-color: var(--blue); }
.legal-signal-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.legal-signal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.legal-signal-body b { font-size: 13.5px; color: var(--ink); }
.legal-signal-body em { font-style: normal; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legal-signal-num { font-size: 24px; font-weight: 900; flex: 0 0 auto; }
.legal-listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.legal-tabs { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.legal-tabs button { border: none; border-left: 1px solid var(--line-soft); background: var(--surface); padding: 7px 12px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.legal-tabs button:first-child { border-left: none; }
.legal-tabs button.on { background: var(--ink); color: #fff; font-weight: 800; }
.legal-copilot { align-self: start; padding: 0; overflow: visible; }
.legal-cop-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: visible; }
.legal-ai-bubble { padding: 12px 13px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.legal-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.legal-chip-grid .risk-cop-chip { display: inline-flex; align-items: center; gap: 6px; }
.legal-command-stack { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--surface); }
.legal-command-title { padding: 10px 12px; font-size: 12px; font-weight: 900; color: var(--ink-3); background: #f8fbff; border-bottom: 1px solid var(--line-soft); }
.legal-command-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.legal-command-row:last-child { border-bottom: none; }
.legal-command-row code { align-self: flex-start; padding: 2px 7px; border-radius: 7px; background: var(--blue-soft); color: var(--blue-deep); font-size: 11.5px; font-weight: 800; }
.legal-command-row span { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.legal-checkbox { display: flex; flex-direction: column; gap: 9px; padding: 12px; border-radius: 13px; background: linear-gradient(180deg, #fff, #f8fafc); border: 1px solid var(--line); }
.legal-check-result { border-radius: 10px; padding: 9px 10px; font-size: 12.5px; font-weight: 800; }
.legal-check-result.ok { background: var(--ok-soft); color: #047857; }
.legal-check-result.warn { background: var(--warn-soft); color: #B45309; }
.legal-check-result.danger { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 1120px) { .legal-grid { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .legal-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
  .legal-hero-score { width: 100%; display: flex; align-items: baseline; justify-content: space-between; border-left: none; border-top: 1px solid var(--line-soft); padding: 12px 0 0; }
  .legal-tabs { width: 100%; overflow-x: auto; }
  .legal-tabs button { flex: 0 0 auto; }
  .legal-signal-body em { white-space: normal; }
}

/* ============ 數字資產 · AI 秘書中樞 ============ */
.da-page { display: flex; flex-direction: column; gap: 16px; color: var(--ink); }
.da-scope-tabs { display: inline-flex; align-self: flex-start; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--sh-sm); max-width: 100%; overflow-x: auto; }
.da-scope-tabs button { min-width: 210px; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-2); text-align: left; cursor: pointer; }
.da-scope-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.da-scope-tabs b { display: block; font-size: 13px; line-height: 1.1; }
.da-scope-tabs em { display: block; margin-top: 3px; font-size: 11px; font-style: normal; color: inherit; opacity: .72; white-space: nowrap; }
.da-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .85fr); gap: 16px; align-items: start; }
.da-canvas { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.da-hero { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px 24px; background: linear-gradient(135deg, #fbfdff, #f5f8ff); flex-wrap: wrap; }
.da-hero > div:first-child { min-width: 0; flex: 1 1 320px; }
.da-hero-word { font-size: 34px; font-weight: 900; line-height: 1.1; margin: 4px 0 8px; }
.da-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.da-hero-score { flex: 0 0 auto; text-align: right; padding-left: 16px; border-left: 1px solid var(--line-soft); }
.da-hero-score b { display: block; font-size: 50px; line-height: .95; color: var(--blue); }
.da-hero-score span { font-size: 12px; color: var(--ink-3); font-weight: 800; }
.da-digital-hero { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh-sm); background: linear-gradient(135deg, #f9fcff, #fffaf1); }
.da-digital-section { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--sh-sm); overflow: hidden; }
.da-digital-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, #fbfdff, #fff); }
.da-digital-section-head h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.2; color: var(--ink); }
.da-digital-section-head p { margin: 0; max-width: 68ch; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.da-digital-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; padding: 14px; }
.da-digital-type { min-height: 128px; display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 5px 10px; align-items: start; padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.da-digital-type:hover, .da-digital-right:hover { border-color: rgba(27,107,255,.42); box-shadow: var(--sh-sm); transform: translateY(-1px); }
.da-digital-type > span { grid-row: 1 / 4; width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.da-digital-type b { font-size: 14px; color: var(--ink); }
.da-digital-type em { font-size: 12px; line-height: 1.45; color: var(--ink-3); font-style: normal; }
.da-digital-type strong { align-self: end; color: var(--ink-2); font-size: 11px; font-weight: 900; }
.da-digital-right-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 14px; }
.da-digital-right { min-height: 112px; display: flex; flex-direction: column; gap: 7px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.da-digital-right span { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 900; }
.da-digital-right b { font-size: 14px; color: var(--ink); }
.da-digital-right em { font-size: 12px; line-height: 1.45; color: var(--ink-3); font-style: normal; }
.da-hosting-panel { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr); gap: 14px; padding: 14px; }
.da-host-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: start; }
.da-host-form textarea, .da-host-form input[placeholder*="URI"] { grid-column: span 2; }
.da-upload-box { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; background: #fff; color: var(--ink-2); font-size: 12.5px; font-weight: 800; cursor: pointer; overflow: hidden; }
.da-upload-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-upload-box input { display: none; }
.da-checkline { min-height: 38px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 800; }
.da-host-result { min-height: 150px; display: flex; flex-direction: column; gap: 9px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: linear-gradient(180deg, #fff, #f7fbff); }
.da-host-result b { color: var(--ink); font-size: 14px; }
.da-host-result span { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
.da-host-result code { align-self: flex-start; max-width: 100%; overflow-wrap: anywhere; padding: 5px 8px; border-radius: 8px; background: var(--blue-soft); color: var(--blue-deep); font-size: 11.5px; font-weight: 900; }
.da-digital-flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; padding: 14px; }
.da-digital-step { position: relative; min-height: 118px; padding: 12px 12px 12px 14px; border: 1px solid var(--line-soft); border-left: none; background: #fff; }
.da-digital-step:first-child { border-left: 1px solid var(--line-soft); border-radius: 12px 0 0 12px; }
.da-digital-step:last-child { border-radius: 0 12px 12px 0; }
.da-digital-step span { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 12px; font-weight: 900; }
.da-digital-step b { display: block; margin-top: 10px; font-size: 13px; color: var(--ink); }
.da-digital-step em { display: block; margin-top: 5px; font-size: 11.5px; line-height: 1.45; color: var(--ink-3); font-style: normal; }
.da-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.da-metric { min-height: 92px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh-sm); }
.da-metric-label { font-size: 12px; color: var(--ink-3); font-weight: 800; margin-bottom: 10px; }
.da-metric-value { font-size: 22px; font-weight: 900; overflow-wrap: anywhere; }
.da-metric-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.da-science { padding: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.da-science-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(180deg, #fbfdff, #fff); }
.da-science-head h3 { margin: 2px 0 3px; font-size: 18px; line-height: 1.2; color: var(--ink); }
.da-science-head p { margin: 0; max-width: 62ch; font-size: 12.5px; line-height: 1.55; color: var(--ink-3); }
.da-science-tabs { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.da-science-tabs button { border: none; border-left: 1px solid var(--line-soft); background: transparent; padding: 7px 12px; color: var(--ink-2); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.da-science-tabs button:first-child { border-left: none; }
.da-science-tabs button.on { background: var(--ink); color: #fff; font-weight: 800; }
/* auto-fit + 操作列獨佔整行:任何寬度下都不會橫向溢出壓到右側秘書欄 */
.da-science-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.da-science-controls > .da-science-actions { grid-column: 1 / -1; }
.da-science-controls label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--ink-3); font-weight: 800; }
.da-science-controls select, .da-science-controls input { height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; background: #fff; color: var(--ink); font-size: 12.5px; min-width: 0; }
.da-science-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.da-science-msg { margin: 0 18px 12px; padding: 9px 11px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-deep); font-size: 12.5px; font-weight: 800; }
.da-science-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 18px; }
.da-model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 9px; }
.da-model-card { min-height: 86px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 11px; background: #fbfdff; }
.da-model-card span { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 800; }
.da-model-card b { display: block; margin-top: 9px; color: var(--ink); font-size: 18px; line-height: 1.1; overflow-wrap: anywhere; }
.da-model-card em { display: block; margin-top: 4px; color: var(--ink-3); font-size: 11px; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-science-split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 12px; }
.da-science-title { font-size: 12.5px; color: var(--ink); font-weight: 900; margin-bottom: 8px; }
.da-coef-list { display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.da-coef-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--ink-2); }
.da-coef-list > div:first-child { border-top: none; }
.da-coef-list b { color: var(--ink); }
.da-forecast-strip { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px; border: 1px solid var(--line-soft); border-radius: 10px; min-height: 42px; }
.da-forecast-strip span.num { padding: 4px 8px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 800; }
.da-science-note { margin: 8px 0 0; color: var(--ink-3); font-size: 11.5px; line-height: 1.5; }
.da-panel-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.da-panel-summary > div { padding: 10px 11px; border-radius: 10px; background: #fbfdff; border: 1px solid var(--line-soft); }
.da-panel-summary span { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 800; }
.da-panel-summary b { display: block; margin-top: 7px; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.da-panel-table { border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; }
.da-panel-row { display: grid; grid-template-columns: minmax(160px, 1.4fr) 70px 100px 100px; gap: 8px; align-items: center; padding: 9px 11px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-2); }
.da-panel-row:first-child { border-top: none; }
.da-panel-head { background: #f8fbff; color: var(--ink); font-size: 11.5px; font-weight: 900; }
.da-panel-row em { display: block; color: var(--ink-3); font-style: normal; font-size: 11px; }
.da-panel-empty { padding: 18px; color: var(--ink-3); font-size: 12.5px; text-align: center; }
.da-run-list { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.da-run-item { display: grid; grid-template-columns: 70px 80px minmax(0, 1fr) 190px; gap: 8px; align-items: center; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 10px; background: #fff; font-size: 12.5px; }
.da-run-item b { color: var(--ink); }
.da-run-item em { color: var(--ink-2); font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-run-item .num { color: var(--ink-3); text-align: right; font-size: 11.5px; }
.da-signal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.da-signal { display: grid; grid-template-columns: 38px minmax(0, 1fr) 42px; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; width: 100%; text-align: left; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.da-signal:hover { box-shadow: var(--sh); transform: translateY(-1px); border-color: var(--blue); }
.da-signal > span { grid-row: 1 / 3; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.da-signal b { font-size: 13.5px; color: var(--ink); }
.da-signal em { font-size: 12px; color: var(--ink-3); font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-signal strong { grid-row: 1 / 3; grid-column: 3; text-align: right; font-size: 24px; font-weight: 900; }
.da-listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.da-table { padding: 0; overflow: hidden; }
.da-trow { display: grid; grid-template-columns: minmax(170px, 1.4fr) 70px 78px 90px 90px 70px 100px 100px 172px; gap: 8px; align-items: center; min-height: 48px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-2); }
.da-head { min-height: 38px; background: #f8fbff; color: var(--ink); font-weight: 900; font-size: 11.5px; }
.da-asset { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.da-asset b { color: var(--ink); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-asset em { color: var(--ink-3); font-size: 11.5px; font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.da-actions .btn { min-width: 30px; padding: 5px 7px; justify-content: center; }
.da-actions .da-icon-btn { min-width: 28px; padding: 5px; }
.da-watch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.da-watch-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-sm);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.da-watch-card:hover { border-color: rgba(27,107,255,.42); box-shadow: var(--sh); transform: translateY(-1px); }
.da-watch-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.da-watch-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.da-watch-name b {
  color: var(--ink);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.da-watch-name em {
  color: var(--ink-3);
  font-size: 11.5px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.da-watch-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 900;
}
.da-watch-quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  gap: 12px;
  margin-top: 14px;
}
.da-watch-quote > div {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 11px;
  background: #f8fbff;
  border: 1px solid var(--line-soft);
}
.da-watch-quote span,
.da-watch-quote em {
  display: block;
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}
.da-watch-quote strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  overflow-wrap: anywhere;
}
.da-watch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.da-quote-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.15;
}
.da-quote-cell b { color: var(--ink); font-size: 12.5px; }
.da-quote-cell em {
  color: var(--ink-4);
  font-family: var(--font);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
}
.da-quote-cell.pending b { color: var(--warn); font-family: var(--font); }
.da-empty { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--ink-3); padding: 28px; }
.da-empty b { color: var(--ink); font-size: 15px; }
.da-copilot { position: sticky; top: 12px; align-self: start; padding: 0; overflow: hidden; max-height: calc(100vh - 120px); display: flex; flex-direction: column; min-width: 0; }
.da-copilot .da-cop-body { flex: 1; min-height: 0; }
.da-cop-body { display: flex; flex-direction: column; gap: 10px; padding: 14px; overflow-y: auto; }
.da-ai-bubble { padding: 12px 13px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.da-cop-body .risk-cop-chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.da-command-stack { display: flex; flex-wrap: wrap; gap: 7px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; background: var(--surface); }
.da-command-stack .legal-command-title { width: 100%; padding: 0 0 4px; border: none; background: transparent; }
.da-command-stack code { padding: 3px 8px; border-radius: 8px; background: var(--blue-soft); color: var(--blue-deep); font-size: 11.5px; font-weight: 800; }
.da-modal-mask {
  position: fixed;
  top: var(--top-h);
  right: 0;
  bottom: 0;
  left: var(--side-w);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 22px;
  background: rgba(14,26,43,.34);
}
.da-modal,
.da-detail-modal {
  width: min(680px, calc(100vw - var(--side-w) - 56px));
  max-height: calc(100vh - var(--top-h) - 44px);
  overflow-y: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--sh-lg);
}
.da-register-modal { width: min(520px, calc(100vw - var(--side-w) - 56px)); }
.da-detail-modal {
  width: min(860px, calc(100vw - var(--side-w) - 56px));
  padding: 22px;
}
.da-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* ===== Quant Lab v2 可視化 ===== */
.da-hbar { display: grid; grid-template-columns: minmax(72px, 110px) 1fr 64px; gap: 8px; align-items: center; font-size: 12px; }
.da-hbar-label { color: var(--ink-3); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-hbar-track { height: 9px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.da-hbar-track i { display: block; height: 100%; border-radius: 5px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.da-hbar b { text-align: right; color: var(--ink); }
.da-hbar em { grid-column: 2 / 4; color: var(--ink-3); font-style: normal; font-size: 11px; }

.da-range { display: flex; flex-direction: column; gap: 5px; }
.da-range-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.da-range-head b { color: var(--ink); font-size: 13px; }
.da-range-track { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); }
.da-range-track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.da-range-track u { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--ink); transform: translateX(-50%); }

.da-heat { display: grid; gap: 3px; font-size: 11px; }
.da-heat-name { color: var(--ink-3); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; padding-right: 4px; }
.da-heat-cell { display: grid; place-items: center; min-height: 30px; border-radius: 6px; font-weight: 800; }

.da-weight-table { border: 1px solid var(--line-soft); border-radius: 11px; overflow: hidden; }
.da-weight-row { display: grid; grid-template-columns: minmax(64px, 100px) repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.da-weight-row:first-child { border-top: none; }
.da-weight-head { background: #f8fbff; font-weight: 900; color: var(--ink); font-size: 11.5px; }
.da-weight-head b { text-align: left; }
.da-weight-row > span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-weight-row b { position: relative; display: block; height: 18px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.da-weight-row b i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; opacity: .25; }
.da-weight-row b u { position: absolute; inset: 0; display: grid; place-items: center; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 11px; }

.da-cmp-picker { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 18px 12px; }
.da-cmp-chip { border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 12px; background: var(--surface); color: var(--ink-2); cursor: pointer; }
.da-cmp-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 800; }
.da-cmp-row { grid-template-columns: minmax(120px, 1.3fr) 90px 84px 84px 60px 90px; }
.da-shock-row { grid-template-columns: minmax(150px, 1.6fr) 52px 84px 76px; }
.da-regime-row { grid-template-columns: minmax(110px, 1.4fr) 52px 80px 60px; }
.da-regime-hero { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.da-regime-now { flex: 0 0 200px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 14px 16px; border: 2px solid; border-radius: 12px; background: #fbfdff; }
.da-regime-now span { font-size: 11.5px; color: var(--ink-3); font-weight: 800; }
.da-regime-now b { font-size: 26px; font-weight: 900; line-height: 1.1; }
.da-regime-now em { font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.da-regime-now u { text-decoration: none; font-weight: 900; color: var(--ink); }

.da-forecast-bars { display: flex; gap: 8px; align-items: stretch; min-height: 84px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 10px; }
.da-forecast-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.da-forecast-bar i { display: block; width: 100%; border-radius: 4px; min-height: 4px; }
.da-forecast-bar span { text-align: center; font-size: 10.5px; color: var(--ink-3); }

.da-lab-empty { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 30px 16px; text-align: center; color: var(--ink-3); }
.da-lab-empty b { color: var(--ink); font-size: 14px; }
.da-lab-empty span { font-size: 12px; }

/* ===== 觀察倉卡片 v2(火花線) ===== */
.da-type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 7px; transform: translateY(-1px); }
.da-change-chip { flex: 0 0 auto; padding: 4px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 800; }
.da-watch-price { display: flex; align-items: baseline; gap: 7px; margin: 8px 0 6px; }
.da-watch-price strong { font-size: 22px; font-weight: 900; color: var(--ink); letter-spacing: -.3px; }
.da-watch-price span { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.da-watch-price em { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 800; }
.da-watch-spark { height: 36px; margin: 0 -2px 8px; }
.da-spark-empty { height: 34px; display: grid; place-items: center; font-size: 11px; color: var(--ink-3); background: var(--surface-2); border-radius: 8px; }
.da-watch-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.da-watch-foot > em { font-style: normal; font-size: 11px; color: var(--ink-3); }

/* ===== 秘書欄分組 ===== */
.da-cop-group { display: flex; flex-direction: column; gap: 6px; }
.da-cop-group-title { font-size: 10.5px; font-weight: 900; letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; padding-left: 2px; }
.da-cop-group-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ===== 數字市場櫥窗 ===== */
.da-market-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 26px 28px; border-radius: 16px; color: #fff; background: linear-gradient(125deg, #14141f 0%, #1c2340 55%, #16323c 100%); border: 1px solid rgba(255,255,255,.08); box-shadow: var(--sh-sm); }
.da-market-eyebrow { font-size: 11.5px; font-weight: 900; letter-spacing: .1em; color: #8db4ff; text-transform: uppercase; }
.da-market-title { font-size: 30px; font-weight: 900; line-height: 1.1; margin: 6px 0 8px; }
.da-market-line { font-size: 13px; line-height: 1.65; color: rgba(255,255,255,.72); max-width: 56ch; }
.da-market-ask { flex: 1; min-width: 220px; height: 38px; font-size: 13.5px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.da-market-ask::placeholder { color: rgba(255,255,255,.45); }
.da-market-stats { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 14px 26px; flex: 0 0 auto; }
.da-market-stats > div { text-align: right; }
.da-market-stats b { display: block; font-size: 21px; font-weight: 900; line-height: 1.1; }
.da-market-stats span { font-size: 11px; font-weight: 800; color: rgba(255,255,255,.55); }
.da-market-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.da-market-chip-label { font-size: 11.5px; font-weight: 900; color: var(--ink-3); }
.da-market-chips button { padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; cursor: pointer; transition: all .12s; }
.da-market-chips button:hover { border-color: rgba(27,107,255,.45); }
.da-market-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 800; }
.da-market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 12px; }
.da-market-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.da-market-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(28,39,60,.12); border-color: rgba(27,107,255,.4); }
.da-market-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.da-market-kind { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800; color: var(--ink-3); }
.da-market-right { font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 999px; border: 1px solid; }
.da-market-card-title { font-size: 15.5px; font-weight: 900; color: var(--ink); line-height: 1.3; }
.da-market-card-asset { font-size: 11px; color: var(--ink-3); }
.da-market-card-summary { font-size: 12px; line-height: 1.55; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 37px; }
.da-market-card-price { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.da-market-card-price b { font-size: 19px; font-weight: 900; color: var(--ink); }
.da-market-card-price span { font-size: 11.5px; color: var(--ink-3); }
.da-market-bar { height: 4px; border-radius: 3px; background: #f0f0f3; overflow: hidden; }
.da-market-bar i { display: block; height: 100%; border-radius: 3px; }
.da-market-card-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

/* 1400px 以下提早摺疊為單欄:左欄被擠太窄正是「面板互相遮擋」的根源 */
@media (max-width: 1400px) { .da-grid { grid-template-columns: 1fr; } .da-copilot { position: static; max-height: none; } }
@media (max-width: 1180px) { .da-science-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } .da-science-actions { justify-content: flex-start; } .da-digital-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .da-digital-step, .da-digital-step:first-child, .da-digital-step:last-child { border: 1px solid var(--line-soft); border-radius: 12px; } .da-hosting-panel { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .da-table { overflow-x: auto; } .da-trow { min-width: 980px; } .da-science-head { flex-direction: column; } .da-science-split { grid-template-columns: 1fr; } .da-panel-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .da-panel-table { overflow-x: auto; } .da-panel-row { min-width: 560px; } .da-run-item { grid-template-columns: 60px 72px minmax(180px, 1fr) 160px; min-width: 520px; } .da-run-list { overflow-x: auto; } .da-scope-tabs { width: 100%; } .da-scope-tabs button { flex: 1 0 220px; } .da-digital-section-head { flex-direction: column; } .da-host-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .da-market-hero { padding: 20px; } .da-market-stats { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); } .da-market-stats > div { text-align: left; } }
@media (max-width: 680px) {
  .da-modal-mask { inset: 0; align-items: flex-start; padding: 12px; }
  .da-modal, .da-register-modal, .da-detail-modal { width: 100%; max-width: 100%; max-height: calc(100vh - 24px); }
  .da-watch-grid { grid-template-columns: 1fr; }
  .da-watch-quote strong { font-size: 21px; }
  .da-hero { align-items: flex-start; flex-direction: column; padding: 18px; }
  .da-hero-score { width: 100%; display: flex; justify-content: space-between; align-items: baseline; border-left: none; border-top: 1px solid var(--line-soft); padding: 12px 0 0; }
  .da-scope-tabs { display: flex; }
  .da-scope-tabs button { min-width: 190px; }
  .da-digital-flow { grid-template-columns: 1fr; }
  .da-host-form { grid-template-columns: 1fr; }
  .da-host-form textarea, .da-host-form input[placeholder*="URI"] { grid-column: auto; }
  .da-form-grid { grid-template-columns: 1fr; }
  .da-science-controls { grid-template-columns: 1fr; }
  .da-science-actions .btn { flex: 1 1 auto; }
  .da-panel-summary { grid-template-columns: 1fr; }
}
.alerts-metric {
  min-height: 112px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  animation: fadeUp .45s cubic-bezier(.2,.7,.3,1) both;
}
.alerts-metric-label {
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 800;
}
.alerts-metric-value {
  margin-top: 16px;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}
.alerts-status-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.alerts-status-tab {
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}
.alerts-status-tab.active { box-shadow: var(--sh-sm); }
.alerts-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(440px, 1fr) minmax(320px, 380px);
  gap: 18px;
  align-items: start;
  min-width: 0;
}
.alerts-panel,
.alerts-detail {
  padding: 18px;
  min-width: 0;
}
.alerts-panel {
  position: sticky;
  top: 0;
}
.alerts-search {
  height: 40px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.alerts-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}
.alerts-search button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-3);
}
.alerts-search button:hover { background: rgba(14,26,43,0.06); }
.alerts-filter-block {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.alerts-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.alerts-level-grid button,
.alerts-category-list button {
  min-width: 0;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.alerts-level-grid button.active,
.alerts-category-list button.active {
  color: var(--blue);
  border-color: rgba(27,107,255,.45);
  background: var(--blue-soft);
}
.alerts-category-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.alerts-category-list button span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerts-radar {
  margin: 18px auto 0;
  width: 210px;
  height: 210px;
}
.alerts-list { min-width: 0; }
.alerts-row {
  width: 100%;
  min-width: 0;
  padding: 15px 16px;
  border-left: 4px solid var(--blue);
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.alerts-row:hover,
.alerts-row.active {
  transform: translateY(-1px);
  box-shadow: var(--sh-lg);
}
.alerts-row.active { border-color: var(--blue); }
.alerts-row-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.alerts-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.alerts-row-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alerts-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}
.alerts-row-meta {
  font-size: 12px;
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerts-row-suggest {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.alerts-row-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.alerts-row-facts span {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.alerts-row-facts b {
  font-weight: 800;
  color: var(--ink-4);
}
.alerts-row-facts i {
  font-style: normal;
  font-family: var(--font-num);
  color: var(--ink-2);
  font-weight: 800;
}
.alerts-row-side {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.alerts-score {
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}
.alerts-detail {
  position: sticky;
  top: 0;
  padding: 0;
  overflow: hidden;
}
.alerts-detail-head {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.alerts-detail-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.alerts-detail-type {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 900;
}
.alerts-detail-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.alerts-detail-title {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 900;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.alerts-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.alerts-kpi {
  min-height: 70px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.alerts-kpi span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 800;
}
.alerts-kpi b {
  font-size: 13px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}
.alerts-suggestion {
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(27,107,255,0.08), rgba(7,182,162,0.08));
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.65;
  font-weight: 650;
}
.alerts-detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alerts-meta-list,
.alerts-evidence {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.alerts-meta-list div,
.alerts-evidence div {
  display: grid;
  grid-template-columns: minmax(82px, .45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 12.5px;
}
.alerts-meta-list span,
.alerts-evidence span {
  color: var(--ink-4);
  font-weight: 800;
}
.alerts-meta-list b,
.alerts-evidence b {
  min-width: 0;
  color: var(--ink-2);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.alerts-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

@media (max-width: 1280px) {
  .alerts-layout {
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  }
  .alerts-detail {
    grid-column: 1 / -1;
    position: static;
  }
}
@media (max-width: 980px) {
  .gis-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gis-main,
  .gis-detail-grid {
    grid-template-columns: 1fr;
  }
  .gis-map-shell {
    position: relative;
  }
  .gis-side {
    max-height: none;
  }
  .gis-filterline {
    grid-template-columns: 1fr 132px;
  }
  .alerts-hero {
    grid-template-columns: 1fr;
  }
  .alerts-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .alerts-layout {
    grid-template-columns: 1fr;
  }
  .alerts-panel {
    position: static;
  }
}
@media (max-width: 640px) {
  .gis-workbench {
    min-width: 760px;
  }
  .gis-map-top {
    align-items: flex-start;
  }
  .gis-segments,
  .gis-tool-row {
    flex-wrap: wrap;
  }
  .gis-kpi-line,
  .gis-form-grid,
  .gis-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gis-filterline {
    grid-template-columns: 1fr 1fr;
  }
  .alerts-workbench {
    min-width: 720px;
  }
  .alerts-summary-grid,
  .alerts-kpi-grid,
  .alerts-actions {
    grid-template-columns: 1fr;
  }
  .alerts-row {
    flex-direction: column;
  }
  .alerts-row-side {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
  .alerts-row-meta {
    white-space: normal;
  }
}

/* ============ 招採工作流 待辦頁 ============ */
.wf-page { display: flex; flex-direction: column; gap: 16px; }
.wf-topbar { display: flex; align-items: flex-start; justify-content: space-between; }
.wf-title { font-size: 22px; font-weight: 800; color: var(--ink); }
.wf-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.wf-err { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 13px; }
.wf-start { padding: 16px; }
.wf-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1.3fr); gap: 16px; align-items: start; }
.wf-list { display: flex; flex-direction: column; gap: 10px; }
.wf-sec { font-size: 13.5px; font-weight: 800; color: var(--ink); }
.wf-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 18px; text-align: center; color: var(--ink-3); }
.wf-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 15px; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 13px; background: var(--surface); cursor: pointer; box-shadow: var(--sh-sm); transition: box-shadow .15s, transform .15s; }
.wf-card:hover { box-shadow: var(--sh); transform: translateY(-1px); }
.wf-card.on { border-color: var(--blue); background: var(--blue-soft); }
.wf-card-main { flex: 1; min-width: 0; }
.wf-card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink); }
.wf-step { font-size: 10.5px; font-weight: 700; color: var(--blue-deep); background: var(--blue-soft); border-radius: 999px; padding: 1px 8px; }
.wf-card-sub { font-size: 12.5px; color: var(--ink-2); margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-card-meta { font-size: 11px; color: var(--ink-3); }
.wf-due { font-size: 11px; color: #B45309; background: var(--warn-soft); border-radius: 999px; padding: 2px 8px; flex: 0 0 auto; }
.wf-detail { padding: 18px; min-height: 220px; }
.wf-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.wf-hint { background: var(--blue-soft); border-radius: 10px; padding: 10px 13px; font-size: 12.5px; color: var(--ink); margin-bottom: 10px; }
.wf-kv { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.wf-ctx { font-size: 11.5px; color: var(--ink-3); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 8px 0; word-break: break-all; }
.wf-timeline { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.wf-tl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.wf-tl-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.wf-tl-act { font-weight: 700; color: var(--ink); }
.wf-tl-cmt { color: var(--ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-tl-time { margin-left: auto; color: var(--ink-4); flex: 0 0 auto; }
.wf-act { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
@media (max-width: 1024px) { .wf-grid { grid-template-columns: 1fr; } }

/* ============ 招採工作流 P3:标签 / 产物 / 流程图 ============ */
.wf-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.wf-tab { padding: 9px 16px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.wf-tab.on { color: var(--blue); border-bottom-color: var(--blue); }
.wf-arts { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.wf-art-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); padding: 3px 0; }
.wf-art-row.got { color: var(--ink); }
.wf-stage { margin-bottom: 14px; }
.wf-stage-title { font-size: 13px; font-weight: 800; color: var(--blue-deep); background: var(--blue-soft); border-radius: 8px; padding: 6px 11px; display: inline-block; margin-bottom: 8px; }
.wf-stage-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.wf-node { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s, background .15s; }
.wf-node:hover, .wf-node:focus-visible { border-color: rgba(27,107,255,.48); box-shadow: var(--sh-sm); transform: translateY(-1px); outline: none; }
.wf-node.has-task { border-color: rgba(245,158,11,.55); background: linear-gradient(180deg, #fff, #FFFBEB); }
.wf-node-step { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); color: var(--ink-3); display: grid; place-items: center; font-size: 12px; font-weight: 800; flex: 0 0 auto; }
.wf-node-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-node-tags { display: flex; gap: 4px; flex: 0 0 auto; align-items: center; }
.wf-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); }
.wf-tag-task { color: #B45309; border-color: rgba(245,158,11,.55); background: var(--warn-soft); }
.wf-tag-perm { color: #0F766E; border-color: rgba(20,184,166,.45); background: rgba(20,184,166,.09); max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-flow-workbench { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wf-topology-shell { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wf-topology-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px; border: 1px solid rgba(14,26,43,.08); border-radius: 14px; background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(247,250,252,.94)); }
.wf-topology-titleblock { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wf-topology-titleblock b { color: var(--ink); font-size: 18px; line-height: 1.25; font-weight: 900; overflow-wrap: anywhere; }
.wf-topology-titleblock small { color: var(--ink-3); font-size: 12px; line-height: 1.45; font-weight: 650; }
.wf-topology-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; }
.wf-topology-actions.compact { justify-content: flex-start; }
.wf-topo-search { height: 34px; min-width: 220px; max-width: 320px; display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-3); }
.wf-topo-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12.5px; }
.wf-topo-toggle { height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 750; white-space: nowrap; }
.wf-topo-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--blue); }
.wf-topology-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wf-topology-kpis > div { min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.wf-topology-kpis.compact > div { min-height: 50px; }
.wf-topology-kpis b { color: var(--ink); font-size: 22px; line-height: 1; font-weight: 900; }
.wf-topology-kpis span { color: var(--ink-4); font-size: 11px; font-weight: 800; }
.wf-topology-scroll { height: clamp(420px, 58vh, 660px); min-height: 420px; overflow: auto; border: 1px solid rgba(14,26,43,.08); border-radius: 14px; background: linear-gradient(90deg, rgba(14,26,43,.035) 1px, transparent 1px), linear-gradient(180deg, rgba(14,26,43,.035) 1px, transparent 1px), #fff; background-size: 28px 28px; }
.wf-topology-plane { position: relative; min-width: 100%; min-height: 100%; }
.wf-topology-svg { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.wf-topology-svg marker path { fill: #2563EB; }
.wf-topology-svg marker[id*="reject"] path { fill: #DC2626; }
.wf-topo-edge { fill: none; stroke: #2563EB; stroke-width: 2.1; opacity: .72; }
.wf-topo-edge.reject { stroke: #DC2626; stroke-width: 1.8; stroke-dasharray: 7 6; opacity: .58; }
.wf-topo-stage-band { position: absolute; top: 18px; height: 34px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(14,26,43,.08); border-radius: 10px; background: rgba(255,255,255,.92); box-shadow: 0 8px 22px rgba(14,26,43,.06); color: var(--ink-2); font-size: 12px; font-weight: 900; overflow: hidden; }
.wf-topo-stage-band span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 10px; }
.wf-topo-node { position: absolute; width: 214px; height: 94px; padding: 10px 11px; border: 1px solid var(--line); border-left: 4px solid #2563EB; border-radius: 12px; background: rgba(255,255,255,.98); box-shadow: 0 10px 24px rgba(14,26,43,.08); display: flex; flex-direction: column; gap: 7px; text-align: left; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s, opacity .15s, background .15s; }
.wf-topo-node:hover, .wf-topo-node:focus-visible { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(14,26,43,.12); border-color: rgba(37,99,235,.45); outline: none; }
.wf-topo-node.form { border-left-color: #0F766E; }
.wf-topo-node.external { border-left-color: #7C3AED; }
.wf-topo-node.auto { border-left-color: #64748B; }
.wf-topo-node.has-task { border-color: rgba(245,158,11,.62); background: linear-gradient(180deg, #fff, #FFFBEB); }
.wf-topo-node.no-perm { border-color: rgba(220,38,38,.52); background: linear-gradient(180deg, #fff, #FEF2F2); }
.wf-topo-node.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27,107,255,.13), 0 16px 32px rgba(14,26,43,.12); }
.wf-topo-node.dim { opacity: .28; }
.wf-topo-node-head { min-width: 0; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; align-items: center; }
.wf-topo-step { width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); color: var(--blue-deep); display: grid; place-items: center; font-size: 12px; font-weight: 900; }
.wf-topo-title { min-width: 0; color: var(--ink); font-size: 13px; line-height: 1.25; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-topo-meta { min-width: 0; color: var(--ink-3); font-size: 11.5px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-topo-tags { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.wf-config-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 390px); gap: 14px; align-items: start; }
.wf-config-graph, .wf-config-inspector { min-width: 0; border: 1px solid rgba(14,26,43,.08); border-radius: 14px; background: var(--surface); box-shadow: var(--sh-sm); }
.wf-config-graph { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.wf-config-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.wf-config-title { color: var(--ink); font-size: 17px; line-height: 1.25; font-weight: 900; overflow-wrap: anywhere; }
.wf-config-inspector { position: sticky; top: 82px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.wf-config-node-head { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.wf-config-node-head .wf-topo-step { width: 36px; height: 36px; }
.wf-config-node-head b { display: block; color: var(--ink); font-size: 15px; line-height: 1.3; font-weight: 900; overflow-wrap: anywhere; }
.wf-config-node-head span { display: block; color: var(--ink-4); font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-config-form { display: flex; flex-direction: column; gap: 10px; }
.wf-config-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 12px; font-weight: 800; }
.wf-config-form .input { width: 100%; min-width: 0; }
.wf-config-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wf-config-routes { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.wf-config-routes div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 12px; }
.wf-config-routes span { color: var(--ink-4); font-weight: 800; }
.wf-config-routes b { color: var(--ink); font-weight: 850; overflow-wrap: anywhere; }
.wf-config-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wf-config-actions .btn { width: 100%; padding: 0 10px; }
.wf-node-mask { justify-content: center; align-items: center; padding: 22px; }
.wf-node-modal { width: min(780px, calc(100vw - 44px)); max-height: min(820px, calc(100vh - 44px)); overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; border-radius: 14px; box-shadow: var(--sh-lg); }
.wf-node-modal-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.wf-node-modal-step { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-deep); font-size: 18px; font-weight: 900; }
.wf-node-modal-title { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wf-node-modal-title > div { font-size: 17px; line-height: 1.35; font-weight: 900; color: var(--ink); overflow-wrap: anywhere; }
.wf-flow-note { margin: 14px 18px 0; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 12.8px; line-height: 1.65; }
.wf-node-facts { margin: 14px 18px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wf-node-facts > div { min-height: 62px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 7px; justify-content: space-between; }
.wf-node-facts span { color: var(--ink-4); font-size: 11.5px; font-weight: 800; }
.wf-node-facts b { min-width: 0; color: var(--ink); font-size: 12.5px; line-height: 1.35; overflow-wrap: anywhere; }
.wf-node-facts b.ok { color: var(--ok); }
.wf-node-facts b.warn { color: #B45309; }
.wf-flow-section { margin: 14px 18px 0; display: flex; flex-direction: column; gap: 8px; }
.wf-flow-route { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.wf-flow-route span { color: var(--ink-4); font-weight: 800; }
.wf-flow-route b { color: var(--ink); font-weight: 850; overflow-wrap: anywhere; }
.wf-flow-artifacts { display: flex; flex-wrap: wrap; gap: 7px; }
.wf-flow-artifacts span { min-height: 28px; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(27,107,255,.24); background: var(--blue-soft); color: var(--blue-deep); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; }
.wf-flow-task-list { display: flex; flex-direction: column; gap: 7px; }
.wf-flow-task { width: 100%; min-height: 48px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; }
.wf-flow-task:hover { border-color: rgba(27,107,255,.45); background: var(--blue-soft); }
.wf-flow-task span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wf-flow-task b { color: var(--ink); font-size: 12.8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-flow-task small { color: var(--ink-4); font-size: 11px; }
.wf-node-modal-foot { margin-top: 14px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wf-node-modal-foot .btn { width: 100%; padding: 0 10px; }
@media (max-width: 820px) {
  .wf-node-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wf-node-modal-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wf-topology-head, .wf-config-head { flex-direction: column; align-items: stretch; }
  .wf-topology-actions { justify-content: flex-start; }
  .wf-topology-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wf-config-layout { grid-template-columns: 1fr; }
  .wf-config-inspector { position: static; }
}
@media (max-width: 560px) {
  .wf-node-mask { padding: 10px; }
  .wf-node-modal { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .wf-node-facts, .wf-node-modal-foot { grid-template-columns: 1fr; }
  .wf-node-tags { display: none; }
  .wf-flow-workbench { padding: 12px; border-radius: 12px; }
  .wf-topo-search { min-width: 0; width: 100%; max-width: none; }
  .wf-topology-actions .btn, .wf-topology-actions.compact .btn { flex: 1 1 auto; }
  .wf-topology-scroll { min-height: 380px; height: 58vh; }
  .wf-config-two, .wf-config-actions { grid-template-columns: 1fr; }
}

/* ============ Permission topology ============ */
.perm-topology {
  min-width: 0;
}
.perm-topology-head {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(14,26,43,.08);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(247,250,252,.9) 48%, rgba(241,248,246,.92)),
    radial-gradient(circle at 84% 0%, rgba(20,184,166,.13), transparent 34%);
  box-shadow: 0 18px 46px rgba(14,26,43,.08);
}
.perm-topology-title {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
}
.perm-topology-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, auto)) auto;
  gap: 10px;
  align-items: stretch;
}
.perm-topology-kpis > div {
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid rgba(14,26,43,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(14px) saturate(140%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.perm-topology-kpis b {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
}
.perm-topology-kpis span {
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 800;
}
.perm-topology-canvas {
  height: 446px;
  min-height: 360px;
  border: 1px solid rgba(14,26,43,.08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 46px rgba(14,26,43,.08);
  overflow: auto hidden;
}
.perm-topology-canvas canvas {
  display: block;
  min-width: 760px;
  height: 100%;
}
.perm-topology-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(300px, 1.16fr);
  gap: 14px;
  align-items: stretch;
}
.perm-topology-panel {
  min-width: 0;
  min-height: 206px;
  padding: 16px;
  border: 1px solid rgba(14,26,43,.08);
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 14px 34px rgba(14,26,43,.07);
  backdrop-filter: blur(18px) saturate(140%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.perm-topology-panel .input {
  width: 100%;
  min-width: 0;
}
.perm-topology-panel .row {
  min-width: 0;
}
.perm-topology-list {
  max-height: 332px;
  overflow: auto;
}
.perm-delegation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.perm-delegation-row:first-child {
  border-top: 0;
}
.perm-delegation-row b,
.perm-delegation-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.perm-delegation-row b {
  color: var(--ink);
  font-size: 12.5px;
}
.perm-delegation-row span {
  font-size: 11.5px;
}

@media (max-width: 1100px) {
  .perm-topology-head {
    align-items: stretch;
    flex-direction: column;
  }
  .perm-topology-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .perm-topology-workbench {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .perm-topology-title {
    font-size: 24px;
  }
  .perm-topology-head,
  .perm-topology-panel {
    border-radius: 14px;
  }
  .perm-topology-canvas {
    height: 380px;
    border-radius: 14px;
  }
  .perm-topology-workbench {
    min-width: 720px;
  }
}

/* ============================================================
   SHIELD security command center
   ============================================================ */
.shield-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.shield-hero {
  position: relative;
  overflow: hidden;
  min-height: 156px;
  padding: 24px;
  border: 1px solid rgba(8, 22, 20, .16);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(3, 10, 9, .98), rgba(18, 19, 13, .97) 48%, rgba(4, 22, 21, .98)),
    repeating-linear-gradient(90deg, rgba(132, 255, 231, .07) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 42px);
  color: #F5FFFB;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  box-shadow: 0 22px 54px rgba(5, 18, 18, .16);
}
.shield-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(132, 255, 231, .08), transparent);
  transform: translateX(-80%);
  animation: shield-scan 7s linear infinite;
}
@keyframes shield-scan {
  to { transform: translateX(80%); }
}
@media (prefers-reduced-motion: reduce) {
  .shield-hero::after {
    animation: none;
    opacity: .18;
  }
}
.shield-hero-main,
.shield-hero-actions {
  position: relative;
  z-index: 1;
}
.shield-hero-main {
  min-width: 0;
  max-width: 780px;
}
.shield-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #80FFF0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}
.shield-title-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.shield-title-row h1 {
  margin: 0;
  color: #FFFFFF;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 950;
}
.shield-hero p {
  max-width: 720px;
  margin: 12px 0 0;
  color: rgba(229, 255, 249, .72);
  font-size: 13.5px;
  line-height: 1.7;
}
.shield-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.shield-refresh {
  min-width: 104px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}
.shield-refresh span,
.shield-refresh b {
  display: block;
}
.shield-refresh span {
  color: rgba(229, 255, 249, .54);
  font-size: 10.5px;
  font-weight: 900;
}
.shield-refresh b {
  margin-top: 3px;
  color: #FFFFFF;
  font-size: 13px;
}
.shield-error {
  min-height: 42px;
  padding: 12px 14px;
  border: 1px solid rgba(239, 68, 68, .28);
  border-radius: 12px;
  background: rgba(254, 242, 242, .92);
  color: #DC2626;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 850;
}
.shield-signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.shield-signal {
  min-width: 0;
  min-height: 132px;
  padding: 16px;
  border: 1px solid rgba(14, 26, 43, .08);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 34px rgba(14, 26, 43, .06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.shield-signal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 900;
}
.shield-signal-head span {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(14, 26, 43, .05);
}
.shield-signal strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.shield-signal small {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 720;
  overflow-wrap: anywhere;
}
.shield-signal-green { border-color: rgba(16, 185, 129, .20); }
.shield-signal-green .shield-signal-head span { color: #059669; background: rgba(16, 185, 129, .10); }
.shield-signal-yellow { border-color: rgba(245, 158, 11, .24); }
.shield-signal-yellow .shield-signal-head span { color: #B45309; background: rgba(245, 158, 11, .12); }
.shield-signal-red { border-color: rgba(239, 68, 68, .22); }
.shield-signal-red .shield-signal-head span { color: #DC2626; background: rgba(239, 68, 68, .10); }
.shield-signal-blue { border-color: rgba(37, 99, 235, .18); }
.shield-signal-blue .shield-signal-head span { color: #2563EB; background: rgba(37, 99, 235, .10); }
.shield-core-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(330px, 380px);
  gap: 16px;
  align-items: stretch;
}
.shield-topology-deck {
  position: relative;
  min-width: 0;
  min-height: 660px;
  padding: 14px;
  border: 1px solid rgba(13, 148, 136, .18);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(2, 6, 6, .98), rgba(5, 17, 16, .98)),
    repeating-linear-gradient(90deg, rgba(132, 255, 231, .06) 0 1px, transparent 1px 96px);
  box-shadow: 0 22px 54px rgba(8, 22, 20, .16);
  overflow: hidden;
}
.shield-topology-head,
.shield-topology-strip {
  position: relative;
  z-index: 2;
}
.shield-topology-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 12px;
}
.shield-topology-head div:first-child {
  min-width: 0;
}
.shield-topology-head span {
  display: block;
  color: rgba(128, 255, 240, .72);
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .08em;
}
.shield-topology-head b {
  display: block;
  margin-top: 5px;
  color: #FFFFFF;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.shield-score-ring {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(128, 255, 240, .35);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .04);
}
.shield-score-ring strong,
.shield-score-ring span {
  grid-area: 1 / 1;
  display: block;
}
.shield-score-ring strong {
  margin-top: -8px;
  color: currentColor;
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
}
.shield-score-ring span {
  margin-top: 24px;
  color: rgba(229, 255, 249, .54);
  font-size: 9px;
  font-weight: 900;
}
.shield-topology-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 4px 0;
}
.shield-topology-strip span {
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid rgba(132, 255, 231, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: rgba(229, 255, 249, .76);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 850;
}
.shield-intel-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shield-intel-card,
.shield-panel {
  min-width: 0;
  border: 1px solid rgba(14, 26, 43, .08);
  border-radius: 16px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 14px 34px rgba(14, 26, 43, .06);
}
.shield-intel-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shield-intel-primary {
  min-height: 234px;
  color: #F8FFFD;
  border-color: rgba(132, 255, 231, .18);
  background:
    linear-gradient(145deg, rgba(6, 14, 13, .98), rgba(22, 25, 16, .98)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .04) 0 1px, transparent 1px 38px);
}
.shield-panel-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.shield-panel-title > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.shield-panel-title > div span {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #0D9488;
  background: rgba(20, 184, 166, .10);
  flex: 0 0 auto;
}
.shield-panel-title b {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-intel-primary .shield-panel-title b {
  color: #FFFFFF;
}
.shield-chip,
.shield-count {
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(14, 26, 43, .06);
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 900;
  white-space: nowrap;
}
.shield-intel-primary .shield-chip {
  color: #80FFF0;
  border: 1px solid rgba(128, 255, 240, .22);
  background: rgba(128, 255, 240, .08);
}
.shield-chip-hot {
  color: #B45309;
  background: rgba(245, 158, 11, .12);
}
.shield-intel-big {
  color: #FFFFFF;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.shield-intel-card p,
.shield-risk-card p,
.shield-stream-item p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.shield-intel-primary p {
  color: rgba(229, 255, 249, .72);
}
.shield-repair-state {
  min-height: 54px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(20, 184, 166, .08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.shield-repair-state strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.shield-repair-state span {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 800;
}
.shield-defense-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.shield-defense-grid span {
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.shield-defense-grid b {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
}
.shield-defense-grid small {
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 16px;
  align-items: stretch;
}
.shield-workbench-bottom {
  grid-template-columns: minmax(340px, .9fr) minmax(0, 1.1fr);
}
.shield-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.shield-incident-list,
.shield-risk-list,
.shield-stream {
  min-width: 0;
  max-height: 370px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.shield-incident-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}
.shield-incident-card,
.shield-risk-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.shield-incident-top,
.shield-risk-top {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.shield-incident-top b,
.shield-risk-top b {
  min-width: 0;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.25;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-incident-title {
  min-height: 38px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 720;
  overflow-wrap: anywhere;
}
.shield-incident-meta,
.shield-risk-meta {
  margin-top: 8px;
  color: var(--ink-4);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 780;
}
.shield-incident-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.shield-incident-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-stream-item {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
}
.shield-stream-item::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 25px;
  bottom: -12px;
  width: 1px;
  background: rgba(20, 184, 166, .18);
}
.shield-stream-item:last-child::before {
  display: none;
}
.shield-stream-dot {
  width: 13px;
  height: 13px;
  margin-top: 4px;
  border: 2px solid rgba(20, 184, 166, .34);
  border-radius: 50%;
  background: #FFFFFF;
}
.shield-stream-repair_execute .shield-stream-dot,
.shield-stream-repair_resolved .shield-stream-dot {
  border-color: rgba(16, 185, 129, .64);
  background: rgba(16, 185, 129, .18);
}
.shield-stream-diagnose .shield-stream-dot {
  border-color: rgba(37, 99, 235, .58);
  background: rgba(37, 99, 235, .14);
}
.shield-stream-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.shield-stream-meta b {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-stream-meta span {
  flex: 0 0 auto;
  color: var(--ink-4);
  font-size: 10.5px;
  font-weight: 850;
}
.shield-risk-card p {
  margin-top: 8px;
  color: var(--ink-2);
}
.shield-guardian-panel {
  min-height: 300px;
}
.shield-guardian-console {
  flex: 1;
  min-height: 232px;
  max-height: 360px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(20, 184, 166, .16);
  border-radius: 12px;
  background: #050A09;
  color: rgba(217, 255, 246, .78);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}
/* SHIELD 超級終端 */
.shield-terminal-panel {
  min-height: 360px;
  border-color: rgba(20, 184, 166, .18);
  /* 終端是深色控制台:給面板深色底,否則白色標題「SHIELD AI 終端」會白底白字看不見 */
  background:
    linear-gradient(135deg, rgba(3, 8, 8, .98), rgba(14, 15, 10, .98) 52%, rgba(4, 20, 18, .98));
}
.shield-term-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
.shield-term-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.shield-term-keycheck {
  padding: 3px 9px;
  border: 1px solid rgba(128, 255, 236, .24);
  border-radius: 999px;
  background: rgba(128, 255, 236, .08);
  color: #9FE;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}
.shield-term-keycheck:hover { background: rgba(128, 255, 236, .16); }
.shield-term-autotoggle {
  padding: 3px 10px;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 999px;
  background: rgba(148, 163, 184, .12);
  color: rgba(229, 255, 249, .6);
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
}
.shield-term-autotoggle.on {
  border-color: rgba(52, 211, 153, .45);
  background: rgba(16, 185, 129, .16);
  color: #6EE7B7;
}
.shield-term-diagnose {
  padding: 3px 10px;
  border: 1px solid rgba(132, 87, 231, .4);
  border-radius: 999px;
  background: rgba(132, 87, 231, .18);
  color: #DDD6FE;
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
}
.shield-term-diagnose:hover:not(:disabled) { background: rgba(132, 87, 231, .28); }
.shield-term-diagnose:disabled { opacity: .5; cursor: not-allowed; }
/* 🎖 開戰役:終端頭部主行動按鈕(將軍金色),比診斷更顯眼 */
.shield-term-campaign {
  padding: 3px 11px;
  border: 1px solid rgba(245, 200, 92, .55);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 200, 92, .26), rgba(217, 160, 56, .2));
  color: #FCE7B6;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .3px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(245, 200, 92, .12), 0 2px 10px rgba(217, 160, 56, .18);
}
.shield-term-campaign:hover:not(:disabled) { background: linear-gradient(135deg, rgba(245, 200, 92, .38), rgba(217, 160, 56, .3)); }
.shield-term-campaign:disabled { opacity: .5; cursor: not-allowed; }
/* 總凍結 kill-switch:平時低調灰,凍結時醒目紅 */
.shield-term-freeze {
  padding: 3px 10px;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 999px;
  background: rgba(148, 163, 184, .1);
  color: rgba(229, 255, 249, .55);
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
}
.shield-term-freeze:hover { background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .4); color: #FCA5A5; }
.shield-term-freeze.on {
  border-color: rgba(239, 68, 68, .6);
  background: rgba(239, 68, 68, .22);
  color: #FECACA;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, .18);
}
.shield-term-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, .3);
  background: rgba(16, 185, 129, .12);
  color: #6EE7B7;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .06em;
}
.shield-term-live > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 10px #34D399;
}
.shield-term-live.is-busy {
  border-color: rgba(132, 87, 231, .4);
  background: rgba(132, 87, 231, .16);
  color: #C4B5FD;
}
.shield-term-live.is-busy > span {
  background: #A78BFA;
  box-shadow: 0 0 10px #A78BFA;
  animation: shieldTermPulse 1s infinite;
}
@keyframes shieldTermPulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.shield-term-escalation {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid rgba(245, 158, 11, .32);
  border-radius: 10px;
  background: rgba(245, 158, 11, .1);
}
.shield-term-esc-tag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  color: #FBBF24;
}
.shield-term-esc-text {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: rgba(255, 237, 213, .9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-term-escalation button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 11px;
  border: 1px solid rgba(132, 87, 231, .4);
  border-radius: 8px;
  background: rgba(132, 87, 231, .18);
  color: #DDD6FE;
  font-size: 11.5px;
  font-weight: 900;
  cursor: pointer;
}
.shield-term-escalation button:hover:not(:disabled) { background: rgba(132, 87, 231, .28); }
.shield-term-escalation button:disabled { opacity: .5; cursor: not-allowed; }
.shield-term-autostrip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 86px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid rgba(128, 255, 236, .12);
  border-radius: 10px;
  background: rgba(0, 0, 0, .2);
}
.shield-term-auto {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 11px;
  line-height: 1.4;
}
.shield-term-auto b {
  flex: 0 0 auto;
  min-width: 52px;
  font-weight: 900;
  font-size: 10px;
}
.shield-term-auto span {
  min-width: 0;
  color: rgba(229, 255, 249, .62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shield-term-auto-ok b { color: #34D399; }
.shield-term-auto-warn b { color: #FBBF24; }
.shield-term-auto-err b { color: #F87171; }
.shield-term-auto-ai b { color: #C4B5FD; }
.shield-term-auto-muted b { color: rgba(148, 163, 184, .8); }
.shield-term-scroll {
  flex: 1;
  min-height: 226px;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(20, 184, 166, .16);
  border-radius: 12px;
  background: #050A09;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
}
.shield-term-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 2px 0;
  word-break: break-word;
}
.shield-term-glyph,
.shield-term-prompt {
  flex: 0 0 auto;
}
.shield-term-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.shield-term-sys .shield-term-text { color: rgba(148, 163, 184, .82); }
.shield-term-user .shield-term-prompt { color: #7DD3FC; font-weight: 900; }
.shield-term-user .shield-term-text { color: #BAE6FD; font-weight: 800; }
.shield-term-cmd .shield-term-text { color: #FBBF24; }
.shield-term-result .shield-term-text { color: #86EFAC; }
.shield-term-error .shield-term-text { color: #F87171; }
.shield-term-final .shield-term-glyph { color: #80FFF0; }
.shield-term-final .shield-term-text { color: #D9FFF6; }
.shield-term-typing .shield-term-text { color: #C4B5FD; }
.shield-term-selfcheck { opacity: .92; }
.shield-term-selfcheck .shield-term-text { color: rgba(148, 163, 184, .85); font-size: 11.5px; }
.shield-term-tone-ok .shield-term-text { color: #6EE7B7; }
.shield-term-tone-warn .shield-term-text { color: #FBBF24; }
.shield-term-tone-err .shield-term-text { color: #F87171; font-weight: 800; }
.shield-term-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(128, 255, 236, .18);
  border-radius: 10px;
  background: rgba(0, 0, 0, .26);
}
.shield-term-input > span {
  color: #80FFF0;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.shield-term-input input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #E5FFF9;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.shield-term-input input::placeholder { color: rgba(148, 163, 184, .6); }
.shield-term-input button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid rgba(128, 255, 236, .26);
  border-radius: 8px;
  background: rgba(128, 255, 236, .12);
  color: #CFFFF4;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.shield-term-input button:hover:not(:disabled) { background: rgba(128, 255, 236, .2); }
.shield-term-input button:disabled { opacity: .45; cursor: not-allowed; }
.shield-empty {
  min-height: 84px;
  padding: 18px;
  border: 1px dashed rgba(14, 26, 43, .14);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12.5px;
  font-weight: 760;
}
@media (max-width: 1220px) {
  .shield-core-grid,
  .shield-workbench,
  .shield-workbench-bottom {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .shield-hero {
    flex-direction: column;
    border-radius: 16px;
  }
  .shield-hero-actions {
    width: 100%;
    justify-content: space-between;
  }
  .shield-signal-grid,
  .shield-intel-stack,
  .shield-incident-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shield-topology-deck {
    min-height: 560px;
  }
  .shield-topology-deck canvas {
    height: 460px !important;
  }
}
@media (max-width: 620px) {
  .shield-page {
    gap: 14px;
  }
  .shield-hero,
  .shield-topology-deck,
  .shield-panel,
  .shield-intel-card,
  .shield-signal {
    border-radius: 14px;
  }
  .shield-hero {
    padding: 18px;
  }
  .shield-title-row h1 {
    font-size: 25px;
  }
  .shield-signal-grid,
  .shield-intel-stack,
  .shield-incident-list {
    grid-template-columns: 1fr;
  }
  .shield-signal {
    min-height: 112px;
  }
  .shield-topology-deck {
    min-height: 500px;
    padding: 12px;
  }
  .shield-topology-deck canvas {
    height: 390px !important;
  }
  .shield-defense-grid {
    grid-template-columns: 1fr;
  }
  .shield-hero-actions,
  .shield-topology-head,
  .shield-stream-meta,
  .shield-incident-meta {
    align-items: stretch;
    flex-direction: column;
  }
}

/* SHIELD v2: tighter command surface */
.shield-page-v2 {
  gap: 16px;
}
.shield-command-surface {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(20, 184, 166, .16);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(3, 8, 8, .98), rgba(14, 15, 10, .98) 52%, rgba(4, 20, 18, .98)),
    repeating-linear-gradient(90deg, rgba(128, 255, 236, .045) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .026) 0 1px, transparent 1px 44px);
  box-shadow: 0 22px 58px rgba(6, 18, 18, .18);
}
.shield-command-surface::before {
  content: "";
  position: absolute;
  inset: 58px 16px 16px;
  pointer-events: none;
  border: 1px solid rgba(128, 255, 236, .075);
  border-radius: 10px;
}
.shield-command-head {
  position: relative;
  z-index: 2;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px 14px;
}
.shield-brandblock,
.shield-command-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.shield-brandblock > span {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(128, 255, 236, .24);
  border-radius: 10px;
  color: #80FFF0;
  background: rgba(128, 255, 236, .07);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.shield-brandblock b,
.shield-brandblock small {
  display: block;
}
.shield-brandblock b {
  color: #FFFFFF;
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: .04em;
}
.shield-brandblock small {
  margin-top: 4px;
  color: rgba(229, 255, 249, .60);
  font-size: 12px;
  font-weight: 850;
}
.shield-command-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.shield-command-actions .btn {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .12);
  color: #F8FFFD;
}
.shield-command-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 170px minmax(420px, 1fr) 340px;
  gap: 12px;
  align-items: stretch;
}
.shield-rail {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.shield-rail-cell {
  min-width: 0;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 10px;
  background: rgba(255, 255, 255, .055);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.shield-rail-cell span,
.shield-rail-cell small {
  display: block;
  color: rgba(229, 255, 249, .55);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.shield-rail-cell b {
  color: #FFFFFF;
  font-size: 29px;
  line-height: 1;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.shield-rail-green { border-color: rgba(16, 185, 129, .24); }
.shield-rail-green b { color: #34D399; }
.shield-rail-yellow { border-color: rgba(245, 158, 11, .25); }
.shield-rail-yellow b { color: #FBBF24; }
.shield-rail-red { border-color: rgba(239, 68, 68, .25); }
.shield-rail-red b { color: #F87171; }
.shield-rail-blue { border-color: rgba(59, 130, 246, .22); }
.shield-rail-blue b { color: #93C5FD; }
.shield-topology-stage {
  position: relative;
  min-width: 0;
  min-height: 690px;
  border: 1px solid rgba(128, 255, 236, .13);
  border-radius: 12px;
  background: rgba(1, 4, 4, .58);
  overflow: hidden;
}
.shield-stage-head {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.shield-stage-head > div:first-child {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 10px;
  background: rgba(0, 0, 0, .24);
  backdrop-filter: blur(10px);
}
.shield-stage-head span {
  display: block;
  color: rgba(128, 255, 240, .70);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
}
.shield-stage-head b {
  display: block;
  margin-top: 5px;
  color: #FFFFFF;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 950;
}
.shield-page-v2 .shield-score-ring {
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px);
}
.shield-stage-strip {
  position: absolute;
  z-index: 3;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}
.shield-stage-strip span {
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid rgba(132, 255, 231, .16);
  border-radius: 999px;
  background: rgba(0, 0, 0, .24);
  color: rgba(229, 255, 249, .78);
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 850;
}
.shield-intel-compact {
  gap: 8px;
}
.shield-page-v2 .shield-intel-card {
  border-color: rgba(255, 255, 255, .10);
  border-radius: 10px;
  background: rgba(255, 255, 255, .065);
  box-shadow: none;
  backdrop-filter: blur(14px);
}
.shield-page-v2 .shield-intel-primary {
  min-height: 214px;
  background:
    linear-gradient(150deg, rgba(9, 23, 21, .78), rgba(18, 17, 11, .76)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 34px);
}
.shield-page-v2 .shield-panel-title b,
.shield-page-v2 .shield-repair-state strong,
.shield-page-v2 .shield-defense-grid b {
  color: #FFFFFF;
}
.shield-page-v2 .shield-intel-card p,
.shield-page-v2 .shield-repair-state span {
  color: rgba(229, 255, 249, .66);
}
.shield-page-v2 .shield-panel-title > div span {
  color: #80FFF0;
  background: rgba(128, 255, 236, .08);
}
.shield-page-v2 .shield-repair-state,
.shield-page-v2 .shield-defense-grid span {
  border-color: rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .18);
}
.shield-page-v2 .shield-defense-grid small {
  color: rgba(229, 255, 249, .50);
}
.shield-engine-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 9px 11px;
  border: 1px solid rgba(128, 255, 236, .12);
  border-radius: 9px;
  background: rgba(0, 0, 0, .2);
}
.shield-engine-line span {
  color: rgba(229, 255, 249, .5);
  font-size: 10.5px;
  font-weight: 850;
  align-self: center;
}
.shield-engine-line b {
  min-width: 0;
  color: #E5FFF9;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  overflow-wrap: anywhere;
}
.shield-intel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.shield-diag-fresh {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(132, 87, 231, .26);
  border-radius: 9px;
  background: rgba(132, 87, 231, .1);
  color: #E5DEFF;
  font-size: 12.3px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.shield-diag-fresh b { color: #C4B5FD; }
.shield-diag-fresh small {
  display: block;
  margin-top: 5px;
  color: rgba(196, 181, 253, .8);
  font-size: 11px;
  font-weight: 800;
}
.shield-diag-err {
  border-color: rgba(239, 68, 68, .3);
  background: rgba(239, 68, 68, .1);
  color: #FCA5A5;
}
.shield-diag-now {
  border-color: rgba(132, 87, 231, .42) !important;
  background: rgba(132, 87, 231, .2) !important;
  color: #DDD6FE !important;
}
.shield-diag-now:hover:not(:disabled) { background: rgba(132, 87, 231, .3) !important; }
.shield-engine-revalidate {
  align-self: flex-start;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid rgba(128, 255, 236, .22);
  border-radius: 8px;
  background: rgba(128, 255, 236, .1);
  color: #CFFFF4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 900;
  cursor: pointer;
}
.shield-engine-revalidate:hover:not(:disabled) {
  background: rgba(128, 255, 236, .16);
}
.shield-engine-revalidate:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.shield-node-inspector {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(128, 255, 236, .14);
  border-radius: 10px;
  background:
    linear-gradient(150deg, rgba(7, 16, 15, .82), rgba(12, 16, 13, .76)),
    repeating-linear-gradient(90deg, rgba(128, 255, 236, .035) 0 1px, transparent 1px 46px);
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.shield-node-summary {
  margin: 0;
  color: rgba(229, 255, 249, .72);
  font-size: 12.3px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.shield-node-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.shield-node-facts span {
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  background: rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.shield-node-facts b {
  color: #FFFFFF;
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
}
.shield-node-facts small {
  color: rgba(229, 255, 249, .48);
  font-size: 10px;
  font-weight: 900;
}
.shield-node-counters,
.shield-node-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.shield-node-counters span {
  max-width: 100%;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(128, 255, 236, .08);
  color: rgba(229, 255, 249, .74);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 820;
}
.shield-node-counters b {
  color: #80FFF0;
  font-weight: 950;
}
.shield-node-actions button {
  min-height: 29px;
  padding: 6px 9px;
  border: 1px solid rgba(128, 255, 236, .18);
  border-radius: 8px;
  background: rgba(128, 255, 236, .08);
  color: #E5FFF9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 850;
}
.shield-node-actions button:hover {
  background: rgba(128, 255, 236, .13);
}
.shield-node-related {
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.shield-node-related > b {
  display: block;
  margin-bottom: 6px;
  color: rgba(229, 255, 249, .84);
  font-size: 11.5px;
  line-height: 1.3;
  font-weight: 950;
}
.shield-node-related p {
  margin: 0 0 5px;
  color: rgba(229, 255, 249, .58);
  font-size: 11.4px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.shield-console-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
}
@media (max-width: 1280px) {
  .shield-command-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .shield-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}
@media (max-width: 980px) {
  .shield-command-grid,
  .shield-console-grid {
    grid-template-columns: 1fr;
  }
  .shield-intel-compact {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .shield-topology-stage {
    min-height: 590px;
  }
  .shield-topology-stage canvas {
    height: 590px !important;
  }
}
@media (max-width: 720px) {
  .shield-command-surface {
    padding: 12px;
  }
  .shield-command-head,
  .shield-command-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .shield-command-actions {
    width: 100%;
  }
  .shield-rail,
  .shield-intel-compact {
    grid-template-columns: 1fr;
  }
  .shield-topology-stage {
    min-height: 500px;
  }
  .shield-topology-stage canvas {
    height: 500px !important;
  }
  .shield-stage-head {
    position: relative;
    inset: auto;
    padding: 10px;
  }
  .shield-stage-strip {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 0 10px 10px;
  }
}

/* ============================================================
   SHIELD v3:雙核版面(健康狀態條 + 拓撲|終端雙核 + 標籤頁)
   ============================================================ */
.shield-page-v3 { gap: 14px; }

.shield-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border: 1px solid rgba(20, 184, 166, .16);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(3, 8, 8, .98), rgba(14, 15, 10, .98) 52%, rgba(4, 20, 18, .98)),
    repeating-linear-gradient(90deg, rgba(128, 255, 236, .04) 0 1px, transparent 1px 88px);
  box-shadow: 0 16px 44px rgba(6, 18, 18, .16);
}
.shield-sb-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.shield-sb-brand > span {
  width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center;
  border: 1px solid rgba(128, 255, 236, .24); border-radius: 10px;
  color: #80FFF0; background: rgba(128, 255, 236, .07);
}
.shield-sb-brand b { display: block; color: #fff; font-size: 17px; font-weight: 950; letter-spacing: .04em; line-height: 1; }
.shield-sb-brand small { display: block; margin-top: 3px; color: rgba(229, 255, 249, .6); font-size: 11px; font-weight: 800; }
.shield-sb-metrics {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px;
}
.shield-sb-cell {
  min-width: 0; padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .1); border-radius: 9px;
  background: rgba(255, 255, 255, .05);
}
.shield-sb-cell span { display: block; color: rgba(229, 255, 249, .55); font-size: 10.5px; font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shield-sb-cell b { display: block; color: #fff; font-size: 19px; font-weight: 950; line-height: 1.15; overflow-wrap: anywhere; }
.shield-sb-cell small { display: block; color: rgba(229, 255, 249, .5); font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shield-sb-green b { color: #34D399; }
.shield-sb-yellow b { color: #FBBF24; }
.shield-sb-red b { color: #F87171; }
.shield-sb-blue b { color: #93C5FD; }
.shield-sb-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.shield-statusbar .shield-refresh { color: rgba(229, 255, 249, .6); font-size: 11px; }
.shield-statusbar .shield-refresh b { color: #E5FFF9; }
.shield-statusbar .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .12); color: #F8FFFD; }

.shield-dualcore {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}
/* 定高(非 min-height),否則終端內容增長會把整頁越拉越長 */
.shield-dualcore > .shield-topology-stage,
.shield-dualcore .shield-terminal-panel { height: 560px; min-height: 0; }
/* 終端滾動區:flex 填滿 + min-height:0 → 內容超出時內部滾動,而非撐高面板 */
.shield-dualcore .shield-terminal-panel .shield-term-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.shield-tabsec {
  /* 次要面板區用淺色:事件流/治理/事件列表都是深字淺底卡片,放深色裏會看不見 */
  border: 1px solid rgba(14, 26, 43, .08);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(14, 26, 43, .06);
}
.shield-tabs {
  display: flex; gap: 2px; flex-wrap: wrap;
  padding: 7px 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.shield-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--ink-3);
  font-size: 13px; font-weight: 850; cursor: pointer;
}
.shield-tab:hover { color: var(--ink-2); }
.shield-tab em {
  font-style: normal; font-size: 11px; font-weight: 900;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(14, 26, 43, .07); color: var(--ink-2);
}
.shield-tab.is-active { color: var(--ink); border-bottom-color: #14B8A6; }
.shield-tab.is-active em { background: rgba(20, 184, 166, .16); color: #0D9488; }
.shield-tab-body { padding: 14px; }
.shield-intel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
  align-items: start;
}
/* 這幾張卡的原設計是「半透明白疊在深色父層上才顯深」,放到淺色標籤頁就變白、淺字看不見。
   在標籤頁裏強制給它們實心深色底,淺色文字才看得清(它們的內文本就是為深色設計的)。 */
.shield-tabsec .shield-intel-card {
  background: linear-gradient(150deg, rgba(7, 18, 16, .97), rgba(16, 16, 11, .97));
  border-color: rgba(20, 184, 166, .18);
  backdrop-filter: none;
}
.shield-tabsec .shield-intel-primary {
  background:
    linear-gradient(150deg, rgba(9, 23, 21, .98), rgba(18, 17, 11, .97)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 34px);
}
.shield-tabsec .shield-node-inspector {
  background:
    linear-gradient(150deg, rgba(7, 16, 15, .97), rgba(12, 16, 13, .96)),
    repeating-linear-gradient(90deg, rgba(128, 255, 236, .035) 0 1px, transparent 1px 46px);
}
/* 平臺統計 tab(淺色,配合淺色標籤頁) */
.shield-stats { display: flex; flex-direction: column; gap: 14px; }
.shield-stats-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shield-stats-head > span { font-size: 12px; font-weight: 800; color: var(--ink-3); margin-right: 4px; }
.shield-stats-win {
  padding: 4px 11px; border: 1px solid var(--line-soft); border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 800; cursor: pointer;
}
.shield-stats-win.on { background: rgba(20, 184, 166, .14); border-color: rgba(20, 184, 166, .3); color: #0D9488; }
.shield-stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.shield-stat-card {
  padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2);
}
.shield-stat-card > span { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 800; }
.shield-stat-card b { display: block; margin-top: 4px; color: var(--ink); font-size: 24px; font-weight: 900; line-height: 1.05; overflow-wrap: anywhere; }
.shield-stat-card small { display: block; margin-top: 5px; color: var(--ink-3); font-size: 11px; }
.shield-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.shield-stat-chart { padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); }
.shield-stat-chart h4 { margin: 0 0 8px; font-size: 12.5px; font-weight: 850; color: var(--ink-2); }
.shield-spark { width: 100%; height: 48px; display: block; }
.shield-spark-empty, .shield-bars-empty { color: var(--ink-3); font-size: 12px; padding: 14px 0; text-align: center; }
.shield-bars { display: flex; flex-direction: column; gap: 6px; }
.shield-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; align-items: center; gap: 8px; }
.shield-bar-label { color: var(--ink-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shield-bar-track { height: 7px; border-radius: 999px; background: rgba(14, 26, 43, .07); overflow: hidden; }
.shield-bar-fill { display: block; height: 100%; border-radius: 999px; }
.shield-bar-row b { color: var(--ink); font-weight: 900; font-size: 11.5px; }
.shield-stream-tall { max-height: 460px; }
.shield-risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  max-height: 460px;
}

@media (max-width: 1100px) {
  .shield-dualcore { grid-template-columns: 1fr; }
  .shield-dualcore > .shield-topology-stage,
  .shield-dualcore .shield-terminal-panel { height: 500px; }
}
@media (max-width: 820px) {
  .shield-sb-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shield-statusbar { gap: 10px; }
}
@media (max-width: 560px) {
  .shield-sb-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
