/* ChemSphere — design system
   Soft, professional, scientific. Light + dark tokens. Compact density. */

:root {
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Manrope", "Inter", "SF Pro Display", -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --bg: #f3f5f9;
  --bg-2: #eaeef5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;
  --line: #e3e8f0;
  --line-2: #d3dae6;
  --ink: #0f1b2d;
  --ink-2: #3b4a60;
  --ink-3: #6b7a90;
  --ink-4: #98a4b6;

  --brand: #0f766e;
  --brand-2: #14b8a6;
  --brand-soft: #e6f6f4;
  --indigo: #4f46e5;
  --indigo-soft: #eef0ff;
  --amber: #d97706;
  --amber-soft: #fff6e6;
  --red: #dc2626;
  --red-soft: #fdeeee;
  --green: #16a34a;
  --green-soft: #eaf8ef;
  --sky: #0284c7;
  --sky-soft: #e8f5fd;
  --violet: #7c3aed;
  --violet-soft: #f3edff;

  --r1: #16a34a; --r2: #84cc16; --r3: #eab308; --r4: #f97316; --r5: #dc2626;

  --shadow-1: 0 1px 2px rgba(15, 27, 45, .05), 0 1px 1px rgba(15, 27, 45, .03);
  --shadow-2: 0 4px 14px rgba(15, 27, 45, .07), 0 1px 3px rgba(15, 27, 45, .05);
  --shadow-3: 0 18px 50px rgba(15, 27, 45, .18), 0 4px 12px rgba(15, 27, 45, .08);
  --radius: 12px;
  --radius-s: 8px;
  --side-w: 214px;
  --top-h: 54px;
  --grid-dot: rgba(15, 27, 45, .045);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { /* overridden by JS-applied data-theme; kept for no-JS */ }
}

:root[data-theme="dark"] {
  --bg: #0a111e;
  --bg-2: #0d1626;
  --surface: #111b2c;
  --surface-2: #142034;
  --surface-3: #18263d;
  --line: #1f2d45;
  --line-2: #2a3b58;
  --ink: #e8eef8;
  --ink-2: #b9c5d8;
  --ink-3: #8394ad;
  --ink-4: #5d6e88;
  --brand: #2dd4bf;
  --brand-2: #5eead4;
  --brand-soft: rgba(45, 212, 191, .12);
  --indigo: #818cf8;
  --indigo-soft: rgba(129, 140, 248, .14);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .13);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, .12);
  --sky: #38bdf8;
  --sky-soft: rgba(56, 189, 248, .12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, .55);
  --grid-dot: rgba(255, 255, 255, .04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "tnum";
  transition: background .5s ease, color .5s ease;
}
a { color: var(--brand); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 19px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 700; }
h3 { font-size: 13px; font-weight: 700; }
h4 { font-size: 12px; font-weight: 600; color: var(--ink-2); }
p { margin: 0 0 6px; }
svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.role-tile > svg.i { color: var(--brand); opacity: 0; }
.role-tile.on > svg.i { opacity: 1; }
.list-item > svg.i, .row > svg.i { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-3); }
.small { font-size: 11.5px; }
.tiny { font-size: 10.5px; }
.upper { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- App shell ---------- */
#app { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100vh; }
.sidebar {
  grid-row: 1 / 3;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 12px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand-name b { color: var(--brand); font-weight: 800; }
.brand-sub { font-size: 10px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.nav-sec { margin: 10px 8px 4px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px; border-radius: 8px;
  color: var(--ink-2); font-weight: 500; font-size: 12.5px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a .pill { margin-left: auto; }
.side-foot { margin-top: auto; padding: 10px 6px 0; border-top: 1px solid var(--line); }

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; }
.search {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 9px; padding: 0 9px; height: 32px; width: 260px;
}
.search input { border: 0; background: transparent; outline: 0; font: inherit; color: var(--ink); width: 100%; }
.search svg { width: 14px; height: 14px; color: var(--ink-3); }
.main { overflow: auto; padding: 14px 16px 16px; position: relative;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 18px 18px; }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); font: inherit; font-weight: 600; font-size: 12px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15,118,110,.3); }
:root[data-theme="dark"] .btn.primary { color: #04201d; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.indigo { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--red); }
.btn.sm { height: 25px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 25px; }
.iconbtn {
  width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent;
  display: inline-grid; place-items: center; background: transparent; color: var(--ink-2); cursor: pointer; position: relative;
}
.iconbtn:hover { background: var(--surface-3); color: var(--ink); }
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn.on { background: var(--brand-soft); color: var(--brand); }
.dot-badge { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }

input.in, select.in, textarea.in {
  width: 100%; height: 30px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; padding: 0 9px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.in { height: auto; padding: 7px 9px; resize: vertical; min-height: 54px; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.in.bad { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
label.f .req { color: var(--red); }
.fgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 12px; }
.fgrid.c3 { grid-template-columns: repeat(3, 1fr); }
.fgrid .span2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; }
.check input { accent-color: var(--brand); width: 15px; height: 15px; }

.switch { position: relative; width: 30px; height: 17px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 13px; height: 13px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(13px); }

.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 4px 10px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Cards / layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 12px 13px; min-width: 0; position: relative;
}
.card.flat { box-shadow: none; }
.card.pad0 { padding: 0; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.card-h h2, .card-h h3 { display: flex; align-items: center; gap: 7px; }
.card-h h2 svg, .card-h h3 svg { width: 15px; height: 15px; color: var(--brand); }
.card-h .spacer + * { margin-left: 0; }
.card.link { cursor: pointer; transition: box-shadow .2s, transform .2s, border-color .2s; }
.card.link:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); transform: translateY(-1px); }
.grid { display: grid; gap: 12px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.page-h { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 12px; }
.page-h .sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.hr { height: 1px; background: var(--line); margin: 9px 0; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; }
.kpi .lbl { font-size: 11px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .lbl svg { width: 13px; height: 13px; }
.kpi .val { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.kpi .val small { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.kpi .delta { font-size: 11px; font-weight: 600; }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; width: 78px; height: 26px; }
.up { color: var(--green); } .down { color: var(--red); }

/* Pills & tags */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; height: 19px; border-radius: 20px; font-size: 10.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line); }
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.pill.indigo { background: var(--indigo-soft); color: var(--indigo); border-color: transparent; }
.pill.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.sky { background: var(--sky-soft); color: var(--sky); border-color: transparent; }
.pill.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: pulse 1.8s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

/* Tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* Progress */
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--brand); transition: width .6s; }
.bar.amber > i { background: var(--amber); } .bar.red > i { background: var(--red); } .bar.indigo > i { background: var(--indigo); }

/* Avatars */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.av.sm { width: 22px; height: 22px; font-size: 9.5px; }

/* Product tiles */
.prod { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; transition: .2s; }
.prod:hover { border-color: var(--brand); background: var(--surface); box-shadow: var(--shadow-2); }
.prod .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.prod .ic svg { width: 18px; height: 18px; }
.prod h3 { font-size: 12.5px; }
.prod p { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 0; line-height: 1.35; }

/* ---------- Windows (modals) ---------- */
.win-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(8, 15, 28, .38); backdrop-filter: blur(3px); animation: fade .18s ease; }
@keyframes fade { from { background: rgba(8, 15, 28, 0); } to { background: rgba(8, 15, 28, .38); } }
.win { width: min(980px, 94vw); max-height: 90vh; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.win.sm { width: min(560px, 94vw); }
.win.lg { width: min(1240px, 96vw); }
.win.full { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; }
@keyframes pop { from { transform: translateY(8px) scale(.985); } to { transform: none; } }
.win-bar { display: flex; align-items: center; gap: 4px; padding: 7px 8px 7px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.win-bar .t { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; margin-left: 4px; min-width: 0; }
.win-bar .iconbtn { width: 28px; height: 28px; }
.win-bar .iconbtn svg { width: 15px; height: 15px; }
.win-bar .iconbtn.x:hover { background: var(--red-soft); color: var(--red); }
.win-body { padding: 14px; overflow: auto; flex: 1; }
.win-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* Tooltip */
#tip { position: fixed; z-index: 300; pointer-events: none; max-width: 300px; background: #0f1b2d; color: #eef3fb; font-size: 11.5px; line-height: 1.4; padding: 7px 9px; border-radius: 8px; box-shadow: var(--shadow-3); opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; }
:root[data-theme="dark"] #tip { background: #e8eef8; color: #0f1b2d; }
#tip.on { opacity: 1; transform: none; }
#tip b { display: block; margin-bottom: 2px; font-size: 12px; }

/* Toast */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand); box-shadow: var(--shadow-3); border-radius: 10px; padding: 9px 12px; font-size: 12.5px; max-width: 360px; animation: pop .25s; display: flex; gap: 9px; align-items: flex-start; }
.toast svg { width: 16px; height: 16px; color: var(--brand); flex: none; margin-top: 1px; }
.toast.warn { border-left-color: var(--amber); } .toast.warn svg { color: var(--amber); }
.toast.err { border-left-color: var(--red); } .toast.err svg { color: var(--red); }

/* Broadcast banner */
.bcast { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; margin-bottom: 12px; background: linear-gradient(90deg, var(--indigo-soft), var(--brand-soft)); border: 1px solid var(--line); font-size: 12.5px; }
.bcast svg { width: 16px; height: 16px; color: var(--indigo); flex: none; }

/* ---------- Julia drawer ---------- */
.peter-fab { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 6px; border-radius: 30px; border: 0; cursor: pointer; color: #fff; font: inherit; font-weight: 700; font-size: 13px; background: linear-gradient(135deg, #0f766e, #4f46e5); box-shadow: 0 10px 30px rgba(79, 70, 229, .35); transition: transform .2s; }
.peter-fab:hover { transform: translateY(-2px); }
.peter-fab .pa { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.peter { position: fixed; right: 18px; bottom: 18px; width: 400px; height: min(640px, calc(100vh - 36px)); z-index: 95; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden; animation: pop .25s; }
.peter.full { inset: 0; width: auto; height: auto; border-radius: 0; right: 0; bottom: 0; }
.peter-head { padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 9px; color: #fff; background: linear-gradient(135deg, #0f766e, #4f46e5); }
.peter-head .iconbtn { color: #fff; width: 28px; height: 28px; }
.peter-head .iconbtn:hover { background: rgba(255,255,255,.15); color: #fff; }
.peter-head .iconbtn svg { width: 15px; height: 15px; }
.peter-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.peter-msgs { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); }
.msg { max-width: 88%; padding: 8px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.msg.p { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; align-self: flex-start; }
.msg.u { background: var(--brand); color: #fff; border-top-right-radius: 4px; align-self: flex-end; }
:root[data-theme="dark"] .msg.u { color: #04201d; }
.msg ul { margin: 4px 0; padding-left: 17px; }
.msg .src { font-size: 10.5px; color: var(--ink-3); margin-top: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.peter-in { display: flex; gap: 6px; padding: 9px; border-top: 1px solid var(--line); background: var(--surface); }
.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--ink-4); animation: bounce 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-4px); } }

/* Coach hints (mistake prevention) */
.hint { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: 9px; font-size: 12px; background: var(--sky-soft); color: var(--ink-2); border: 1px solid transparent; }
.hint svg { width: 15px; height: 15px; flex: none; color: var(--sky); margin-top: 1px; }
.hint.warn { background: var(--amber-soft); } .hint.warn svg { color: var(--amber); }
.hint.err { background: var(--red-soft); } .hint.err svg { color: var(--red); }
.hint.ok { background: var(--green-soft); } .hint.ok svg { color: var(--green); }

/* Checklist */
.ck { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.ck input { margin-top: 2px; accent-color: var(--brand); }
.ck .t { font-weight: 600; font-size: 12px; }
.ck .d { font-size: 11px; color: var(--ink-3); }
.ck.done { background: var(--green-soft); border-color: transparent; }

/* Stepper */
.steps { display: flex; gap: 4px; }
.step { flex: 1; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 9px; background: var(--surface-3); font-size: 11.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.step .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-2); font-size: 10.5px; }
.step.on { background: var(--brand-soft); color: var(--brand); }
.step.on .n { background: var(--brand); color: #fff; border-color: var(--brand); }
.step.done .n { background: var(--green); color: #fff; border-color: var(--green); }

/* Worksheet */
.ws { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11.5px; table-layout: fixed; }
.ws th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; padding: 6px 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.ws td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.ws td:last-child { border-right: 0; }
.ws td .cell { padding: 6px 7px; min-height: 30px; outline: none; white-space: pre-wrap; }
.ws td .cell:focus { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
.ws td .cell:empty::before { content: attr(data-ph); color: var(--ink-4); }
.ws tr.peter-row td { background: color-mix(in srgb, var(--indigo-soft) 55%, transparent); }
.ws tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.ws tr.flag-err td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.rk { display: inline-grid; place-items: center; min-width: 26px; height: 20px; border-radius: 5px; font-weight: 700; font-size: 11px; color: #fff; padding: 0 5px; }

/* Risk matrix */
.rm { display: grid; gap: 2px; font-size: 10.5px; }
.rm div { display: grid; place-items: center; border-radius: 4px; min-height: 22px; font-weight: 700; color: #fff; }
.rm .h { background: transparent; color: var(--ink-3); font-weight: 600; }

/* Schematic */
.schem { width: 100%; height: 100%; display: block; }
.schem text { font-family: var(--font); }
.schem .node-zone { cursor: pointer; transition: fill-opacity .2s; }
.schem .node-zone:hover { fill-opacity: .22; }
.flow { stroke-dasharray: 6 6; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -12; } }
.canvas3d { width: 100%; height: 100%; display: block; cursor: grab; border-radius: 10px; }
.canvas3d:active { cursor: grabbing; }
.viz-box { position: relative; border-radius: 10px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, var(--surface) 0%, var(--surface-3) 100%); border: 1px solid var(--line); }
.viz-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; z-index: 2; }
.viz-legend { position: absolute; left: 10px; bottom: 8px; display: flex; gap: 10px; font-size: 10.5px; color: var(--ink-3); z-index: 2; }
.viz-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tabs button { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 7px 11px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--ink); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { position: relative; overflow: hidden; background: linear-gradient(150deg, #06202a 0%, #0b3a4a 45%, #2a2470 100%); color: #e9f3f7; padding: 40px 46px; display: flex; flex-direction: column; }
.login-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.login-art > *:not(canvas) { position: relative; z-index: 1; }
.login-form { display: grid; place-items: center; padding: 30px; background: var(--bg); }
.login-card { width: 100%; max-width: 420px; }
.role-tile { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: .2s; }
.role-tile:hover, .role-tile.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.role-tile .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.role-tile .ic svg { width: 18px; height: 18px; }

/* Ring */
.ring { position: relative; display: inline-grid; place-items: center; }
.ring .lbl { position: absolute; text-align: center; line-height: 1.1; }
.ring .lbl b { font-family: var(--font-display); font-size: 18px; display: block; }

/* Live screens */
.screen-thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); aspect-ratio: 16 / 10; }
.screen-thumb iframe { position: absolute; top: 0; left: 0; width: 1440px; height: 900px; border: 0; transform-origin: 0 0; pointer-events: none; }
.screen-thumb .cursor { position: absolute; width: 14px; height: 14px; z-index: 3; transition: left 1.2s ease, top 1.2s ease; pointer-events: none; }
.screen-cap { display: flex; align-items: center; gap: 7px; padding: 7px 2px 0; font-size: 11.5px; }
.readonly-banner { position: sticky; top: -14px; z-index: 30; margin: -14px -16px 12px; padding: 6px 16px; background: var(--amber-soft); color: var(--amber); font-weight: 600; font-size: 12px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }

/* Misc */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }
.list-item { display: flex; align-items: center; gap: 9px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.empty { padding: 20px; text-align: center; color: var(--ink-3); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.scroll { overflow: auto; }
.code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; word-break: break-all; }
.gw { display: inline-grid; place-items: center; padding: 3px 8px; border-radius: 6px; font-weight: 700; font-size: 11px; background: var(--indigo-soft); color: var(--indigo); }
.fade-in { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { transform: translateY(5px); } to { transform: none; } }
.theme-clock { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1100px) {
  .g4, .g5, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- Tablets: multi-column dashboard rows stack ---------- */
@media (max-width: 1000px) {
  .main .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; height: auto !important; }
  #wsgrid > :nth-child(2) { order: -1; min-height: 60vh; }
}
.mobile-only { display: none !important; }
.nav-backdrop { display: none; }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  body { font-size: 14px; }
  #app { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr; height: 100dvh; }
  .mobile-only { display: inline-grid !important; }

  /* Slide-in menu */
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 150; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-3); grid-row: auto; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 140; background: rgba(8, 15, 28, .45); }
  .nav a { padding: 10px 10px; font-size: 14px; }

  /* Top bar: essentials only */
  .topbar { padding: 0 8px; gap: 2px; padding-top: env(safe-area-inset-top); }
  .topbar .search, #tips-btn, #theme-clock, .topbar > .av { display: none !important; }
  .crumbs { font-size: 13px; overflow: hidden; white-space: nowrap; }
  .iconbtn { width: 38px; height: 38px; }

  /* Content: one column, natural height */
  .main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .main .grid, .win .grid { grid-template-columns: minmax(0, 1fr) !important; height: auto !important; }
  .main .grid.g4, .main .grid.g5, .main .grid.g6 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .span2, .span3 { grid-column: auto; }
  .fgrid, .fgrid.c3 { grid-template-columns: 1fr; }
  .fgrid .span2 { grid-column: auto; }
  .page-h { flex-wrap: wrap; align-items: flex-start; }
  .page-h > .spacer { display: none; }
  .page-h > div:first-child { flex: 1 1 100%; }
  .page-h h1 { font-size: 18px; }
  .card-h { flex-wrap: wrap; }
  .kpi .val { font-size: 20px; }
  .kpi .spark { display: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs button { white-space: nowrap; }
  .steps { overflow-x: auto; }
  .step { min-width: 120px; }
  .tbl-wrap, .scroll { -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 560px; }
  .btn { height: 36px; }
  .btn.sm { height: 30px; }
  input.in, select.in, textarea.in { height: 40px; font-size: 16px; }   /* 16px stops iOS zoom-on-focus */
  textarea.in { height: auto; }
  .viz-box, .map-box { max-height: 70vh; }
  .readonly-banner { margin: -12px -12px 12px; }

  .main { overflow-x: hidden; }
  .page-h > * { max-width: 100%; }
  .page-h h1.ellipsis { white-space: normal; }
  .page-h > .row[style*="width:200px"] { width: 100% !important; }
  #nodehead { flex-wrap: wrap; }
  #nodehead > .grow { flex-basis: 100%; }
  #wsgrid .card.pad0 > .row:last-child { flex-wrap: wrap; padding: 8px 10px 64px !important; }
  #wsgrid .card.pad0 > .row:last-child select { flex: 1 1 45%; width: auto !important; }

  /* HAZOP workspace stacks: worksheet first */
  #wsgrid > :nth-child(2) { order: -1; min-height: 60vh; }
  #wsgrid #wsbox { max-height: 65vh; }

  /* Popups become full-screen sheets */
  .win, .win.sm, .win.lg { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .win-bar { padding-top: calc(7px + env(safe-area-inset-top)); }
  .win-body { padding: 12px; }

  /* Julia: full-screen chat, compact button */
  .peter { inset: 0; width: auto; height: auto; right: 0; bottom: 0; border-radius: 0; }
  .peter-fab { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 0 12px 0 5px; height: 46px; }

  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { padding: 20px 16px; align-items: start; }
  #toasts { left: 12px; right: 12px; bottom: 70px; }
  .toast { max-width: none; }
}
@media (hover: none) { #tip { display: none !important; } }
@media print {
  .sidebar, .topbar, .peter-fab, .peter { display: none !important; }
  #app { display: block; height: auto; }
  .main { overflow: visible; background: none; }
}

/* Live maps (Leaflet) */
.leaflet-container { font-family: var(--font); background: var(--surface-3); border-radius: 10px; }
.cs-mk { background: none !important; border: 0 !important; }
.cs-mappanel { background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; box-shadow: var(--shadow-2); backdrop-filter: blur(6px); }
.cs-mappanel .in { height: 28px; }
.leaflet-tooltip.cs-tt { background: transparent; border: 0; box-shadow: none; color: #0284c7; font-weight: 700; font-size: 10px; }
.leaflet-tooltip.cs-tt::before { display: none; }
.leaflet-control-layers, .leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line) !important; }
.leaflet-control-attribution { font-size: 9.5px; }
.cs-pulse { animation: pulse 1.8s infinite; }
.map-box { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); }

/* Intelligent search */
.search { position: relative; width: 340px; }
.sx { position: absolute; top: calc(100% + 6px); left: 0; width: 520px; max-height: 70vh; overflow: auto; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); padding: 6px; }
.sx-h { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-3); padding: 7px 8px 3px; }
.sx-i { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 12.5px; }
.sx-i:hover, .sx-i.on { background: var(--brand-soft); }
.sx-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--brand); flex: none; }
.sx-ic svg { width: 14px; height: 14px; }
.sx mark { background: color-mix(in srgb, var(--amber) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sx-f { padding: 7px 8px 3px; border-top: 1px solid var(--line); margin-top: 4px; }
.sx-sheet { position: fixed; inset: 0; z-index: 200; background: var(--surface); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.sx.sx-full { position: static; width: auto; max-height: none; flex: 1; border: 0; border-radius: 0; box-shadow: none; }
@media (max-width: 1100px) { .search { width: 240px; } .sx { width: 420px; } }

/* Reports: print every section */
.print-only { display: none; }
@media print {
  .rp-sec { display: block !important; break-inside: auto; }
  .tabs, #rdel, .readonly-banner, .leaflet-control-container { display: none !important; }
  .print-only { display: block; }
  .tbl-wrap { max-height: none !important; overflow: visible !important; }
  .card { box-shadow: none; border: 0; }
}

/* Report viewer */
.rpt-l { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); font-size: 12.5px; cursor: pointer; text-decoration: none !important; }
.rpt-l b { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }
.rpt-l:hover { background: var(--surface-3); }
.rpt-l.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rpt-l.on b { color: var(--brand); }
.rpt-tbl .tbl th { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .rpt-tbl .tbl th { background: #0f766e; }
.rpt-tbl .tbl tbody tr:nth-child(even) td { background: var(--surface-2); }
.rpt-sec svg { max-width: 100%; height: auto; }
@media (max-width: 760px) { .rpt-body { grid-template-columns: 1fr !important; } .rpt-toc { position: static !important; display: flex; overflow-x: auto; gap: 4px; } .rpt-toc .rpt-l { white-space: nowrap; } .rpt-toc .hr { display: none; } }
@media (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr) !important; }
  .topbar, .main { min-width: 0; }
  .crumbs { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumbs > * { white-space: nowrap; }
  .page-h .btn { flex: 1 1 auto; }
}

/* Reports bank — compact table */
.rb-tbl td { padding-top: 5px; padding-bottom: 5px; }
.rb-tbl th { position: sticky; top: 0; }
.rb-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.rb-tbl mark, .sx mark { background: color-mix(in srgb, var(--amber) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.rb-n { font-weight: 700; opacity: .6; margin-left: 2px; }
@media (max-width: 760px) { .rb-tbl { min-width: 680px; } #rb-k { overflow-x: auto; flex-wrap: nowrap !important; max-width: 100%; } }

/* AI Agent Julia — HAZOP co-pilot panel */
.copilot { position: fixed; right: 18px; bottom: 76px; width: 360px; max-height: min(560px, calc(100vh - 140px)); z-index: 85; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); display: flex; flex-direction: column; overflow: hidden; }
.copilot.mini .tabs, .copilot.mini .copilot-body { display: none; }
.copilot-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; color: #fff; background: linear-gradient(135deg, #0f766e, #4f46e5); }
.copilot-bar .iconbtn { color: #fff; width: 26px; height: 26px; } .copilot-bar .iconbtn:hover { background: rgba(255,255,255,.15); color: #fff; } .copilot-bar .iconbtn svg { width: 14px; height: 14px; }
.copilot-body { overflow: auto; padding: 0 10px 10px; font-size: 12.5px; }
.cp-step { display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); margin-bottom: 5px; cursor: pointer; background: var(--surface-2); }
.cp-step:hover { border-color: var(--brand); background: var(--brand-soft); }
.cp-step.p1 { border-left: 3px solid var(--amber); }
.cp-n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; flex: none; }
.cp-go { transform: rotate(180deg); color: var(--ink-3); width: 14px; height: 14px; }
.copilot-open { margin-left: 6px; }
@media (max-width: 760px) { .copilot { left: 8px; right: 8px; width: auto; bottom: 70px; max-height: 60vh; } }

/* Live screens — compact, virtualised session list */
.live-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.live-list-card { padding: 10px; }
.live-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.live-tools .search-in { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; background: var(--surface-2); min-width: 180px; }
.live-tools .search-in input { border: 0; background: transparent; outline: 0; font: inherit; font-size: 12.5px; padding: 6px 0; width: 100%; color: var(--ink); }
.live-tools select { font: inherit; font-size: 12px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); max-width: 170px; }
.live-vlist { height: calc(100vh - 250px); min-height: 280px; overflow: auto; position: relative; border-top: 1px solid var(--line); }
.live-vlist #lv-pad { position: relative; }
.lv-row { display: flex; align-items: center; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; cursor: pointer; box-sizing: border-box; }
.lv-row:hover { background: var(--brand-soft); }
.lv-row.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.lv-row.lv-h { background: var(--surface-2); font-size: 12px; position: relative; }
.lv-row.lv-h svg.i { width: 13px; height: 13px; color: var(--ink-3); }
.lv-who { display: flex; align-items: center; gap: 5px; width: 170px; min-width: 0; flex: none; }
.lv-badge { font-size: 9.5px; font-weight: 700; color: var(--brand); border: 1px solid var(--brand); border-radius: 5px; padding: 0 4px; }
.lv-cname { width: 140px; flex: none; color: var(--ink-2); }
.lv-what { flex: 1; min-width: 0; }
.lv-eye svg { width: 14px; height: 14px; color: var(--ink-3); }
.cl-ic { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; color: #fff; font-size: 8.5px; font-weight: 800; flex: none; letter-spacing: -.2px; vertical-align: middle; }
.live-preview { position: sticky; top: 8px; }
@media (max-width: 900px) { .live-wrap { grid-template-columns: 1fr; } .live-preview { position: static; } .lv-cname, .lv-what { display: none; } .lv-who { flex: 1; width: auto; } .live-vlist { height: 60vh; } }

/* Report review & edit (in portal, before download) */
.rpt-editbar { padding: 8px 12px; margin-bottom: 10px; }
.rpt-step { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.rpt-step b { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 10px; }
.rpt-editing .rb { position: relative; border-radius: 8px; outline: 1px dashed transparent; outline-offset: 3px; transition: outline-color .15s; }
.rpt-editing .rb:hover, .rpt-editing .rb.editing { outline-color: var(--brand); }
.rpt-editing .rb.added { background: var(--brand-soft); padding: 2px 6px; }
.rb-tools { display: none; position: absolute; right: -4px; top: -12px; z-index: 4; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px; box-shadow: var(--shadow-1); }
.rpt-editing .rb:hover > .rb-tools { display: flex; }
.rb-tools button { border: 0; background: transparent; width: 24px; height: 22px; border-radius: 6px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; }
.rb-tools button:hover { background: var(--brand-soft); color: var(--brand); } .rb-tools button[data-a=del]:hover { background: #fee2e2; color: var(--red); }
.rb-tools svg { width: 13px; height: 13px; }
.rb [contenteditable=true] { outline: 2px solid var(--brand); border-radius: 6px; padding: 2px 4px; background: var(--surface); min-height: 1.4em; }
.rb-ta { width: 100%; font: inherit; font-size: 12.5px; border: 2px solid var(--brand); border-radius: 8px; padding: 6px 8px; background: var(--surface); color: var(--ink); }
.rs-tools { margin-left: auto; } .rs-tools, .rs-add { display: none; } .rpt-editing .rs-tools { display: inline-flex; } .rpt-editing .rs-add { display: inline-flex; margin-top: 6px; }
.pid-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; border: 2px dashed var(--line-2); border-radius: 12px; cursor: pointer; text-align: center; background: var(--surface-2); }
.pid-drop.over, .pid-drop:hover { border-color: var(--brand); background: var(--brand-soft); } .pid-drop svg { width: 26px; height: 26px; color: var(--brand); transform: rotate(180deg); }
.pid-prev { border: 1px solid var(--line); border-radius: 8px; background: #fff; max-height: 360px; overflow: auto; } .pid-prev img { width: 100%; display: block; }
.pid-eq .in.sm { font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%; }
.i.rot90 { transform: rotate(90deg); }
/* hazard-distance labels on maps */
.dist-lbl { background: none; border: 0; }
.dist-lbl span { display: inline-block; white-space: nowrap; background: rgba(255,255,255,.95); color: #0f1b2d; border: 2px solid; border-radius: 7px; padding: 2px 7px; font: 700 11.5px Inter, -apple-system, sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.brand-co { font-size: 9.5px; font-weight: 600; color: var(--brand); letter-spacing: .02em; margin: 1px 0; white-space: nowrap; }

/* New-report: plain-language study picker */
.nr-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nr-card { display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; align-items: start; text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.nr-card svg { grid-row: span 2; width: 20px; height: 20px; color: var(--brand); margin-top: 1px; }
.nr-card b { font-size: 13px; } .nr-card span { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.nr-card:hover { border-color: var(--brand); } .nr-card.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.nr-adv summary { cursor: pointer; color: var(--ink-2); }
@media (max-width: 760px) { .nr-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Background activity: the ChemSphere globe spins while work is running */
@keyframes cs-spin { to { transform: rotate(360deg); } }
@keyframes cs-glow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(45,212,191,0)); } 50% { filter: drop-shadow(0 0 6px rgba(45,212,191,.85)); } }
.cs-busy .brand .brand-mark, #cs-busy .brand-mark, .cs-spin .brand-mark, .brand-mark.spin { animation: cs-spin 2.2s linear infinite, cs-glow 1.6s ease-in-out infinite; transform-origin: 50% 52%; }
#cs-busy { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 200; display: none; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2, 0 4px 14px rgba(0,0,0,.12)); font-size: 12px; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.cs-busy #cs-busy { display: inline-flex; }
@media (prefers-reduced-motion: reduce) { .cs-busy .brand .brand-mark, #cs-busy .brand-mark, .cs-spin .brand-mark, .brand-mark.spin { animation: cs-glow 1.6s ease-in-out infinite; } }

/* per-field document slots — AI Agent Julia reads and verifies each upload */
.ck-wrap { display: flex; flex-direction: column; gap: 3px; }
.ds { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.ck-wrap .ds { padding-left: 30px; }
.ds-btn { padding: 2px 8px; font-size: 11px; }
.ds-list { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.ds-file { display: flex; align-items: flex-start; gap: 6px; padding: 4px 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); font-size: 11.5px; width: 100%; }
.ds-file .i { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.ds-ok { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.ds-warn { border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.ds-bad { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.ds-row { display: grid; grid-template-columns: minmax(160px, 34%) 1fr; gap: 8px; align-items: start; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ds-row.done { background: var(--green-soft); }
.ds-lbl { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; }

/* module hub */
.mod-ip { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mod-ip .bar { height: 7px; }
.tbl.compact td, .tbl.compact th { padding: 5px 8px; }

/* location status in the New report dialog */
.loc-st { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; border: 1px solid var(--line); margin-top: 4px; }
.loc-st .i { width: 16px; height: 16px; flex: none; }
.loc-st.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 50%, transparent); color: var(--green); }
.loc-st.ok b { color: var(--green); }
.loc-st.warn { background: var(--amber-soft, #fff7e6); border-color: color-mix(in srgb, var(--amber) 50%, transparent); color: var(--amber); }
.loc-st.bad { background: var(--red-soft, #fde2e2); border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }
.loc-st.busy { color: var(--ink-3); }
.loc-st span { color: var(--ink-2); } .loc-st b { color: inherit; }

/* Julia's document-check popup */
.ds-pop { position: fixed; inset: 0; background: rgba(15, 27, 45, .45); display: grid; place-items: center; z-index: 10000; padding: 16px; }
.ds-pop-card { width: min(520px, 100%); background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; border: 1px solid var(--line); }
.ds-pop-h { display: flex; gap: 8px; align-items: center; padding: 12px 14px; font-size: 14px; }
.ds-pop-h.warn { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); color: var(--amber); }
.ds-pop-h.bad { background: color-mix(in srgb, var(--red) 14%, var(--surface)); color: var(--red); }
.ds-pop-h b { color: var(--ink); }
.ds-pop-b { padding: 12px 14px; }
.ds-pop-f { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); }
.ds-pop-f .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }

/* manual entry / Ask Julia on every document slot */
.ds.ds-has-tools { flex-direction: row; flex-wrap: wrap; gap: 4px; align-items: center; }
.ds.ds-has-tools .ds-list { flex-basis: 100%; }
.ds-ask { color: var(--indigo); }
.ds-pop-h.info { background: color-mix(in srgb, var(--indigo) 12%, var(--surface)); color: var(--indigo); }

/* upload everything at once */
.ds-bulk { margin-bottom: 10px; }
.ds-bulk-drop { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 2px dashed color-mix(in srgb, var(--brand) 55%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--brand) 6%, var(--surface)); cursor: pointer; }
.ds-bulk-drop .i { width: 22px; height: 22px; color: var(--brand); flex: none; }
.ds-bulk-drop.over { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.ds-bulk-sum { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.ds-bulk-sum select { max-width: 220px; }

.nm-card { cursor: pointer; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; }
.nm-card:hover { border-color: var(--brand); }

/* Tell Julia about a document */
.jn-ov { position: fixed; inset: 0; background: rgba(15,27,45,.45); display: grid; place-items: center; z-index: 9999; padding: 16px; }
.jn-box { background: var(--surface, #fff); border-radius: 14px; padding: 16px 18px; width: min(640px, 100%); max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); border: 1px solid var(--line, #e2e8f0); }
.jn-box textarea { width: 100%; resize: vertical; }

/* ---------- Julia activity bar (CS.jobs): pinned on top while background work runs ---------- */
:root { --jobs-h: 52px; }
#cs-jobs { position: fixed; top: 0; left: 0; right: 0; z-index: 260; display: none; color: #fff; font-size: 12.5px;
  background: linear-gradient(90deg, #0f766e 0%, #0d9488 45%, #4338ca 100%); box-shadow: 0 6px 18px rgba(15, 23, 42, .28); }
.cs-jobs #cs-jobs { display: block; }
.cs-jobs #app { margin-top: var(--jobs-h); height: calc(100vh - var(--jobs-h)); }
.cs-jobs #cs-busy { display: none !important; }
#cs-jobs .jb-main { height: var(--jobs-h); display: flex; align-items: center; gap: 12px; padding: 0 14px; position: relative; overflow: hidden; }
#cs-jobs .jb-main::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%); background-size: 220% 100%; animation: jb-sheen 2.4s linear infinite; pointer-events: none; }
@keyframes jb-sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }
#cs-jobs .brand-mark { flex: none; animation: cs-spin 2.2s linear infinite; transform-origin: 50% 52%; filter: drop-shadow(0 0 6px rgba(94, 234, 212, .8)); }
#cs-jobs .jb-who { flex: none; font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
#cs-jobs .jb-who small { display: block; font-weight: 500; opacity: .8; font-size: 10.5px; }
#cs-jobs .jb-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; }
#cs-jobs .jb-txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cs-jobs .jb-det { opacity: .85; }
#cs-jobs .jb-step { font-size: 11.5px; opacity: .9; overflow: hidden; text-overflow: ellipsis; }
#cs-jobs .jb-meter { flex: none; display: flex; align-items: center; gap: 8px; width: min(340px, 38vw); }
#cs-jobs .jb-track { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden; }
#cs-jobs .jb-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #fde68a, #5eead4); transition: width .6s ease; }
#cs-jobs .jb-pct { font-weight: 800; font-size: 15px; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
#cs-jobs .jb-el { font-size: 11px; opacity: .8; min-width: 62px; font-variant-numeric: tabular-nums; }
#cs-jobs .jb-row.ok .jb-track i { background: #86efac; }
#cs-jobs .jb-row.bad .jb-track i { background: #fca5a5; }
#cs-jobs .jb-more { flex: none; position: relative; z-index: 1; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; border-radius: 99px; padding: 4px 10px; font: inherit; font-weight: 700; cursor: pointer; }
#cs-jobs .jb-more:hover { background: rgba(255,255,255,.22); }
#cs-jobs .jb-list { background: #0b1220; padding: 6px 14px 10px; max-height: 50vh; overflow: auto; }
#cs-jobs .jb-list .jb-row { padding: 7px 0; border-top: 1px solid rgba(255,255,255,.08); }
@media (max-width: 760px) { :root { --jobs-h: 58px; } .cs-jobs #app { height: calc(100dvh - var(--jobs-h)); } #cs-jobs .jb-who { display: none; } #cs-jobs .jb-meter { width: 42vw; } #cs-jobs .jb-el { display: none; } }
@media (prefers-reduced-motion: reduce) { #cs-jobs .jb-main::after { animation: none; } #cs-jobs .brand-mark { animation: none; } }

/* ---------- living 3D science scene (js/fx3d.js) ---------- */
.login-art > .fx-ctl { position: absolute; top: 14px; right: 14px; bottom: auto; z-index: 2; }
.login-art .fx-cap { display: none; }
.fx-hero { position: relative; overflow: hidden; border-radius: 16px; margin-bottom: 12px; padding: 20px 22px 30px; min-height: 150px; background: #03141b; color: #fff; box-shadow: 0 10px 30px -18px rgba(2, 6, 23, .6); display: flex; align-items: center; }
.fx-hero > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fx-hero > .page-h { position: relative; z-index: 1; margin: 0; width: 100%; }
.fx-hero h1 { color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .35); }
.fx-hero .sub { color: rgba(255, 255, 255, .78); }
.fx-hero .btn:not(.primary) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .22); backdrop-filter: blur(4px); }
.fx-hero .btn:not(.primary):hover { background: rgba(255, 255, 255, .18); }
.fx-ctl { position: absolute; right: 10px; bottom: 8px; z-index: 2; display: flex; gap: 5px; align-items: center; padding: 3px 6px; border-radius: 999px; background: rgba(2, 6, 23, .35); backdrop-filter: blur(4px); }
.fx-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); padding: 0; cursor: pointer; }
.fx-dot.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.fx-btn { background: none; border: 0; color: rgba(255, 255, 255, .85); font-size: 11px; cursor: pointer; padding: 0 3px; line-height: 1; }
.fx-cap { position: absolute; left: 22px; bottom: 9px; z-index: 1; font-size: 11px; color: rgba(255, 255, 255, .7); font-family: "JetBrains Mono", ui-monospace, monospace; pointer-events: none; max-width: calc(100% - 200px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .login .login-art { display: flex; min-height: 190px; padding: 16px; }
  .login-art .la-copy, .login-art .la-foot { display: none; }
  .login-art > .fx-ctl { top: auto; bottom: 10px; }
  .fx-hero { padding: 14px 14px 30px; min-height: 130px; border-radius: 12px; }
  .fx-cap { left: 14px; max-width: calc(100% - 150px); }
}

/* sign out (top bar, every role) */
.btn.signout { gap: 5px; margin-left: 4px; color: #b91c1c; border-color: color-mix(in srgb, #dc2626 35%, var(--line)); background: color-mix(in srgb, #dc2626 6%, var(--card, transparent)); white-space: nowrap; }
.btn.signout:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
:root[data-theme="dark"] .btn.signout { color: #fca5a5; }
@media (max-width: 760px) { .btn.signout span { display: none; } .btn.signout { padding: 0 8px; } }

/* ---------- Julia's lab (click a job on the activity bar) ---------- */
#cs-jobs .jb-row[data-job] { cursor: pointer; }
#cs-jobs .jb-row[data-job]:hover .jb-txt b { text-decoration: underline; text-underline-offset: 3px; }
.jl-head { display: flex; align-items: center; gap: 12px; }
.jl-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jl-step { font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jl-pct { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; background: linear-gradient(90deg, #0d9488, #4338ca); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jl-track { height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.jl-track i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #fde68a, #5eead4, #818cf8); background-size: 200% 100%; animation: jl-flow 2s linear infinite; transition: width .5s ease; }
@keyframes jl-flow { from { background-position: 0 0; } to { background-position: -200% 0; } }
.jl-meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.jl-grid { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: 190px 150px; gap: 10px; margin-top: 10px; }
.jl-grid > * { min-width: 0; border-radius: 12px; overflow: hidden; }
.jl-scene { position: relative; background: #03141b; }
.jl-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.jl-calc, .jl-chart, .jl-steps { background: #0b1220; color: #dbeafe; padding: 8px 10px; display: flex; flex-direction: column; }
.jl-calc { grid-row: span 2; }
.jl-calc-h { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #e2e8f0; margin-bottom: 6px; }
.jl-calc-h svg { width: 14px; height: 14px; }
.jl-calc-h .muted { color: #94a3b8; font-weight: 500; }
.jl-stream { flex: 1; overflow: hidden; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10.5px; line-height: 1.55; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.jl-line { display: flex; gap: 8px; white-space: nowrap; animation: jl-in .25s ease-out; }
.jl-line:first-child { color: #fff; }
@keyframes jl-in { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.jl-n { color: #64748b; flex: none; }
.jl-eq { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #c7d2fe; }
.jl-res { flex: none; color: #5eead4; font-weight: 700; }
.jl-chart canvas { flex: 1; width: 100%; min-height: 0; }
.jl-steps { grid-column: 1; grid-row: 2; display: none; }
.jl-steps ol { margin: 0; padding-left: 16px; font-size: 11px; overflow: auto; flex: 1; }
.jl-steps li { margin: 2px 0; color: #cbd5e1; } .jl-steps li.now { color: #5eead4; font-weight: 700; }
.jl-grid { grid-template-areas: "scene calc" "chart calc" "steps steps"; grid-template-rows: 190px 120px auto; }
.jl-scene { grid-area: scene; } .jl-calc { grid-area: calc; grid-row: auto; } .jl-chart { grid-area: chart; } .jl-steps { grid-area: steps; display: flex; max-height: 150px; }
@media (max-width: 760px) { .jl-grid { grid-template-columns: 1fr; grid-template-areas: "scene" "calc" "chart" "steps"; grid-template-rows: 150px 220px 110px auto; } .jl-pct { font-size: 22px; } }
/* popups never slide under the Julia activity bar */
.cs-jobs .win-layer { top: var(--jobs-h); }
.cs-jobs .win { max-height: calc(100vh - var(--jobs-h) - 20px); }
.cs-jobs .win.full { height: calc(100vh - var(--jobs-h)); max-height: calc(100vh - var(--jobs-h)); }
.jl-calc-h { white-space: nowrap; min-width: 0; }
.jl-calc-h .muted { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Julia bar: pinned notes (uploads not saved yet, saved, stopped jobs), queue, flash of a window holding uploads */
#cs-jobs.pins.warn { background: linear-gradient(90deg, #b45309 0%, #d97706 50%, #ea580c 100%); }
#cs-jobs.pins.bad { background: linear-gradient(90deg, #991b1b 0%, #dc2626 55%, #be123c 100%); }
#cs-jobs.pins.ok { background: linear-gradient(90deg, #15803d 0%, #16a34a 55%, #0d9488 100%); }
#cs-jobs.pins .brand-mark { animation: none; }
#cs-jobs.pins.warn .jb-main { animation: jb-pulse 1.6s ease-in-out infinite; }
@keyframes jb-pulse { 50% { box-shadow: inset 0 0 0 3px rgba(254, 243, 199, .75); } }
#cs-jobs .jb-pin { position: relative; z-index: 1; }
#cs-jobs .jb-ico { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .2); }
#cs-jobs .jb-ico svg { width: 16px; height: 16px; }
#cs-jobs .jb-cta { flex: none; font-weight: 800; background: #fff; color: #0f172a; border-radius: 99px; padding: 4px 12px; white-space: nowrap; }
#cs-jobs .jb-pin.warn .jb-cta { color: #9a3412; } #cs-jobs .jb-pin.bad .jb-cta { color: #991b1b; } #cs-jobs .jb-pin.ok .jb-cta { color: #166534; }
#cs-jobs .jb-x { flex: none; border: 0; background: rgba(255, 255, 255, .18); color: #fff; width: 24px; height: 24px; border-radius: 50%; font-size: 16px; line-height: 1; cursor: pointer; }
#cs-jobs .jb-x:hover { background: rgba(255, 255, 255, .35); }
#cs-jobs .jb-list .jb-pin.warn .jb-ico { background: #d97706; } #cs-jobs .jb-list .jb-pin.bad .jb-ico { background: #dc2626; } #cs-jobs .jb-list .jb-pin.ok .jb-ico { background: #16a34a; }
#cs-jobs .jb-more { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cs-jobs .jb-q { padding: 6px 0 8px 40px; border-top: 1px solid rgba(255,255,255,.08); }
#cs-jobs .jb-q b { font-size: 11.5px; opacity: .9; }
#cs-jobs .jb-q ol { margin: 4px 0 0; padding-left: 26px; columns: 2 260px; font-size: 12px; opacity: .85; }
#cs-jobs .jb-qm { font-size: 11px; opacity: .7; margin-top: 2px; }
@media (max-width: 760px) { #cs-jobs .jb-cta { display: none; } #cs-jobs .jb-more { max-width: 30vw; } }
.win.flash { animation: win-flash .9s ease 2; }
@keyframes win-flash { 50% { box-shadow: 0 0 0 4px #f59e0b, var(--shadow-3); } }
.jl-why { margin: 8px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid; font-size: 13px; }
.jl-why.bad { border-color: #fca5a5; background: rgba(220, 38, 38, .08); }
.jl-why.warn { border-color: #fcd34d; background: rgba(217, 119, 6, .08); }
.jl-why p { margin: 6px 0; } .jl-why ul { margin: 4px 0; padding-left: 20px; }
.jl-q { margin: 4px 0 0; padding-left: 22px; font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { #cs-jobs.pins.warn .jb-main, .win.flash { animation: none; } }

/* Client Admin / User single-page dashboard — compact, tinted */
.cd { --tint1: color-mix(in srgb, var(--brand) 9%, transparent); --tint2: color-mix(in srgb, var(--indigo) 8%, transparent); margin: -4px -6px 0; padding: 4px 6px 8px; border-radius: 16px;
  background: radial-gradient(900px 300px at 0% 0%, var(--tint1), transparent 70%), radial-gradient(700px 300px at 100% 10%, var(--tint2), transparent 70%), radial-gradient(600px 260px at 60% 100%, color-mix(in srgb, var(--sky) 7%, transparent), transparent 70%); }
.cd-head { margin-bottom: 8px !important; }
.cd-head h1 { font-size: 20px; margin: 0 0 1px; }
.cd-head .sub { font-size: 12.5px; }
.cd-sub { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; padding: 7px 8px; margin-bottom: 8px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
  background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 12%, var(--surface)) 0%, color-mix(in srgb, var(--indigo) 9%, var(--surface)) 100%); }
.cd-sub > * { padding: 1px 12px; border-left: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line)); min-width: 0; }
.cd-sub > *:first-child { border-left: 0; padding-left: 4px; }
.cd-plan { display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.cd-planb { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 12.5px; color: #fff; background: linear-gradient(90deg, var(--brand), var(--indigo)); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.cd-planb svg { width: 13px; height: 13px; }
.cd-s { flex: 1 1 100px; display: flex; flex-direction: column; justify-content: center; }
.cd-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); white-space: nowrap; }
.cd-s > b { font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cd-s > b small { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.cd-x { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.cd-bar { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--ink-3) 18%, transparent); overflow: hidden; margin-top: 3px; }
.cd-bar i { display: block; height: 100%; border-radius: 99px; }
.cd-act { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.cd-kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.cd-k { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--k) 28%, var(--line)); background: color-mix(in srgb, var(--k) 9%, var(--surface)); min-width: 0; }
.cd-ki { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--k); background: color-mix(in srgb, var(--k) 16%, transparent); }
.cd-ki svg { width: 14px; height: 14px; }
.cd-k b { display: block; font-size: 16px; line-height: 1.1; color: var(--k); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cd-k div { min-width: 0; } .cd-k div span { display: block; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 8px; align-items: start; }
.cd-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cd-box { background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; backdrop-filter: blur(4px); }
.cd-bh { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cd-bh h2 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.cd-bh h2 svg { width: 15px; height: 15px; color: var(--brand); }
.cd-bh2 { margin-top: 10px; }
.cd-cnt { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.cd-cnt.off { background: color-mix(in srgb, var(--ink-3) 16%, transparent); color: var(--ink-3); }
.cd-pg { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; }
.cd-p { border-radius: 10px; border: 1px solid color-mix(in srgb, var(--pc) 35%, var(--line)); border-top: 3px solid var(--pc); background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 13%, var(--surface)) 0%, var(--surface) 85%); padding: 6px 8px 5px; min-width: 0; transition: transform .15s, box-shadow .15s; }
.cd-p:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--pc) 22%, transparent); }
.cd-ph { display: flex; align-items: center; gap: 7px; cursor: pointer; min-width: 0; }
.cd-ph b { font-size: 12.5px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cd-pi { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--pc); }
.cd-pi svg { width: 15px; height: 15px; }
.cd-pn { display: flex; gap: 4px; margin: 5px 0 3px; cursor: pointer; }
.cd-pn span { flex: 1; text-align: center; font-size: 10px; color: var(--ink-3); background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 6px; padding: 2px 0; }
.cd-pn b { display: block; font-size: 14px; color: var(--ink); line-height: 1.15; }
.cd-pf { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cd-new { display: inline-flex; align-items: center; gap: 2px; border: 0; border-radius: 99px; padding: 2px 8px 2px 5px; font: inherit; font-size: 11px; font-weight: 700; color: #fff; background: var(--pc); cursor: pointer; }
.cd-new svg { width: 12px; height: 12px; }
.cd-lks { display: flex; flex-wrap: wrap; gap: 5px; }
.cd-lk { display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--line-2, var(--line)); background: color-mix(in srgb, var(--surface-2) 80%, transparent); color: var(--ink-3); border-radius: 99px; padding: 3px 9px 3px 7px; font: inherit; font-size: 11.5px; cursor: pointer; }
.cd-lk svg { width: 13px; height: 13px; } .cd-lk > svg:last-child { opacity: .6; width: 11px; height: 11px; }
.cd-lk span { display: grid; opacity: .6; } .cd-lk:hover { border-style: solid; color: var(--ink); } .cd-lk.notMine { border-color: color-mix(in srgb, var(--amber) 60%, transparent); color: var(--amber); }
.cd-chart { width: 100%; height: 86px; display: block; }
.cd-mix { display: flex; height: 7px; border-radius: 99px; overflow: hidden; gap: 1px; margin-top: 4px; }
.cd-mixl { display: flex; flex-wrap: wrap; gap: 3px 9px; margin-top: 4px; font-size: 10.5px; color: var(--ink-3); }
.cd-mixl i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 3px; }
.cd-r { display: flex; align-items: center; gap: 7px; padding: 4px 2px; border-top: 1px solid var(--line); cursor: pointer; min-width: 0; }
.cd-r:first-of-type { border-top: 0; } .cd-r:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.cd-r b { display: block; font-size: 12px; } .cd-r .grow span { display: block; font-size: 10.5px; color: var(--ink-3); }
.cd-tag { flex: none; font-size: 9.5px; font-weight: 800; padding: 2px 5px; border-radius: 5px; color: var(--pc); background: color-mix(in srgb, var(--pc) 15%, transparent); min-width: 40px; text-align: center; }
.cd-st { flex: none; font-size: 10.5px; font-weight: 700; color: var(--amber); } .cd-st.ok { color: var(--green); }
.cd-dt { flex: none; font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cd-team { display: flex; flex-wrap: wrap; gap: 5px; }
.cd-tm { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 2px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; cursor: pointer; max-width: 130px; position: relative; }
.cd-tm .avatar, .cd-tm .av { width: 22px !important; height: 22px !important; font-size: 9px !important; }
.cd-tm i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); flex: none; } .cd-tm i.on { background: var(--green); }
@media (max-width: 1200px) { .cd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .cd-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .cd-sub > * { flex: 1 1 45%; border-left: 0; padding: 4px; } .cd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cd-pg { grid-template-columns: 1fr 1fr; } .cd-head h1 { font-size: 18px; } }
.lk-h { display: flex; gap: 10px; align-items: center; }
.lk-h .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
@media (max-width: 1100px) { .cs-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .cs-sub > * { flex: 1 1 45%; border-left: 0; padding: 6px 4px; } .cs-kpis { grid-template-columns: repeat(2, 1fr); } .cs-prod-g { grid-template-columns: 1fr 1fr; } }
.cd .fx-hero { min-height: 0; padding: 10px 16px 12px; margin-bottom: 8px; border-radius: 12px; }
.cd .fx-hero .page-h { margin-bottom: 0 !important; }
.cd .fx-hero .fx-cap { display: none; }
.cd .fx-hero .fx-ctl { display: none; }
@media (max-width: 760px) { .cd-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; } .cd-k { padding: 5px 6px; flex-direction: column; align-items: flex-start; gap: 0; } .cd-ki { display: none; } .cd-k b { font-size: 15px; } .cd-k div span { font-size: 9.5px; white-space: normal; line-height: 1.15; } }

/* ===== Density: tighter spacing on every page ===== */
.main { padding: 10px 12px 12px; }
.card { padding: 10px 11px; }
.card-h { margin-bottom: 7px; }
.page-h { margin-bottom: 8px; }
.grid { gap: 10px; }
.kpi { padding: 9px 11px; }
.fx-hero { padding: 12px 18px 24px; min-height: 0; margin-bottom: 8px; border-radius: 14px; }
.fx-hero .fx-cap { bottom: 5px; } .fx-hero > .fx-ctl { bottom: 5px; }
@media (max-width: 760px) { .fx-hero { padding: 12px 12px 26px; min-height: 0; } }

/* ===== Super Admin Command Centre — one screen ===== */
.sa { display: flex; flex-direction: column; height: 100%; min-height: 600px; }
.sa .page-h h1 { font-size: 19px; }
.sa-kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; flex: none; }
.sa-k { position: relative; display: flex; flex-direction: column; padding: 6px 9px 5px; border-radius: 11px; cursor: pointer; overflow: hidden; min-width: 0;
  border: 1px solid color-mix(in srgb, var(--k) 30%, var(--line)); background: linear-gradient(150deg, color-mix(in srgb, var(--k) 13%, var(--surface)), var(--surface) 80%); transition: transform .15s, box-shadow .15s; }
.sa-k:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--k) 22%, transparent); }
.sa-k .spark { position: absolute; right: 6px; bottom: 5px; width: 54px; height: 20px; opacity: .8; }
.sa-kl { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.sa-kl svg { width: 12px; height: 12px; color: var(--k); flex: none; }
.sa-k > b { font-family: var(--font-display); font-size: 20px; line-height: 1.15; color: var(--k); white-space: nowrap; }
.sa-k > b small { font-size: 10.5px; color: var(--ink-3); font-weight: 600; margin-left: 2px; }
.sa-kn { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.sa-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(260px, .95fr); gap: 8px; }
.sa-box { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow-1); }
.sa-bh { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex: none; }
.sa-bh h2 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sa-bh h2 svg { width: 15px; height: 15px; color: var(--brand); }
.sa-cnt { font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
.sa-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
/* product families on tinted panels */
.sa-fam { border-radius: 10px; padding: 6px 7px 7px; margin-bottom: 6px; border: 1px solid var(--fb); background: var(--fbg); }
.sa-fam.risk { --fc: #0d9488; --fb: color-mix(in srgb, #0d9488 30%, var(--line)); --fbg: linear-gradient(135deg, color-mix(in srgb, #0d9488 13%, var(--surface)), color-mix(in srgb, #6366f1 8%, var(--surface))); }
.sa-fam.fire { --fc: #ea580c; --fb: color-mix(in srgb, #ea580c 30%, var(--line)); --fbg: linear-gradient(135deg, color-mix(in srgb, #f97316 14%, var(--surface)), color-mix(in srgb, #ef4444 8%, var(--surface))); }
.sa-fam.env { --fc: #16a34a; --fb: color-mix(in srgb, #16a34a 30%, var(--line)); --fbg: linear-gradient(135deg, color-mix(in srgb, #22c55e 13%, var(--surface)), color-mix(in srgb, #0ea5e9 8%, var(--surface))); }
.sa-fam.hc { --fc: #7c3aed; --fb: color-mix(in srgb, #7c3aed 30%, var(--line)); --fbg: linear-gradient(135deg, color-mix(in srgb, #8b5cf6 13%, var(--surface)), color-mix(in srgb, #ec4899 7%, var(--surface))); }
.sa-fh { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--fc); margin-bottom: 4px; }
.sa-fh svg { width: 13px; height: 13px; } .sa-fh span { margin-left: auto; font-size: 10px; opacity: .8; }
.sa-fg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.sa-p { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 6px 5px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 82%, transparent); cursor: pointer; min-width: 0; overflow: hidden; }
.sa-p:hover { background: var(--surface); box-shadow: 0 2px 8px color-mix(in srgb, var(--fc) 22%, transparent); }
.sa-pi { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--pc); }
.sa-pi svg { width: 14px; height: 14px; }
.sa-p b { display: block; font-size: 11.5px; line-height: 1.2; }
.sa-p .grow > span { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.sa-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--indigo); flex: none; } .sa-dot.live { background: var(--green); } .sa-dot.roadmap { background: var(--ink-3); }
.sa-pb { position: absolute; left: 6px; right: 6px; bottom: 1px; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--fc) 15%, transparent); overflow: hidden; }
.sa-pb i { display: block; height: 100%; background: var(--fc); }
/* clients table */
.sa-t { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11.5px; }
.sa-t th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 3px 5px; border-bottom: 1px solid var(--line); z-index: 1; }
.sa-t th:nth-child(1) { width: 34%; } .sa-t th:nth-child(2) { width: 16%; } .sa-t th:nth-child(3) { width: 9%; } .sa-t th:nth-child(4) { width: 11%; }
.sa-t td { padding: 4px 5px; border-bottom: 1px solid var(--line); vertical-align: middle; min-width: 0; }
.sa-t tr { cursor: pointer; } .sa-t tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.sa-t td b, .sa-t td > span { display: block; } .sa-t td > span.ellipsis { font-size: 10px; color: var(--ink-3); }
.sa-t .num { font-variant-numeric: tabular-nums; font-size: 10.5px; }
.sa-bar { height: 5px; border-radius: 99px; background: color-mix(in srgb, var(--ink-3) 16%, transparent); overflow: hidden; margin-bottom: 1px; }
.sa-bar i { display: block; height: 100%; border-radius: 99px; } .sa-bar.green i { background: var(--green); } .sa-bar.amber i { background: var(--amber); } .sa-bar.red i { background: var(--red); } .sa-bar.indigo i { background: var(--indigo); }
.sa-plan { display: inline-block; font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--sky) 15%, transparent); color: var(--sky); }
.sa-plan.enterprise { background: color-mix(in srgb, var(--violet) 16%, transparent); color: var(--violet); } .sa-plan.professional { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
/* right column */
.sa-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; min-width: 0; }
.sa-live { flex: 1; min-height: 120px; }
.sa-lv { display: flex; align-items: center; gap: 7px; padding: 3px 2px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.sa-lv .avatar, .sa-lv .av { width: 24px !important; height: 24px !important; font-size: 9px !important; }
.sa-lv b { display: block; font-size: 11.5px; } .sa-lv b span { font-weight: 500; color: var(--ink-3); } .sa-lv .grow > span { display: block; font-size: 10px; color: var(--ink-3); }
.sa-lv > svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.sa-ch { width: 100%; height: 70px; display: block; }
.sa-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.sa-two .donut, .sa-two svg.donut { flex: none; }
.sa-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }
@media (max-width: 1280px) { .sa-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .sa { height: auto; } .sa-main { grid-template-columns: 1fr 1fr; } .sa-side { grid-column: 1 / -1; } .sa-box { max-height: 520px; } }
@media (max-width: 760px) { .sa-main { grid-template-columns: 1fr; } .sa-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sa-two { grid-template-columns: 1fr; } }

/* Stop button on Julia's bar */
#cs-jobs .jb-stop { flex: none; position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 3px; border: 1px solid rgba(255,255,255,.55); background: rgba(220, 38, 38, .35); color: #fff; border-radius: 99px; padding: 2px 9px 2px 6px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
#cs-jobs .jb-stop:hover { background: #dc2626; } #cs-jobs .jb-stop svg { width: 12px; height: 12px; }
@media (max-width: 760px) { #cs-jobs .jb-stop span { display: none; } }
/* "Julia at work" orb — always on screen while Julia works */
#cs-orb { position: fixed; left: 16px; bottom: 16px; z-index: 255; display: flex; align-items: center; gap: 10px; padding: 7px 30px 7px 7px; border-radius: 999px; cursor: pointer; max-width: min(420px, calc(100vw - 32px));
  color: #e6fffb; background: radial-gradient(120% 160% at 0% 50%, rgba(13,148,136,.55), rgba(15,23,42,.92) 60%); border: 1px solid rgba(94,234,212,.55);
  box-shadow: 0 0 0 1px rgba(99,102,241,.25), 0 10px 30px rgba(2,6,23,.45), 0 0 24px rgba(45,212,191,.35); backdrop-filter: blur(6px); animation: orb-in .35s ease; }
@keyframes orb-in { from { transform: translateY(20px) scale(.9); opacity: 0; } }
#cs-orb .orb { position: relative; width: 44px; height: 44px; flex: none; }
#cs-orb .orb i { position: absolute; inset: 0; border-radius: 50%; }
#cs-orb .core { inset: 13px !important; background: radial-gradient(circle at 35% 35%, #fff, #5eead4 35%, #0d9488 70%, #134e4a); box-shadow: 0 0 14px #2dd4bf, 0 0 28px rgba(45,212,191,.6); animation: orb-pulse 1.4s ease-in-out infinite; }
#cs-orb .r1 { inset: 4px !important; border: 1.5px solid rgba(94,234,212,.75); border-left-color: transparent; border-right-color: transparent; animation: orb-spin 1.6s linear infinite; transform-style: preserve-3d; }
#cs-orb .r2 { inset: 7px !important; border: 1.5px solid rgba(165,180,252,.85); border-top-color: transparent; border-bottom-color: transparent; animation: orb-spin 2.4s linear infinite reverse; }
#cs-orb .r3 { inset: 1px !important; background: conic-gradient(from 0deg, transparent 0 70%, rgba(94,234,212,.55) 85%, transparent 100%); animation: orb-spin 1.1s linear infinite; -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
#cs-orb .orb b { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #fde68a; box-shadow: 0 0 6px #fde68a; }
#cs-orb .e1 { animation: orb-orbit 1.3s linear infinite; } #cs-orb .e2 { background: #a5b4fc !important; box-shadow: 0 0 6px #a5b4fc !important; animation: orb-orbit 1.9s linear infinite reverse; } #cs-orb .e3 { background: #5eead4 !important; animation: orb-orbit2 2.6s linear infinite; }
#cs-orb .ring { position: absolute; inset: 0; transform: rotate(-90deg); } #cs-orb .ring circle { fill: none; stroke: #5eead4; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 125.7; transition: stroke-dashoffset .6s ease; filter: drop-shadow(0 0 3px #2dd4bf); }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-pulse { 50% { transform: scale(1.12); filter: brightness(1.25); } }
@keyframes orb-orbit { from { transform: rotate(0) translateX(19px); } to { transform: rotate(360deg) translateX(19px); } }
@keyframes orb-orbit2 { from { transform: rotate(0) translateX(15px) scale(.8); } to { transform: rotate(-360deg) translateX(15px) scale(.8); } }
#cs-orb .orb-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
#cs-orb .orb-t b { font-size: 12.5px; letter-spacing: .03em; background: linear-gradient(90deg, #5eead4, #a5b4fc, #5eead4); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: jb-sheen 2.4s linear infinite; }
#cs-orb .orb-t span { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cs-orb .orb-t em { font-style: normal; font-size: 10.5px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: "JetBrains Mono", ui-monospace, monospace; }
#cs-orb .orb-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: rgba(255,255,255,.12); color: #fff; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; line-height: 1; font-size: 13px; }
@media (max-width: 760px) { #cs-orb { left: 8px; bottom: 8px; max-width: calc(100vw - 90px); } }
@media (prefers-reduced-motion: reduce) { #cs-orb *, #cs-orb { animation: none !important; } }
/* Julia: something is missing */
.jm-h { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 14%, var(--surface)), color-mix(in srgb, var(--indigo) 10%, var(--surface))); }
.jm-orb { flex: none; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #5eead4 35%, #0d9488 70%); box-shadow: 0 0 12px #2dd4bf; animation: orb-pulse 1.6s ease-in-out infinite; }
.jm-row { display: flex; gap: 9px; padding: 8px 6px; border-top: 1px solid var(--line); }
.jm-ico { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.jm-ico svg { width: 13px; height: 13px; }
.jm-row.ok .jm-ico { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.jm-row.skip .jm-ico { background: color-mix(in srgb, var(--ink-3) 18%, transparent); color: var(--ink-3); }
.jm-row b { font-size: 13px; } .jm-row.ok b { color: var(--green); } .jm-row .btn.ghost[data-undo] { margin-top: 3px; }
.jm-no { display: inline-flex; align-items: center; gap: 4px; } .jm-no svg { width: 12px; height: 12px; }
.jd { display: flex; gap: 12px; align-items: center; }
.jd-orb { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: radial-gradient(circle at 35% 35%, #86efac, #16a34a 60%, #14532d); box-shadow: 0 0 16px rgba(34,197,94,.55); animation: orb-pulse 1.6s ease-in-out 3; }
.jd-orb svg { width: 22px; height: 22px; }
/* Julia's insights strip */
.ji { display: flex; align-items: center; gap: 8px; margin: -2px 0 8px; padding: 5px 7px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line)); background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), color-mix(in srgb, var(--indigo) 7%, var(--surface))); overflow: hidden; }
.ji-h { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; padding: 2px 4px; }
.ji-h b { font-size: 12px; } .ji-h .tiny { font-weight: 800; color: var(--brand); background: color-mix(in srgb, var(--brand) 15%, transparent); border-radius: 99px; padding: 0 6px; }
.ji-orb { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #5eead4 40%, #0d9488); box-shadow: 0 0 8px #2dd4bf; animation: orb-pulse 1.8s ease-in-out infinite; }
.ji-l { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ji-c { flex: none; display: inline-flex; align-items: center; gap: 5px; max-width: 360px; border-radius: 99px; padding: 3px 10px 3px 7px; font: inherit; font-size: 11.5px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.ji-c span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ji-c svg { width: 13px; height: 13px; flex: none; }
.ji-c.bad { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); color: var(--red); background: color-mix(in srgb, var(--red) 7%, var(--surface)); }
.ji-c.warn { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); color: color-mix(in srgb, var(--amber) 80%, var(--ink)); background: color-mix(in srgb, var(--amber) 8%, var(--surface)); }
.ji-c.ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--surface)); }
.ji-c.info svg { color: var(--brand); } .ji-c:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.ji.fold .ji-l { display: none; }
@media (max-width: 760px) { .ji { flex-wrap: wrap; } .ji-c { max-width: 80vw; } }
.pw-r { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-top: 1px solid var(--line); }
.pw-r:first-child { border-top: 0; }
.pw-i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, transparent); }
.pw-i svg { width: 15px; height: 15px; }

/* ===== Julia's lab — mission-control view ===== */
.win.xl { width: min(1320px, 96vw); }
.jx { --jx-bg: #070d1a; --jx-pan: #0c1527; --jx-line: rgba(148,163,184,.16); color: #dbeafe; background: radial-gradient(1200px 400px at 10% -10%, rgba(13,148,136,.25), transparent 60%), radial-gradient(900px 400px at 110% 0%, rgba(67,56,202,.28), transparent 60%), var(--jx-bg); margin: -14px; padding: 12px 14px 10px; min-height: calc(100% + 28px); }
.jx .muted { color: #94a3b8; } .jx .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: #a5b4fc; }
.jx-top { display: flex; align-items: center; gap: 16px; }
.jx-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.jx-badge { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--pc), color-mix(in srgb, var(--pc) 45%, #312e81)); box-shadow: 0 0 22px color-mix(in srgb, var(--pc) 55%, transparent); }
.jx-badge svg { width: 24px; height: 24px; }
.jx-name { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jx-sub { font-size: 12.5px; color: #a5f3fc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jx-step { font-size: 11.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: "JetBrains Mono", ui-monospace, monospace; }
.jx-gauge { position: relative; flex: none; width: 92px; height: 92px; }
.jx-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.jx-gauge circle { fill: none; stroke-width: 9; } .jx-gauge .bg { stroke: rgba(148,163,184,.15); } .jx-gauge .fg { stroke: url(#jxg); stroke-linecap: round; transition: stroke-dashoffset .6s ease; filter: drop-shadow(0 0 6px rgba(94,234,212,.6)); }
.jx-gauge.ok .fg { stroke: #4ade80; } .jx-gauge.bad .fg { stroke: #f87171; }
.jx-gauge > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.jx-gauge b { font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; } .jx-gauge span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: #5eead4; margin-top: 3px; }
.jx-gauge.run span { animation: jx-blink 1.4s ease-in-out infinite; } .jx-gauge.bad span { color: #fca5a5; } .jx-gauge.ok span { color: #86efac; }
@keyframes jx-blink { 50% { opacity: .35; } }
.jx-stats { flex: none; display: grid; grid-template-columns: repeat(2, minmax(86px, auto)); gap: 4px 14px; }
.jx-stats div { display: flex; flex-direction: column; } .jx-stats span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em; color: #64748b; } .jx-stats b { font-size: 13.5px; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.jx-stop { flex: none; align-self: center; }
.jx-pipe { display: flex; margin: 12px 0 10px; padding: 8px 10px; border-radius: 12px; background: rgba(15,23,42,.6); border: 1px solid var(--jx-line); }
.jx-st { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; font-size: 10.5px; color: #64748b; text-align: center; }
.jx-st::before { content: ''; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: rgba(148,163,184,.2); z-index: 0; } .jx-st:first-child::before { display: none; }
.jx-st.done::before, .jx-st.now::before { background: linear-gradient(90deg, #5eead4, #818cf8); }
.jx-st i { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 10.5px; background: #0f172a; border: 2px solid rgba(148,163,184,.35); color: #94a3b8; }
.jx-st i svg { width: 12px; height: 12px; }
.jx-st.done i { background: #0d9488; border-color: #5eead4; color: #fff; } .jx-st.done { color: #99f6e4; }
.jx-st.now i { background: #312e81; border-color: #a5b4fc; color: #fff; box-shadow: 0 0 0 4px rgba(129,140,248,.25), 0 0 14px #818cf8; animation: orb-pulse 1.3s ease-in-out infinite; } .jx-st.now { color: #fff; font-weight: 700; }
.jx-st.bad i { background: #7f1d1d; border-color: #f87171; color: #fff; }
.jx-st span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.jx-grid { display: grid; grid-template-columns: 1.15fr 1fr .8fr; grid-template-rows: 250px 150px; grid-template-areas: "scene con tl" "chart refs tl"; gap: 10px; }
.jx-grid > * { min-width: 0; min-height: 0; border-radius: 12px; border: 1px solid var(--jx-line); background: var(--jx-pan); overflow: hidden; }
.jx-scene { grid-area: scene; position: relative; background: #03141b; }
.jx-scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.jx-scene .hud { position: absolute; width: 16px; height: 16px; border-color: #5eead4; border-style: solid; opacity: .8; z-index: 2; }
.hud.tl { left: 8px; top: 8px; border-width: 2px 0 0 2px; } .hud.tr { right: 8px; top: 8px; border-width: 2px 2px 0 0; } .hud.bl { left: 8px; bottom: 8px; border-width: 0 0 2px 2px; } .hud.br { right: 8px; bottom: 8px; border-width: 0 2px 2px 0; }
.jx-live { position: absolute; left: 16px; top: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .12em; color: #fecaca; background: rgba(127,29,29,.55); padding: 2px 7px; border-radius: 4px; }
.jx-live i { width: 6px; height: 6px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 6px #ef4444; animation: jx-blink 1s infinite; }
.jx-hud { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2; display: flex; flex-direction: column; text-shadow: 0 1px 6px #000; }
.jx-hud b { font-size: 13px; color: #fff; } .jx-hud span { font-size: 10.5px; color: #a5f3fc; font-family: "JetBrains Mono", ui-monospace, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jx-h { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #e2e8f0; margin-bottom: 6px; white-space: nowrap; min-width: 0; }
.jx-h svg { width: 14px; height: 14px; color: #5eead4; flex: none; } .jx-h .muted { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.jx-con, .jx-tl, .jx-chart, .jx-refs { padding: 8px 10px; display: flex; flex-direction: column; }
.jx-con { grid-area: con; } .jx-con .jl-stream { flex: 1; }
.jx-tl { grid-area: tl; }
.jx-tl ol { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 2px solid rgba(94,234,212,.25); overflow: auto; flex: 1; min-height: 0; scrollbar-width: thin; }
.jx-tl li { position: relative; font-size: 11px; color: #cbd5e1; padding: 2px 0 5px; line-height: 1.35; }
.jx-tl li::before { content: ''; position: absolute; left: -17px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: #0d9488; border: 2px solid var(--jx-pan); }
.jx-tl li span { display: block; font-size: 9.5px; color: #64748b; font-family: "JetBrains Mono", ui-monospace, monospace; }
.jx-tl li.now { color: #fff; font-weight: 600; } .jx-tl li.now::before { background: #818cf8; box-shadow: 0 0 8px #818cf8; animation: orb-pulse 1.3s infinite; }
.jx-q { margin: 0; padding-left: 20px; font-size: 11px; color: #94a3b8; } .jx-q li { margin: 1px 0; }
.jx-chart { grid-area: chart; } .jx-chart canvas { flex: 1; width: 100%; min-height: 0; }
.jx-refs { grid-area: refs; }
.jx-chips { display: flex; flex-wrap: wrap; gap: 4px; } .jx-chips span { font-size: 10.5px; padding: 2px 8px; border-radius: 99px; color: #c7d2fe; background: rgba(99,102,241,.16); border: 1px solid rgba(129,140,248,.3); }
.jx-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: auto; }
.jx-tiles div { border-radius: 9px; background: rgba(15,23,42,.7); border: 1px solid var(--jx-line); padding: 5px 7px; display: flex; flex-direction: column; }
.jx-tiles b { font-size: 17px; color: #5eead4; font-variant-numeric: tabular-nums; } .jx-tiles span { font-size: 9.5px; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.jx-foot { margin-top: 8px; font-size: 10.5px; color: #64748b; display: flex; align-items: center; gap: 5px; } .jx-foot svg { width: 12px; height: 12px; }
.jx .jl-why { color: var(--ink); background: var(--surface); }
@media (max-width: 1000px) { .jx-grid { grid-template-columns: 1fr 1fr; grid-template-rows: 220px 220px 150px; grid-template-areas: "scene con" "tl tl" "chart refs"; } .jx-stats { display: none; } }
@media (max-width: 760px) { .jx-top { flex-wrap: wrap; gap: 10px; } .jx-id { flex-basis: 100%; } .jx-gauge { width: 72px; height: 72px; } .jx-stats { display: grid; } .jx-grid { grid-template-columns: 1fr; grid-template-rows: 170px 220px auto 120px auto; grid-template-areas: "scene" "con" "tl" "chart" "refs"; } .jx-tl ol { max-height: 200px; } .jx-st span { display: none; } .jx-st.now span { display: block; position: absolute; top: 26px; white-space: nowrap; } .jx-pipe { padding-bottom: 22px; } }
@media (max-width: 760px) { .jx { margin: -12px; } }
#jl-queue { flex: none; max-height: 45%; overflow: auto; scrollbar-width: thin; }
body:has(.jx) #cs-orb { display: none; }
