/* ==========================================================================
   PFC Navigator · 番茄加工线数字孪生
   Visual language: light glassy dashboard, blue accent, soft elevation
   ========================================================================== */

:root {
  --bg: #eef1f6;
  --bg-2: #e7ecf4;
  --card: #ffffff;
  --line: #eef1f6;
  --line-2: #e6eaf1;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #667085;
  --ink-4: #98a2b3;
  --blue: #2f5cff;
  --blue-dark: #1f47e0;
  --blue-soft: #eef3ff;
  --blue-soft-2: #dbe6ff;
  --green: #12b76a;
  --green-soft: #e9f9f0;
  --amber: #f79009;
  --amber-soft: #fff6e8;
  --red: #f04438;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-2: 0 12px 32px -12px rgba(16, 24, 40, .18), 0 2px 8px rgba(16, 24, 40, .05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button, input { font-family: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
svg { display: block; }

/* ---------------------------------------------------------------- shell -- */
.app {
  position: relative;
  height: 100vh;
  min-height: 680px;
  display: grid;
  grid-template-rows: 64px auto minmax(0, 1fr) 232px;
  gap: 14px;
  padding: 14px 16px 16px;
}

/* --------------------------------------------------------------- header -- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 0 12px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  border: 1px solid #fff;
  z-index: 30;
  min-width: 0;
}

.brand { display: flex; align-items: center; gap: 10px; padding-right: 4px; flex: none; }
.brand-mark {
  position: relative;
  width: 40px; height: 40px;
  border: 0; padding: 0;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #4a72ff 0%, #2f5cff 55%, #1e46e2 100%);
  box-shadow: 0 6px 14px -6px rgba(47, 92, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #fff;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s;
}
.brand-mark:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -8px rgba(47, 92, 255, .85), 0 0 0 3px rgba(47, 92, 255, .14), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-mark:active { transform: none; }
.brand-edit-dot {
  position: absolute; right: -4px; bottom: -4px;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  color: var(--blue);
  border: 1px solid #e6ecf7;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .12);
  opacity: 0;
  transform: scale(.7);
  transition: opacity .16s, transform .16s;
}
.brand-mark:hover .brand-edit-dot { opacity: 1; transform: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: .01em; font-weight: 700; }
.brand-text span { font-size: 11px; color: var(--ink-3); font-weight: 500; white-space: nowrap; }

.search {
  flex: 1 1 300px;
  min-width: 0;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fbfcfe;
  color: var(--ink-4);
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.search:focus-within {
  border-color: #c3d3ff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 92, 255, .08);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 13.5px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-4); }
.search kbd {
  flex: none;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center;
  font: 600 11px/1 var(--font);
  color: var(--ink-4);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: #fff;
}
.search-action {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--ink-4);
  transition: background .16s, color .16s;
}
.search-action:hover { background: #eef2f8; color: var(--ink-2); }
.search-action.on { color: var(--blue); background: rgba(47, 92, 255, .09); }
.search-action.on:hover { background: rgba(47, 92, 255, .15); }

/* hiding the KPI band collapses its grid row */
.app.is-kpis-hidden .kpis { display: none; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }

.site-select { position: relative; }
.site-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  z-index: 60;
  width: 258px;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #fff;
  box-shadow: var(--shadow-2);
  animation: menuIn .16s cubic-bezier(.2, .7, .3, 1);
}
.site-menu[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.site-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  text-align: left;
  transition: background .14s;
}
.site-item:hover { background: #f6f8fc; }
.site-item.is-active { background: var(--blue-soft); }
.site-item .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.site-item .si-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.site-item b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.site-item small { font-size: 10.5px; color: var(--ink-4); }
.site-item .si-check { color: var(--blue); opacity: 0; flex: none; }
.site-item.is-active .si-check { opacity: 1; }
.tag-empty {
  flex: none;
  font-size: 9.5px; font-weight: 600;
  color: var(--ink-4);
  background: #f2f4f7;
  padding: 2px 6px;
  border-radius: 5px;
}

/* ---------------------------------------------------------- settings ----- */
.settings {
  position: fixed; inset: 0;
  z-index: 120;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, .34);
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
.settings[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.settings-card {
  display: flex; flex-direction: column;
  width: min(940px, 95vw);
  height: min(700px, 88vh);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px -30px rgba(16, 24, 40, .45);
  overflow: hidden;
  animation: settingsIn .22s cubic-bezier(.2, .7, .3, 1);
}
@keyframes settingsIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.settings-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--line);
}
.settings-title { flex: 1; min-width: 0; }
.settings-title h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.settings-title p { margin: 3px 0 0; font-size: 11px; color: var(--ink-4); }

.settings-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 178px 1fr; }
.settings-nav {
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 3px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}
.settings-nav button {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--ink-2);
  transition: background .14s, color .14s;
  white-space: nowrap;
}
.settings-nav button:hover { background: #f0f4fa; }
.settings-nav button.is-active { background: var(--blue-soft); color: var(--blue); }

.settings-form { overflow: auto; padding: 16px 20px 22px; }
.settings-form::-webkit-scrollbar { width: 6px; }
.settings-form::-webkit-scrollbar-thumb { background: #e2e8f2; border-radius: 6px; }

.sf-section { margin-bottom: 18px; }
.sf-section:last-child { margin-bottom: 0; }
.sf-section > h4 {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 650;
  letter-spacing: .03em;
  color: var(--ink-4);
  text-transform: uppercase;
}
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.sf-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sf-field.wide { grid-column: 1 / -1; }
.sf-field > span { font-size: 10.5px; color: var(--ink-4); }
.sf-field input,
.sf-field textarea {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fbfcfe;
  font-size: 12px;
  font-family: var(--font);
  color: var(--ink);
  outline: 0;
  min-width: 0;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.sf-field textarea { height: 56px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.sf-field input:focus,
.sf-field textarea:focus {
  border-color: #c3d3ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 92, 255, .08);
}
.sf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.sf-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-2);
  transition: all .14s;
  white-space: nowrap;
}
.sf-chip:hover { border-color: #c3d3ff; color: var(--blue); }
.sf-chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

.settings-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.settings-note { flex: 1; font-size: 10.5px; color: var(--ink-4); }
.settings-foot .ae-btn { flex: none; min-width: 84px; padding: 0 12px; height: 32px; }

.site-chip {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 11px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  transition: border-color .18s, box-shadow .18s;
  white-space: nowrap;
}
.site-chip:hover { border-color: #cfd8e6; box-shadow: var(--shadow-1); }
.site-chip .icon-tile { width: 30px; height: 30px; border-radius: 9px; }
.site-chip .site-name { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; min-width: 0; }
.site-chip b { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.site-chip small { font-size: 10.5px; color: var(--ink-4); max-width: 128px; overflow: hidden; text-overflow: ellipsis; }
.site-chip .chev { color: var(--ink-4); flex: none; }

.live {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #0b8f54;
  font-size: 12px; font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}
.live .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .16);
  animation: livePulse 2.4s ease-in-out infinite;
}
.live-time { font-variant-numeric: tabular-nums; color: #0b8f54; font-weight: 600; }
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(18, 183, 106, .16); }
  50% { box-shadow: 0 0 0 6px rgba(18, 183, 106, .04); }
}

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--ink-2);
  transition: background .16s, color .16s;
  flex: none;
}
.icon-btn:hover { background: #f3f6fb; color: var(--ink); }
.icon-btn .badge {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

.user {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 2px 3px 3px;
  border-radius: 12px;
  transition: background .16s;
  flex: none;
}
.user:hover { background: #f7f9fc; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #7c8cf8, #5b6ee8);
  color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.user-meta b { font-size: 12.5px; font-weight: 600; }
.user-meta small { font-size: 10.5px; color: var(--ink-4); }
.user .chev { color: var(--ink-4); flex: none; }

/* ----------------------------------------------------------------- kpis -- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-right: 388px; /* keeps clear of the inspector column */
}

.kpi {
  display: flex; align-items: center; gap: 12px;
  min-height: 86px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s;
  min-width: 0;
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.kpi-body { min-width: 0; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--ink-3); font-weight: 500; letter-spacing: .01em; white-space: nowrap; }
.kpi-value {
  display: flex; align-items: baseline; gap: 5px; white-space: nowrap;
  font-size: 25px; font-weight: 650; letter-spacing: -.02em;
  line-height: 1.2; margin-top: 1px;
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 12.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.kpi-sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11.5px; font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 6px;
  padding: 1px 5px;
  transform: translateY(-2px);
}
.delta.warn { color: #b54708; background: var(--amber-soft); }

.icon-tile {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}
.icon-tile.lg { width: 42px; height: 42px; border-radius: 12px; }
.icon-tile.green { background: var(--green-soft); color: #0b8f54; }
.icon-tile.amber { background: var(--amber-soft); color: #b54708; }

/* ---------------------------------------------------------------- stage -- */
.stage-wrap { position: relative; min-height: 0; }

.stage {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(105% 85% at 60% 6%, #fbfdff 0%, #eef3fa 38%, #e2e9f4 74%, #d7e0ee 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), var(--shadow-1);
  isolation: isolate;
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage::after {
  /* soft vignette so the model melts into the panel */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(112% 100% at 58% 40%, rgba(232, 238, 246, 0) 48%, rgba(226, 233, 243, .5) 80%, rgba(217, 226, 239, .9) 100%);
  z-index: 1;
}

.stage-hint {
  position: absolute; left: 16px; bottom: 14px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 6px 0 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 6px 18px -10px rgba(16, 24, 40, .35);
  font-size: 11.5px; color: var(--ink-3);
  white-space: nowrap;
}
.stage-hint .sep { color: #cbd3e0; }
.stage-hint button {
  display: flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: var(--blue);
  background: rgba(47, 92, 255, .08);
  transition: background .16s;
}
.stage-hint button:hover { background: rgba(47, 92, 255, .15); }

.stage-tools {
  position: absolute; right: calc(372px + 24px); bottom: 14px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
}
.stage-wrap:has(.inspector.is-hidden) .stage-tools { right: 16px; }
.ghost-btn {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 6px 18px -12px rgba(16, 24, 40, .4);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  transition: background .16s, color .16s, transform .16s;
  white-space: nowrap;
}
.ghost-btn:hover { background: #fff; color: var(--ink); }
.ghost-btn.on { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 8px 20px -8px rgba(47, 92, 255, .8); }
.ghost-btn svg { opacity: .9; }

/* pins ---------------------------------------------------------------- */
.pins { position: absolute; inset: 0; z-index: 4; pointer-events: none; transition: opacity .24s; }
.pin {
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  pointer-events: none;
  will-change: transform;
}
.pin-dot {
  position: absolute;
  left: -14px; top: -14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font: 600 10.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .94);
  border: 1.5px solid #d5dce8;
  box-shadow: 0 4px 10px -4px rgba(16, 24, 40, .35);
  pointer-events: auto;
  cursor: pointer;
  transition: transform .16s cubic-bezier(.2, .7, .3, 1), background .16s, border-color .16s, color .16s, box-shadow .16s;
}
.pin:hover .pin-dot { transform: scale(1.12); border-color: #b9c9f5; color: var(--ink); }
.pin.is-done .pin-dot { color: var(--blue); border-color: #c9d8ff; background: #f5f8ff; }
.pin.is-active .pin-dot {
  color: #fff;
  background: var(--blue);
  border-color: #fff;
  box-shadow: 0 0 0 5px rgba(47, 92, 255, .18), 0 6px 16px -4px rgba(47, 92, 255, .7);
  transform: scale(1.16);
}
.pin.is-active .pin-dot::after {
  content: "";
  position: absolute; inset: -9px;
  border-radius: 50%;
  border: 1.5px solid rgba(47, 92, 255, .38);
  animation: pinPulse 2.2s ease-out infinite;
}
@keyframes pinPulse {
  0% { transform: scale(.82); opacity: .9; }
  70% { transform: scale(1.22); opacity: 0; }
  100% { opacity: 0; }
}

.pin-card {
  position: absolute;
  left: 21px; top: -17px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 11px 6px 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #eaeef5;
  box-shadow: 0 10px 26px -12px rgba(16, 24, 40, .45), 0 2px 6px rgba(16, 24, 40, .06);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px) scale(.96);
  transform-origin: left center;
  transition: opacity .18s, transform .18s cubic-bezier(.2, .7, .3, 1);
  pointer-events: none;
}
.pin-card .pc-icon {
  width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue);
}
.pin-card .pc-text { display: flex; flex-direction: column; line-height: 1.25; }
.pin-card b { font-size: 11px; font-weight: 650; color: var(--ink); }
.pin-card small { font-size: 9.5px; color: var(--ink-4); }
.pin.is-active .pin-card,
.pin:hover .pin-card { opacity: 1; transform: translateX(0) scale(1); }
.pin.is-active .pin-card { pointer-events: auto; }
.pin.is-active .pin-card::before,
.pin:hover .pin-card::before {
  content: "";
  position: absolute;
  left: -4px; top: 50%;
  width: 7px; height: 7px;
  margin-top: -3.5px;
  background: #fff;
  border-left: 1px solid #eaeef5;
  border-bottom: 1px solid #eaeef5;
  transform: rotate(45deg);
}
.pin.flip .pin-card { left: auto; right: 22px; transform-origin: right center; }
.pin.flip.is-active .pin-card,
.pin.flip:hover .pin-card { transform: translateX(0) scale(1); }
.pin.flip .pin-card::before { left: auto; right: -4px; border-left: 0; border-bottom: 0; border-right: 1px solid #eaeef5; border-top: 1px solid #eaeef5; }

/* ---------------------------------------------------- anchor editor ----- */
.pins.is-editing .pin-dot { cursor: grab; box-shadow: 0 0 0 3px rgba(247, 144, 9, .12), 0 4px 10px -4px rgba(16, 24, 40, .35); }
.pins.is-editing .pin-dot:active { cursor: grabbing; }

.anchor-editor {
  position: absolute;
  left: 14px; top: 14px; bottom: 56px;
  width: 292px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px) saturate(1.15);
  border: 1px solid #fff;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: aeIn .22s cubic-bezier(.2, .7, .3, 1);
}
.anchor-editor[hidden] { display: none; }
@keyframes aeIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.ae-head { display: flex; align-items: flex-start; gap: 9px; }
.ae-head .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.ae-title { flex: 1; min-width: 0; }
.ae-title h4 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.ae-title p { margin: 2px 0 0; font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }

.ae-list {
  flex: 1; min-height: 0;
  overflow: auto;
  margin: 9px -5px 0; padding: 0 5px;
  display: flex; flex-direction: column; gap: 1px;
}
.ae-list::-webkit-scrollbar { width: 4px; }
.ae-list::-webkit-scrollbar-thumb { background: #e2e8f2; border-radius: 4px; }
.ae-row {
  display: flex; align-items: center; gap: 8px;
  height: 27px; padding: 0 6px;
  border-radius: 7px;
  text-align: left;
  transition: background .14s;
}
.ae-row:hover { background: #f6f8fc; }
.ae-row.is-active { background: var(--blue-soft); box-shadow: inset 0 0 0 1px #d9e4ff; }
.ae-num { width: 18px; font: 650 9.5px/1 var(--font); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ae-row.is-active .ae-num { color: var(--blue); }
.ae-name { flex: 1; font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ae-pos { font: 500 9px/1 var(--font); color: var(--ink-4); font-variant-numeric: tabular-nums; }
.ae-dot { width: 6px; height: 6px; border-radius: 50%; background: #d5dce8; flex: none; }
.ae-dot.custom { background: var(--green); box-shadow: 0 0 0 3px rgba(18, 183, 106, .14); }

.ae-hint { margin-top: 8px; font-size: 10px; line-height: 1.6; color: var(--ink-4); }
.ae-link {
  display: inline;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ae-link:hover { color: var(--blue-dark); }
.ae-foot { display: flex; gap: 6px; margin-top: 9px; }
.ae-btn {
  flex: 1; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  transition: all .16s;
  white-space: nowrap;
}
.ae-btn:hover { border-color: #c3d3ff; color: var(--blue); background: #f8faff; }
.ae-btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.ae-btn.primary:hover { background: var(--blue-dark); color: #fff; }


/* explicit rows keep the stage in place when panels are hidden */
.app > .topbar { grid-row: 1; }
.app > .kpis { grid-row: 2; }
.app > .stage-wrap { grid-row: 3; }
.app > .bottom { grid-row: 4; }

/* ------------------------------------------------- empty (unwired) line -- */
.app.is-line-empty { grid-template-rows: 64px 0 minmax(0, 1fr) 0; }
.app.is-line-empty .kpis,
.app.is-line-empty .bottom,
.app.is-line-empty .inspector,
.app.is-line-empty .live,
.app.is-line-empty .stage-hint,
.app.is-line-empty .stage-tools { display: none; }

.line-empty {
  position: absolute; inset: 0;
  z-index: 7;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  text-align: center;
  background: radial-gradient(110% 100% at 50% 30%, rgba(255,255,255,.6), rgba(232,238,247,.35));
}
.line-empty[hidden] { display: none; }
.le-icon {
  width: 68px; height: 68px; border-radius: 22px;
  display: grid; place-items: center;
  background: #fff;
  color: var(--blue);
  box-shadow: 0 14px 30px -16px rgba(16, 24, 40, .35), var(--shadow-1);
  margin-bottom: 4px;
}
.line-empty h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.line-empty p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.line-empty .le-note { font-size: 11.5px; color: var(--ink-4); margin-top: -2px; }
.le-btn {
  margin-top: 8px;
  height: 36px; padding: 0 16px;
  border-radius: 10px;
  background: var(--blue); color: #fff;
  font-size: 12.5px; font-weight: 600;
  box-shadow: 0 10px 20px -10px rgba(47, 92, 255, .9);
  transition: background .16s, transform .16s;
}
.le-btn:hover { background: var(--blue-dark); transform: translateY(-1px); }

/* hidden descriptions (toggle) */
.pins.hide-cards .pin-card {
  opacity: 0 !important;
  transform: translateX(-4px) scale(.97) !important;
  pointer-events: none !important;
}

/* ------------------------------------------------------------ inspector -- */
.inspector {
  position: absolute;
  top: 0;
  right: 0;
  width: 372px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 17px 18px 16px;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  border: 1px solid #fff;
  z-index: 8;
  overflow: hidden;
  transition: transform .34s cubic-bezier(.3, .8, .3, 1), opacity .24s;
}
.inspector.is-hidden { transform: translateX(24px); opacity: 0; pointer-events: none; }

.insp-head { display: flex; align-items: flex-start; gap: 11px; flex: none; }
.insp-head .insp-titles { flex: 1; min-width: 0; }
.insp-head h2 {
  margin: 0;
  font-size: 15px; font-weight: 650; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.insp-head .insp-sub { font-size: 11px; color: var(--ink-4); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-close {
  flex: none;
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-4);
  transition: background .16s, color .16s;
}
.insp-close:hover { background: #f3f6fb; color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 600;
  background: var(--blue-soft); color: var(--blue);
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.done { background: var(--green-soft); color: #0b8f54; }
.pill.run { background: var(--blue-soft); color: var(--blue); }
.pill.wait { background: #f2f4f7; color: var(--ink-3); }
.pill.warn { background: var(--amber-soft); color: #b54708; }

.kv-list { display: flex; flex-direction: column; gap: 9px; }
.kv-list.tight { gap: 8px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.kv > span { color: var(--ink-3); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.kv > span svg { color: var(--ink-4); }
.kv > b { font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.kv > b.hi { color: var(--blue); }
.kv > b.warn { color: var(--amber); }

.insp-note {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px dashed var(--line-2);
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-3);
}
@media (max-height: 940px) {
  .insp-note { display: none; }
}

.insp-body { flex: 1; min-height: 0; overflow: auto; margin-top: 14px; }
.insp-body::-webkit-scrollbar { width: 0; }

.divider { height: 1px; background: var(--line); margin: 13px 0; }

.progress-block { margin-top: 2px; }
.pb-head { display: flex; align-items: baseline; justify-content: space-between; }
.pb-head span:first-child { font-size: 11.5px; color: var(--ink-3); }
.pb-head b { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bar {
  position: relative;
  height: 6px; border-radius: 99px;
  background: #eef1f6;
  margin-top: 8px;
  overflow: hidden;
}
.bar > i {
  position: absolute; inset: 0 auto 0 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #5b86ff, var(--blue));
  transition: width .5s cubic-bezier(.3, .8, .3, 1);
  overflow: hidden;
}
.bar > i::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: shimmer 2.6s linear infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.pb-foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10.5px; color: var(--ink-4); }

.cta {
  flex: none;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 40px;
  margin-top: 14px;
  border-radius: 11px;
  background: var(--blue);
  color: #fff;
  font-size: 12.5px; font-weight: 600;
  box-shadow: 0 10px 20px -10px rgba(47, 92, 255, .9);
  transition: background .16s, transform .16s;
}
.cta:hover { background: var(--blue-dark); transform: translateY(-1px); }

/* --------------------------------------------------------------- footer -- */
.bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px 340px;
  gap: 0;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  border: 1px solid #fff;
  padding: 15px 20px;
  z-index: 20;
  min-height: 0;
}

.panel { min-width: 0; display: flex; flex-direction: column; }
.panel + .panel { border-left: 1px solid var(--line); padding-left: 18px; }
.panel + .panel:last-child { padding-right: 2px; }

.panel-head { display: flex; align-items: flex-start; gap: 11px; }
.panel-head .icon-tile { width: 38px; height: 38px; border-radius: 11px; }
.panel-title { flex: 1; min-width: 0; }
.panel-title h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.panel-title p { margin: 3px 0 0; font-size: 11px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-link {
  flex: none;
  font-size: 11.5px; font-weight: 600; color: var(--blue);
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 6px; border-radius: 7px;
  transition: background .16s;
  white-space: nowrap;
}
.panel-link:hover { background: var(--blue-soft); }

/* flow ribbon */
.flow {
  --steps: 10;
  --edge: 5%;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--steps), minmax(0, 1fr));
  margin-top: auto;
  padding: 10px 2px 2px;
}
.flow::before {
  content: "";
  position: absolute; left: var(--edge); right: var(--edge); top: 24px;
  height: 2px; border-radius: 2px;
  background: var(--line-2);
}
.flow-line {
  position: absolute; left: var(--edge); top: 24px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #7ba0ff, var(--blue));
  transition: width .45s cubic-bezier(.3, .8, .3, 1);
  z-index: 1;
}
.step {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 0 2px;
  color: var(--ink-4);
  transition: color .16s, opacity .2s;
}
.step .num {
  position: relative;
  width: 27px; height: 27px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  background: #fff;
  border: 1.5px solid #dee4ee;
  box-shadow: 0 2px 5px -2px rgba(16, 24, 40, .18);
  transition: all .2s cubic-bezier(.2, .7, .3, 1);
  z-index: 2;
}
.step .name { font-size: 10.5px; font-weight: 500; color: var(--ink-3); letter-spacing: -.01em; white-space: nowrap; }
.step.is-done .num { border-color: #c9d8ff; color: var(--blue); background: #f7faff; }
.step.is-done .name { color: var(--ink-2); }
.step.is-active .num {
  color: #fff; border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(47, 92, 255, .12), 0 6px 14px -6px rgba(47, 92, 255, .9);
  transform: scale(1.08);
}
.step.is-active .name { color: var(--ink); font-weight: 650; }
.step:hover .num { transform: translateY(-1px) scale(1.06); border-color: #b9c9f5; }
.step.is-active:hover .num { transform: scale(1.1); }

.flow-meta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line-2);
  font-size: 11px; color: var(--ink-4);
  white-space: nowrap;
}
.flow-meta b { color: var(--ink-2); font-weight: 600; }
.flow-meta .spacer { margin-left: auto; }
.play-btn {
  display: flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  transition: all .16s;
}
.play-btn:hover { border-color: #c3d3ff; color: var(--blue); background: #f8faff; }
.play-btn.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* current task */
.task-card {
  display: flex; align-items: center; gap: 10px;
  margin-top: 11px;
  padding: 11px 11px 11px 10px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fbfcff, #f8faff);
  transition: border-color .18s, box-shadow .18s, transform .18s;
  min-width: 0;
}
.task-card:hover { border-color: #d9e2f7; box-shadow: var(--shadow-1); transform: translateY(-1px); }
.task-card .icon-tile { width: 36px; height: 36px; border-radius: 10px; background: #eef3ff; }
.task-main { flex: 1; min-width: 0; }
.task-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; }
.task-title .pill { flex: none; height: 20px; padding: 0 6px; font-size: 10px; }
.task-meta { font-size: 10px; color: var(--ink-4); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-bar { height: 4px; border-radius: 99px; background: #eaeef6; margin-top: 7px; overflow: hidden; }
.task-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6d93ff, var(--blue)); transition: width .45s cubic-bezier(.3, .8, .3, 1); }
.task-pct { flex: none; font-size: 11.5px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.task-card .chev { flex: none; color: var(--ink-4); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.stat {
  padding: 8px 11px;
  border-radius: 11px;
  background: #f8fafd;
  border: 1px solid #f1f4f9;
  min-width: 0;
}
.stat span { display: block; font-size: 10px; color: var(--ink-4); white-space: nowrap; }
.stat b { display: block; margin-top: 2px; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* upcoming */
.up-list { display: flex; flex-direction: column; margin-top: 9px; }
.up-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px;
  border-radius: 9px;
  transition: background .16s;
  min-width: 0;
}
.up-row:hover { background: #f8fafd; }
.up-idx {
  flex: none;
  width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 650;
  color: var(--ink-3); background: #f2f5fa;
}
.u-name { font-size: 12px; font-weight: 600; white-space: nowrap; }
.u-meta { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row .tag { margin-left: auto; }
.tag {
  display: inline-flex; align-items: center;
  height: 21px; padding: 0 8px;
  border-radius: 6px;
  font-size: 10.5px; font-weight: 600;
  background: #f2f4f7; color: var(--ink-3);
  white-space: nowrap;
  flex: none;
}
.tag.wait { background: var(--amber-soft); color: #b54708; }
.tag.ready { background: var(--green-soft); color: #0b8f54; }
.tag.done { background: #f2f4f7; color: var(--ink-3); }

/* ---------------------------------------------------------------- loader -- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 20%, #ffffff, #eef2f8 60%, #e6ecf5 100%);
  transition: opacity .6s ease, visibility .6s;
}
.loader.is-gone { opacity: 0; visibility: hidden; }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loader-mark {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #4a72ff, #1e46e2);
  color: #fff;
  box-shadow: 0 18px 40px -18px rgba(47, 92, 255, .9);
  animation: floaty 2.8s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.loader-title { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.loader-sub { font-size: 11.5px; color: var(--ink-4); margin-top: -8px; font-variant-numeric: tabular-nums; }
.loader-bar { width: 240px; height: 4px; border-radius: 99px; background: #e4eaf3; overflow: hidden; }
.loader-bar > i { display: block; height: 100%; width: 4%; border-radius: 99px; background: linear-gradient(90deg, #7ba0ff, var(--blue)); transition: width .3s ease; }
.loader-note { font-size: 10.5px; color: var(--ink-4); max-width: 300px; text-align: center; line-height: 1.6; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #101828;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 16px 40px -16px rgba(16, 24, 40, .7);
  opacity: 0; pointer-events: none;
  transition: opacity .24s, transform .24s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 1520px) {
  .app { grid-template-rows: 62px auto minmax(0, 1fr) 224px; gap: 12px; padding: 12px 14px 14px; }
  .kpis { padding-right: 366px; gap: 12px; }
  .inspector { width: 352px; padding: 15px 16px 14px; }
  .stage-tools { right: calc(352px + 22px); }
  .bottom { grid-template-columns: minmax(0, 1fr) 310px 322px; padding: 13px 16px; }
  .panel + .panel { padding-left: 16px; }
  .kpi-value { font-size: 23px; }
  .search { max-width: 440px; }
}

@media (max-width: 1360px) {
  .kpi { padding: 12px; gap: 10px; min-height: 80px; }
  .kpi-value { font-size: 21px; }
  .icon-tile { width: 40px; height: 40px; }
  .brand-text span { display: none; }
  .user-meta { display: none; }
  .search { max-width: 340px; }
  .step .name { font-size: 9.5px; }
  .bottom { grid-template-columns: minmax(0, 1fr) 286px 296px; }
  .site-chip small { display: none; }
}

/* short viewports (e.g. 1080p screens at 125% scale) */
@media (max-height: 880px) {
  .app { grid-template-rows: 58px auto minmax(0, 1fr) 208px; gap: 10px; padding: 10px 14px 12px; }
  .kpi { min-height: 74px; padding: 10px 13px; }
  .kpi-value { font-size: 21px; }
  .kpi-sub { font-size: 10.5px; }
  .icon-tile { width: 40px; height: 40px; border-radius: 12px; }
  .inspector { padding: 13px 15px 12px; }
  .insp-head h2 { font-size: 14px; }
  .insp-body { margin-top: 11px; }
  .inspector .divider { margin: 10px 0; }
  .kv-list { gap: 7px; }
  .kv-list.tight { gap: 6px; }
  .kv { font-size: 11.5px; }
  .cta { height: 36px; margin-top: 10px; font-size: 12px; }
  .meta-secondary { display: none; }
  .panel-title p { display: none; }
  .flow-meta { margin-top: 6px; padding-top: 8px; }
  .stat-grid { margin-top: 8px; }
  .task-card { margin-top: 9px; }
}

