Files
yolo/frontend/styles.css
Kunpeng 25fa0c5825 feat: SQLite persistence, non-blocking inference, modular frontend
Backend:
- Persist alert events and robot delivery counters in SQLite (data/app.db,
  YOLO_DB_PATH override); EventStore keeps its interface, DeliveryStatsStore
  uses read/write-through UPSERT; in-memory fallback remains for standalone
  AlertManager use
- Serve /api/detect from a sync endpoint and serialize YOLO inference with a
  lock, so concurrent requests no longer block the event loop
- Unify single-image and session detection: requests without session_id
  share the fixed single-image session and run full frame confirmation
- Store UTC Z-suffixed timestamps for sortable string comparison; close
  executor and database on shutdown via FastAPI lifespan

Frontend:
- Split app.js into ES modules (main.js + modules/{dom,api,ui,charts,store}
  + views/{dashboard,inspection,events,robots,robotCards}), no build step
- Escape all server data interpolated into innerHTML; guard missing
  event.classes; replace lazy element ID list with memoized qs()
- Remove hardcoded fake stats (trend badge, device donut segment)

Docs:
- Rewrite README: accurate weight policy (only trained best.pt committed,
  no Git LFS), SQLite persistence, single-worker note, data asset inventory
- Align models/pretrained/README.md with actual files; add YOLO_DB_PATH to
  .env.example; add persistence unit tests; ruff clean
2026-08-13 16:50:23 +08:00

250 lines
32 KiB
CSS

:root {
color-scheme: dark;
--bg: #071017;
--sidebar: #0a141c;
--surface: #0e1a23;
--surface-2: #13232e;
--surface-3: #192d39;
--line: #203540;
--line-soft: #182b35;
--text: #edf4f5;
--muted: #8498a1;
--cyan: #41d6c3;
--cyan-soft: #153a39;
--red: #ff665e;
--red-soft: #402321;
--orange: #ffad4d;
--orange-soft: #40301e;
--green: #5fd28a;
--green-soft: #173828;
--blue: #5da8ff;
--blue-soft: #18334d;
font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { font-weight: 700; }
code, pre { font-family: "Cascadia Code", Consolas, monospace; }
.platform-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 20; display: flex; height: 100vh; flex-direction: column; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; min-height: 82px; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 0 22px; }
.brand-mark { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid #2d7069; background: var(--cyan-soft); color: var(--cyan); font-size: 20px; font-weight: 800; }
.brand div:last-child { display: grid; gap: 3px; }
.brand strong { font-size: 19px; letter-spacing: .12em; }
.brand span { color: var(--muted); font-size: 11px; }
.main-nav { display: grid; gap: 4px; padding: 22px 14px; }
.nav-item { position: relative; display: grid; min-height: 46px; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; border: 0; border-left: 2px solid transparent; padding: 0 13px; background: transparent; color: var(--muted); text-align: left; }
.nav-item:hover { background: #10202a; color: var(--text); }
.nav-item.is-active { border-left-color: var(--cyan); background: linear-gradient(90deg, #163632, #10212a 74%); color: var(--cyan); }
.nav-icon { display: grid; width: 22px; height: 22px; place-items: center; font-size: 15px; }
.nav-count { display: grid; min-width: 22px; height: 20px; place-items: center; padding: 0 6px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 11px; }
.sidebar-footer { display: grid; gap: 16px; margin-top: auto; border-top: 1px solid var(--line); padding: 20px; }
.system-indicator { display: flex; align-items: flex-start; gap: 10px; }
.system-indicator div { display: grid; gap: 4px; }
.system-indicator strong { font-size: 12px; }
.system-indicator span:not(.status-dot) { color: var(--muted); font-size: 10px; }
.status-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px #ffad4d18; }
.status-dot.is-online { background: var(--green); box-shadow: 0 0 0 4px #5fd28a18; }
.status-dot.is-offline { background: var(--red); box-shadow: 0 0 0 4px #ff665e18; }
.version { color: #5b7079; font-size: 10px; letter-spacing: .08em; }
.main-area { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 0 30px; background: #071017e8; backdrop-filter: blur(14px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 18px; }
.breadcrumb { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.topbar h1 { margin-bottom: 0; font-size: 20px; }
.clock-block { display: grid; justify-items: end; gap: 3px; padding-right: 18px; border-right: 1px solid var(--line); }
.clock-block span { color: var(--muted); font-size: 10px; }
.clock-block strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.icon-button { position: relative; display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.icon-button:hover { border-color: #3d655f; color: var(--cyan); }
.menu-button { display: none; }
.notification-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 1px solid var(--bg); border-radius: 50%; background: var(--red); }
.status-chip { display: inline-flex; min-height: 28px; align-items: center; border: 1px solid var(--line); padding: 0 10px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-online { border-color: #29664b; background: var(--green-soft); color: var(--green); }
.status-offline { border-color: #7b3632; background: var(--red-soft); color: var(--red); }
.status-checking { border-color: #69532c; background: var(--orange-soft); color: var(--orange); }
.status-idle { background: var(--surface); }
.content-area { padding: 28px 30px 50px; }
.view { display: none; }
.view.is-active { display: block; animation: view-enter .18s ease-out; }
@keyframes view-enter { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.section-kicker { margin-bottom: 7px; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.hero-strip, .page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.hero-strip h2, .page-intro h2 { margin-bottom: 8px; font-size: clamp(23px, 3vw, 32px); }
.hero-strip p:last-child, .page-intro p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.primary-button, .secondary-button, .text-button, .file-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid transparent; padding: 0 16px; font-weight: 700; text-decoration: none; }
.primary-button { background: var(--cyan); color: #071715; }
.primary-button:hover { background: #66e4d4; }
.primary-button:disabled { cursor: not-allowed; opacity: .4; }
.secondary-button, .file-button { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.secondary-button:hover, .file-button:hover { border-color: var(--cyan); color: var(--cyan); }
.text-button { min-height: 30px; border: 0; padding: 0; background: transparent; color: var(--cyan); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel { border: 1px solid var(--line); background: var(--surface); }
.stat-card { display: grid; min-height: 145px; align-content: space-between; gap: 9px; padding: 18px; }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-symbol { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid currentColor; font-size: 12px; }
.stat-symbol.warning { color: var(--orange); }.stat-symbol.danger { color: var(--red); }.stat-symbol.success { color: var(--green); }.stat-symbol.info { color: var(--blue); }
.stat-card > strong { font-size: 32px; font-variant-numeric: tabular-nums; }
.stat-card > strong.text-value { font-size: 22px; }
.stat-card small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); gap: 14px; margin-top: 14px; }
.panel { padding: 20px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-header h3 { margin-bottom: 0; font-size: 16px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 2px; }.legend-fire { background: var(--red); }.legend-smoke { background: var(--cyan); }
.trend-chart { min-height: 225px; }
.trend-chart svg { display: block; width: 100%; height: 225px; overflow: visible; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }.chart-axis-label { fill: var(--muted); font-size: 9px; }.chart-fire { fill: none; stroke: var(--red); stroke-width: 2; }.chart-smoke { fill: none; stroke: var(--cyan); stroke-width: 2; }.chart-point-fire { fill: var(--red); }.chart-point-smoke { fill: var(--cyan); }
.readiness-list { display: grid; }
.readiness-item { display: flex; min-height: 47px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line-soft); }
.readiness-item:last-child { border-bottom: 0; }
.readiness-item span { color: var(--muted); font-size: 12px; }
.readiness-item strong { font-size: 11px; }
.ready { color: var(--green); }.not-ready { color: var(--red); }.optional { color: var(--orange); }
.recent-panel { margin-top: 14px; }
.event-list { display: grid; }
.event-list > p { margin: 0; padding: 28px 0; color: var(--muted); text-align: center; font-size: 12px; }
.event-list-item { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; border-top: 1px solid var(--line-soft); padding: 13px 0; }
.event-list-item:first-child { border-top: 0; }
.event-type-icon { display: grid; width: 33px; height: 33px; place-items: center; border: 1px solid currentColor; }.event-type-icon.fire { color: var(--red); background: var(--red-soft); }.event-type-icon.smoke { color: var(--cyan); background: var(--cyan-soft); }
.event-description { display: grid; gap: 4px; }.event-description strong { font-size: 12px; }.event-description span { color: var(--muted); font-size: 10px; }
.event-confidence { color: var(--orange); font-size: 12px; }
.inspection-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr); gap: 16px; }
.video-panel { min-width: 0; }
.video-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.video-toolbar > div { display: grid; gap: 4px; min-width: 0; }.video-toolbar strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }.video-toolbar span { color: var(--muted); font-size: 10px; }
.media-stage { position: relative; display: grid; min-height: min(58vh, 600px); place-items: center; overflow: hidden; border: 1px solid var(--line); background: #03080c; }
.media-stage video { display: block; width: 100%; max-height: min(58vh, 600px); object-fit: contain; }
.media-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.empty-state { display: grid; justify-items: center; gap: 9px; padding: 30px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); font-size: 14px; }.empty-state span { max-width: 420px; font-size: 11px; line-height: 1.6; }
.upload-emblem { display: grid; width: 52px; height: 52px; place-items: center; border: 1px dashed #3f635f; color: var(--cyan); font-size: 26px; }
.loading-state { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 8px; border: 1px solid #2d7069; padding: 8px 10px; background: #0d1b1ee8; color: var(--cyan); font-size: 10px; }.loading-state[hidden] { display: none; }
.spinner { width: 12px; height: 12px; border: 2px solid #28625d; border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }@keyframes spin { to { transform: rotate(360deg); } }
.video-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.inspection-side { display: grid; align-content: start; gap: 16px; }
.micro-copy { color: var(--muted); font-size: 9px; }
.detection-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detection-metrics > div { display: grid; min-height: 78px; align-content: space-between; gap: 7px; border: 1px solid var(--line-soft); padding: 12px; background: var(--surface-2); }
.detection-metrics span { color: var(--muted); font-size: 10px; }.detection-metrics strong { font-size: 20px; }
.alert-status { margin-top: 12px; border-left: 2px solid var(--cyan); padding: 10px 11px; background: #10242b; color: var(--muted); font-size: 10px; line-height: 1.6; }
.alert-status.alert-triggered { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.detection-list { display: grid; margin-top: 10px; }.detection-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); padding: 9px 0; font-size: 11px; }.detection-row strong { color: var(--orange); }
.empty-copy { margin: 0; padding: 12px 0; color: var(--muted); font-size: 11px; text-align: center; }
.field-row, .strategy-row { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }.field-row select { min-height: 32px; border: 1px solid var(--line); padding: 0 9px; background: var(--surface-2); color: var(--text); }.strategy-row strong { color: var(--text); }.strategy-note { margin-top: 13px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.event-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--line); }.event-stat-row > div { display: grid; gap: 7px; padding: 15px 18px; background: var(--surface); }.event-stat-row span { color: var(--muted); font-size: 10px; }.event-stat-row strong { font-size: 22px; }
.event-table-panel { padding-bottom: 8px; }.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }.filter-button { min-height: 30px; border: 1px solid var(--line); padding: 0 11px; background: transparent; color: var(--muted); font-size: 10px; }.filter-button.is-active { border-color: #2f7069; background: var(--cyan-soft); color: var(--cyan); }.table-toolbar > span { color: var(--muted); font-size: 10px; }
.table-wrap { overflow-x: auto; }.event-table { width: 100%; border-collapse: collapse; font-size: 11px; }.event-table th { border-bottom: 1px solid var(--line); padding: 11px 10px; color: var(--muted); font-size: 9px; text-align: left; white-space: nowrap; }.event-table td { border-bottom: 1px solid var(--line-soft); padding: 12px 10px; vertical-align: middle; }.event-table tbody tr:hover { background: #11232c; }.empty-cell { height: 140px; color: var(--muted); text-align: center; }
.type-tag, .event-status { display: inline-flex; min-height: 24px; align-items: center; border: 1px solid currentColor; padding: 0 8px; font-size: 9px; }.type-fire { color: var(--red); background: var(--red-soft); }.type-smoke { color: var(--cyan); background: var(--cyan-soft); }.status-pending { color: var(--red); background: var(--red-soft); }.status-acknowledged { color: var(--orange); background: var(--orange-soft); }.status-resolved { color: var(--green); background: var(--green-soft); }
.table-actions { display: flex; gap: 6px; }.table-action { min-height: 28px; border: 1px solid var(--line); padding: 0 8px; background: var(--surface-2); color: var(--muted); font-size: 9px; }.table-action:hover { border-color: var(--cyan); color: var(--cyan); }
.risk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }.risk-card { display: grid; align-content: start; gap: 10px; }.risk-card h3 { margin: 0; font-size: 14px; }.risk-card > strong { font-size: 30px; }.risk-card p { min-height: 42px; margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }.risk-level { width: fit-content; border-left: 2px solid currentColor; padding: 4px 8px; font-size: 9px; }.risk-level.high { background: var(--red-soft); color: var(--red); }.risk-level.medium { background: var(--orange-soft); color: var(--orange); }.risk-level.low { background: var(--blue-soft); color: var(--blue); }
.checklist-panel { margin-top: 14px; }.checklist { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line-soft); background: var(--line-soft); }.checklist label { display: flex; min-height: 50px; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface-2); color: var(--muted); font-size: 11px; }.checklist input { accent-color: var(--cyan); }
.channel-grid, .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.channel-card { display: flex; gap: 16px; }.channel-logo { display: grid; flex: 0 0 50px; height: 50px; place-items: center; font-size: 18px; font-weight: 800; }.wechat-logo { background: var(--green-soft); color: var(--green); }.feishu-logo { background: var(--blue-soft); color: var(--blue); }.channel-content { display: grid; min-width: 0; gap: 10px; }.channel-content > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.channel-content h3 { margin: 0; font-size: 14px; }.channel-content p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }.channel-content code { overflow-wrap: anywhere; color: var(--cyan); font-size: 9px; }.channel-badge { border: 1px solid var(--line); padding: 4px 7px; color: var(--muted); font-size: 9px; white-space: nowrap; }.channel-badge.enabled { border-color: #29664b; background: var(--green-soft); color: var(--green); }
.config-guide { margin-top: 14px; }.config-guide ol { margin: 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 2; }.config-guide code { color: var(--cyan); }
.settings-card dl { margin: 0; }.settings-card dl div { display: grid; grid-template-columns: 130px 1fr; gap: 16px; border-top: 1px solid var(--line-soft); padding: 12px 0; }.settings-card dl div:first-child { border-top: 0; }.settings-card dt { color: var(--muted); font-size: 10px; }.settings-card dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; text-align: right; }.env-panel { margin-top: 14px; }.env-panel pre { margin: 0; overflow-x: auto; border-left: 2px solid var(--cyan); padding: 14px; background: #071016; color: #a9c2c6; font-size: 11px; line-height: 1.7; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }.toast { min-width: 260px; max-width: 380px; border: 1px solid var(--line); border-left: 3px solid var(--cyan); padding: 12px 14px; background: var(--surface-2); box-shadow: 0 10px 30px #0008; font-size: 11px; line-height: 1.5; }.toast.error { border-left-color: var(--red); }.toast.success { border-left-color: var(--green); }
@media (max-width: 1120px) {
.stat-grid { grid-template-columns: 1fr 1fr; }
.inspection-grid { grid-template-columns: 1fr; }
.inspection-side { grid-template-columns: 1fr 1fr; }
.risk-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
.platform-shell { grid-template-columns: 1fr; }
.sidebar { position: fixed; left: 0; transform: translateX(-101%); width: 248px; transition: transform .2s ease; box-shadow: 18px 0 40px #0008; }
.sidebar.is-open { transform: translateX(0); }
.menu-button { display: grid; }
.topbar { padding: 0 18px; }
.content-area { padding: 22px 18px 40px; }
.clock-block { display: none; }
.overview-grid, .channel-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
.topbar-actions .status-chip { display: none; }
.hero-strip, .page-intro { align-items: flex-start; flex-direction: column; }
.hero-strip .primary-button, .page-intro .secondary-button { width: 100%; }
.stat-grid, .event-stat-row, .inspection-side, .detection-metrics, .checklist { grid-template-columns: 1fr; }
.event-stat-row { gap: 1px; }
.panel, .stat-card { padding: 15px; }
.media-stage { min-height: 330px; }
.video-actions > * { flex: 1; }
.event-list-item { grid-template-columns: auto 1fr; }.event-confidence, .event-list-item .event-status { grid-column: 2; }
.settings-card dl div { grid-template-columns: 1fr; gap: 6px; }.settings-card dd { text-align: left; }
.channel-card { flex-direction: column; }
.toast-region { right: 12px; bottom: 12px; left: 12px; }.toast { min-width: 0; max-width: none; }
}
/* Command center dashboard */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(circle at 72% 6%, #123b3d55, transparent 30%), radial-gradient(circle at 18% 86%, #102b3f44, transparent 27%); }
.nav-count-cyan { background: var(--cyan-soft); color: var(--cyan); }
.command-hero { position: relative; overflow: hidden; border: 1px solid #244a4b; background: linear-gradient(110deg, #10262c 0%, #0c1c25 56%, #102c31 100%); }
.command-hero::after { content: ""; position: absolute; right: -90px; bottom: -160px; width: 390px; height: 390px; border: 1px solid #41d6c326; border-radius: 50%; box-shadow: 0 0 0 48px #41d6c30b, 0 0 0 96px #41d6c308; }
.command-hero > * { position: relative; z-index: 1; }
.hero-actions { display: flex; align-items: center; gap: 12px; }
.live-pill { display: inline-flex; min-height: 34px; align-items: center; gap: 8px; border: 1px solid #29664b; padding: 0 12px; background: #173828aa; color: var(--green); font-size: 10px; letter-spacing: .05em; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 #5fd28a66; animation: livePulse 2s infinite; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 8px #5fd28a00; } 100% { box-shadow: 0 0 0 0 #5fd28a00; } }
.stat-card { position: relative; overflow: hidden; transition: transform .2s ease, border-color .2s ease; }
.stat-card::after { content: ""; position: absolute; right: -36px; bottom: -50px; width: 110px; height: 110px; border-radius: 50%; background: #41d6c308; }
.stat-card:hover { transform: translateY(-2px); border-color: #31545d; }
.dashboard-command-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(390px, 1.35fr) minmax(260px, .78fr); gap: 14px; margin-top: 14px; }
.dashboard-command-grid .panel { min-height: 290px; }
.safety-score-body { display: grid; height: calc(100% - 48px); grid-template-columns: 150px 1fr; align-items: center; gap: 20px; }
.safety-gauge { --score: 86; position: relative; display: grid; width: 144px; height: 144px; place-items: center; border-radius: 50%; background: conic-gradient(var(--cyan) calc(var(--score) * 1%), #1a3039 0); box-shadow: 0 0 36px #41d6c316; }
.safety-gauge::before { content: ""; position: absolute; inset: 12px; border: 1px solid #2c444d; border-radius: 50%; background: var(--surface); }
.safety-gauge > div { position: relative; display: grid; justify-items: center; gap: 2px; }
.safety-gauge strong { color: var(--text); font-size: 36px; font-variant-numeric: tabular-nums; }
.safety-gauge span { color: var(--cyan); font-size: 11px; letter-spacing: .18em; }
.score-breakdown { display: grid; gap: 9px; }
.score-breakdown div { display: grid; grid-template-columns: 1fr auto; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.score-breakdown span { color: var(--muted); font-size: 10px; }
.score-breakdown strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.message-flow-panel { min-width: 0; }
.message-flow { display: grid; min-height: 190px; grid-template-columns: minmax(95px, 1fr) 36px minmax(95px, 1fr) 36px minmax(120px, 1.2fr); align-items: center; gap: 8px; border: 1px solid var(--line); padding: 18px; background: linear-gradient(145deg, #0b1820, #0e222b); }
.flow-node { display: grid; min-height: 100px; align-content: center; justify-items: center; gap: 7px; border: 1px solid #2a4650; padding: 12px; background: #102630c7; text-align: center; }.flow-node > span { color: var(--cyan); font-size: 9px; letter-spacing: .12em; }.flow-node strong { font-size: 11px; }.flow-node small { color: var(--muted); font-size: 8px; line-height: 1.5; }.flow-node.policy { border-color: #37645e; background: #13302f; }.flow-node.channel { min-height: 76px; grid-template-columns: 28px 1fr; justify-items: start; gap: 2px 9px; text-align: left; }.flow-node.channel > span { grid-row: 1 / 3; display: grid; width: 28px; height: 28px; place-items: center; color: white; font-weight: 800; }.flow-node.channel small { grid-column: 2; }.wechat-dot { background: #20b969; }.feishu-dot { background: #3370ff; }.flow-destinations { display: grid; gap: 9px; }.flow-connector { position: relative; height: 1px; background: #31515b; }.flow-connector::after { content: ""; position: absolute; top: -3px; right: -1px; border-width: 4px 0 4px 6px; border-style: solid; border-color: transparent transparent transparent var(--cyan); }.flow-foot { display: flex; justify-content: space-between; gap: 15px; padding-top: 12px; color: var(--muted); font-size: 9px; }.flow-foot strong { color: var(--cyan); font-size: 9px; }
.donut-layout { display: grid; height: calc(100% - 45px); align-items: center; justify-items: center; gap: 20px; }
.risk-donut { position: relative; display: grid; width: 142px; height: 142px; place-items: center; border-radius: 50%; background: conic-gradient(var(--line) 0 100%); }
.risk-donut::before { content: ""; position: absolute; inset: 18px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }.risk-donut > div { position: relative; display: grid; justify-items: center; }.risk-donut strong { font-size: 30px; }.risk-donut span { color: var(--muted); font-size: 9px; }
.donut-legend { display: grid; width: 100%; gap: 8px; }.donut-legend div { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); padding: 7px 0; font-size: 10px; }.donut-legend span { display: flex; align-items: center; gap: 7px; color: var(--muted); }.donut-legend i { width: 8px; height: 8px; }
.overview-grid-lower { margin-top: 14px; }
/* Messaging robots */
.fleet-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fleet-stat { position: relative; display: grid; min-height: 118px; align-content: center; gap: 7px; overflow: hidden; border: 1px solid var(--line); padding: 18px 20px; background: linear-gradient(135deg, var(--surface), #10232d); }
.fleet-stat::after { content: ""; position: absolute; right: -34px; bottom: -48px; width: 108px; height: 108px; border: 1px solid #41d6c316; border-radius: 50%; box-shadow: 0 0 0 18px #41d6c308; }.fleet-stat span, .fleet-stat small { color: var(--muted); font-size: 10px; }.fleet-stat strong { font-size: 27px; font-variant-numeric: tabular-nums; }
.message-robot-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 14px; margin-top: 16px; }.message-robot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }.message-robot-card { display: grid; gap: 15px; transition: transform .2s ease, border-color .2s ease; }.message-robot-card:hover { transform: translateY(-2px); border-color: #31545d; }.message-robot-card.is-configured { border-top-color: #2f7568; }
.message-robot-head { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 12px; }.message-robot-head h3 { margin: 2px 0 4px; font-size: 15px; }.message-robot-head p { margin: 0; color: var(--muted); font-size: 9px; }.platform-logo { display: grid; width: 48px; height: 48px; place-items: center; color: white; font-size: 17px; font-weight: 800; }.platform-logo.wechat { background: #20b969; }.platform-logo.feishu { background: #3370ff; }.robot-id { color: var(--cyan); font-size: 8px; letter-spacing: .12em; }.robot-status { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 5px 8px; color: var(--muted); font-size: 9px; }.robot-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }.robot-status.active { border-color: #29664b; background: var(--green-soft); color: var(--green); }.robot-status.offline { background: #222d32; color: #7a8a91; }
.capability-list { display: flex; flex-wrap: wrap; gap: 7px; }.capability-list span { border: 1px solid #24424b; padding: 5px 8px; background: #10232b; color: #8eabb2; font-size: 8px; }.delivery-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-soft); background: var(--line-soft); gap: 1px; }.delivery-metrics div { display: grid; justify-items: center; gap: 6px; padding: 13px 5px; background: #0d1b23; }.delivery-metrics span { color: var(--muted); font-size: 8px; }.delivery-metrics strong { font-size: 16px; }.delivery-metrics .danger { color: var(--red); }.robot-activity, .credential-key { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-soft); padding-top: 11px; }.robot-activity span, .credential-key span { color: var(--muted); font-size: 9px; }.robot-activity strong { font-size: 9px; }.credential-key code { color: var(--cyan); font-size: 8px; text-align: right; overflow-wrap: anywhere; }.delivery-error { margin: 0; border-left: 2px solid var(--red); padding: 8px 10px; background: var(--red-soft); color: #ffaaa5; font-size: 9px; line-height: 1.5; }.test-robot-button { width: 100%; min-height: 36px; }.test-robot-button:disabled { cursor: not-allowed; opacity: .5; }
.robot-policy-panel { position: sticky; top: 98px; }.policy-chain { display: grid; }.policy-chain > div { display: grid; grid-template-columns: 28px 1fr; gap: 10px; border-top: 1px solid var(--line-soft); padding: 13px 0; }.policy-chain > div > span { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid #316059; color: var(--cyan); font-size: 8px; }.policy-chain p { display: grid; gap: 4px; margin: 0; }.policy-chain strong { font-size: 10px; }.policy-chain small { color: var(--muted); font-size: 9px; line-height: 1.5; }.credential-note { margin-top: 8px; border: 1px solid #2a4650; padding: 13px; background: #0b171e; }.credential-note strong { font-size: 10px; }.credential-note p { margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }.credential-note code { color: var(--cyan); }.robot-empty { grid-column: 1 / -1; padding: 60px 20px; color: var(--muted); text-align: center; }.robot-config-panel { margin-top: 14px; }.config-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line-soft); background: var(--line-soft); }.config-steps > div { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 16px; background: var(--surface-2); }.config-steps > div > span { color: var(--cyan); font-size: 10px; }.config-steps p { display: grid; gap: 6px; margin: 0; }.config-steps strong { font-size: 10px; }.config-steps small { color: var(--muted); font-size: 9px; line-height: 1.5; }.config-steps code { color: var(--cyan); overflow-wrap: anywhere; }
@media (max-width: 1280px) {
.dashboard-command-grid { grid-template-columns: 1fr 1.25fr; }
.risk-donut-panel { grid-column: 1 / -1; min-height: auto !important; }
.donut-layout { grid-template-columns: 160px 1fr; }
.message-robot-layout { grid-template-columns: 1fr; }.robot-policy-panel { position: static; }
}
@media (max-width: 900px) {
.dashboard-command-grid, .fleet-stat-grid { grid-template-columns: 1fr 1fr; }
.message-flow-panel { grid-column: 1 / -1; }
.message-robot-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
.hero-actions { width: 100%; align-items: stretch; flex-direction: column; }.live-pill { justify-content: center; }.dashboard-command-grid, .fleet-stat-grid, .config-steps { grid-template-columns: 1fr; }.message-flow-panel, .risk-donut-panel { grid-column: auto; }.safety-score-body { grid-template-columns: 1fr; justify-items: center; }.score-breakdown { width: 100%; }.donut-layout { grid-template-columns: 1fr; }.message-flow { grid-template-columns: 1fr; }.flow-connector { width: 1px; height: 20px; justify-self: center; }.flow-connector::after { top: auto; right: -3px; bottom: -1px; border-width: 6px 4px 0; border-color: var(--cyan) transparent transparent; }.message-robot-head { grid-template-columns: 44px 1fr; }.robot-status { grid-column: 2; width: fit-content; }.robot-activity, .credential-key { align-items: flex-start; flex-direction: column; }.credential-key code { text-align: left; }
}