/* TUHI'S DASHBOARD STYLESHEET — copied VERBATIM from Tuhi src/admin/ui/index.html (its <style> block, lines 8–722).
   Do not edit it to "improve" anything: the console must look exactly like Tuhi. BrainTrust-only chrome (account menu,
   tenant switcher, environment badge, the light palette) lives in tuhi-shell.css. */
      :root { --bg:#0f1115; --card:#1a1d24; --fg:#e6e9ef; --mut:#8a93a6; --acc:#4f8cff; --ok:#34c759; --warn:#ff9f0a; --err:#ff453a; --bd:#272b34; }
      * { box-sizing: border-box; }
      body { margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; background:var(--bg); color:var(--fg); }
      header { padding:16px 24px; border-bottom:1px solid var(--bd); display:flex; align-items:center; gap:12px; }
      header h1 { font-size:16px; margin:0; font-weight:600; }
      .badge { font-size:11px; padding:2px 8px; border-radius:99px; background:#23344f; color:var(--acc); }
      nav { display:flex; gap:4px; padding:8px 24px; border-bottom:1px solid var(--bd); flex-wrap:wrap; }
      nav { flex-wrap:nowrap; align-items:center; }
      nav button { background:none; border:none; color:var(--mut); padding:8px 12px; border-radius:8px; cursor:pointer; font-size:13px; white-space:nowrap; }
      nav button.active { background:var(--card); color:var(--fg); }
      .navgroup { position:relative; display:inline-block; }
      .navmenu { position:absolute; top:calc(100% + 4px); left:0; background:var(--card); border:1px solid var(--bd); border-radius:10px; padding:5px; min-width:170px; z-index:60; display:none; box-shadow:0 10px 30px rgba(0,0,0,.45); }
      .navmenu.open { display:block; }
      .navmenu button { display:block; width:100%; text-align:left; }
      .navmenu button:hover { background:var(--bg); color:var(--fg); }
      /* OUTER page container stays inset (~80% of the window, centred) — the full-width work was for the INNER
         content (forms/chips/textareas fill their card), NOT for pushing cards out to the window edges.
         Below 1100px the inset is dropped so narrow panes still use the space they have. */
      main { padding:24px; width:80%; max-width:1720px; margin:0 auto; }
      @media (max-width:1100px){ main, #opbar { width:auto; } }
      .grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:12px; }
      .card { background:var(--card); border:1px solid var(--bd); border-radius:12px; padding:16px; }
      /* Storage breakdown — one card, one compact block per capability (label · size · proportional bar).
         The inner auto-fill grid keeps ~10 modules to 2-3 short rows instead of one tall column. */
      .stggrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:10px 18px; }
      .stgrow { display:flex; align-items:baseline; gap:8px; font-size:12px; }
      .stgname { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--mut); }
      .stgval { flex:none; font-weight:600; font-variant-numeric:tabular-nums; }
      .stgbar { height:4px; border-radius:99px; background:var(--bd); overflow:hidden; margin-top:4px; }
      .stgbar > i { display:block; height:100%; border-radius:99px; background:var(--acc); }
      /* Routines cards — uniform, scannable, equal-height (steps collapse so no card becomes a wall of text). */
      .rcard{display:flex;flex-direction:column;gap:9px;padding:15px}
      .rcard-head{display:flex;align-items:flex-start;gap:8px}
      .rcard .rname{font-size:14px;font-weight:600;margin:0;line-height:1.3;text-transform:capitalize;letter-spacing:.2px}
      .rcard .rbadges{margin-left:auto;display:flex;gap:5px;flex-wrap:wrap;flex:none}
      .rcard .rbadges .badge{font-size:9.5px;padding:2px 7px}
      .rkindrow{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:-2px}
      .rkind{font-size:9px;font-weight:700;letter-spacing:.7px;padding:2px 7px;border-radius:99px}
      .rkind.broad{background:#16281a;color:#5fbf6a}
      .rkind.specific{background:#16243a;color:#5c9bff}
      .rtags{display:flex;flex-wrap:wrap;gap:4px}
      .rtags .badge{font-size:10px;background:#1a1f29;color:#9fb0c8}
      .rdesc{font-size:12.5px;line-height:1.5;color:var(--mut);margin:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
      .rsteps{font-size:12px;border-top:1px solid var(--bd);padding-top:8px;margin-top:1px}
      .rsteps>summary{cursor:pointer;list-style:none;color:var(--acc);font-weight:500;font-size:11.5px;display:flex;align-items:center;gap:6px;user-select:none}
      .rsteps>summary::-webkit-details-marker{display:none}
      .rsteps>summary::before{content:"▸";display:inline-block;transition:transform .15s}
      .rsteps[open]>summary::before{transform:rotate(90deg)}
      .rsteps ol{margin:8px 0 2px;padding-left:18px;color:var(--mut);line-height:1.55}
      .rsteps li{margin-bottom:5px}
      .rcard .ractions{margin-top:auto;display:flex;gap:6px;flex-wrap:wrap;padding-top:6px}
      .rstepn{white-space:nowrap;flex:none}
      .rneeds{font-size:10.5px;color:var(--mut);opacity:.75;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
      .card h3 { margin:0 0 8px; font-size:13px; color:var(--mut); font-weight:500; }
      .stat { font-size:24px; font-weight:600; }
      .dot { width:8px; height:8px; border-radius:99px; display:inline-block; margin-right:6px; }
      /* These three are STATUS-LIGHT fills — for the 8px dot, and only for it. Used on a span of TEXT (which is
         how every connect/verify message on this page is written) a solid --err fill behind the default light
         type is the unreadable red slab the owner reported. So the fill is scoped to .dot, and the same three
         names get a proper MESSAGE face below: coloured type on a tint of its own colour, in a padded pill. */
      .dot.ok{background:var(--ok)} .dot.warn{background:var(--warn)} .dot.err{background:var(--err)}
      .ok:not(.dot),.warn:not(.dot),.err:not(.dot){ display:inline-block; padding:6px 10px; border-radius:8px;
        font-size:12.5px; line-height:1.55; font-weight:600; max-width:100%; }
      .ok:not(.dot){ color:#7ee2a0; background:rgba(52,199,89,.12); border:1px solid rgba(52,199,89,.35); }
      .warn:not(.dot){ color:#ffc46b; background:rgba(255,159,10,.12); border:1px solid rgba(255,159,10,.35); }
      .err:not(.dot){ color:#ff9d96; background:rgba(255,69,58,.12); border:1px solid rgba(255,69,58,.40); }
      td .ok:not(.dot),td .warn:not(.dot),td .err:not(.dot){ padding:2px 8px; font-size:11.5px; }
      table { width:100%; border-collapse:collapse; font-size:13px; }
      th,td { text-align:left; padding:8px; border-bottom:1px solid var(--bd); }
      button.act { background:var(--acc); color:#fff; border:none; padding:8px 14px; border-radius:8px; cursor:pointer; font-size:13px; }
      button.ico { background:#23252e; color:#cfd6e6; border:1px solid #3a3d49; padding:3px 9px; border-radius:6px; cursor:pointer; font-size:11px; }
      button.ico:hover { color:#fff; border-color:var(--acc); }
      /* THE SELECTED RANGE HAS TO LOOK SELECTED. `button.ico` had no `.active` rule anywhere in this file,
         so every toolbar that marks its current choice with `class="ico active"` — the Data Flow chart's
         range and Line/Area/Bar switches, and the Onboarded Intelligence chart's range — rendered the
         selection identically to the three buttons beside it. `.active` is only ever put on an `.ico` by
         those toolbars, so the rule is safe to state once, here, rather than per-screen. */
      button.ico.active { background:var(--acc); border-color:var(--acc); color:#fff; }
      .chips { display:flex; flex-wrap:wrap; gap:6px; }
      button.chip { background:#1a1d25; color:#aeb6c6; border:1px solid #2f3442; padding:4px 11px; border-radius:99px; cursor:pointer; font-size:12px; }
      button.chip:hover { border-color:var(--acc); color:#fff; }
      button.chip.on { background:var(--acc); color:#fff; border-color:var(--acc); }
      button.chip .muted { opacity:.7; }
      button.chip.on .muted { color:#dbe6ff; }
      button.chip.off { opacity:.32; cursor:default; border-style:dashed; }
      button.chip.off:hover { border-color:#2f3442; color:#aeb6c6; }
      button.chip.clear { background:#2a2030; color:#e7b3c8; border-color:#5a3550; }
      /* Links: lighter blue so they're readable on the dark background */
      a { color:#7eb6ff; text-decoration:underline; text-underline-offset:2px; }
      a:hover { color:#a9ccff; }
      /* Click animation + loading spinner on every button/CTA */
      button { transition: transform .07s ease, opacity .15s ease, filter .15s ease; }
      button:active:not(:disabled) { transform: scale(.95); filter: brightness(.92); }
      button:disabled { opacity:.55; cursor:default; }
      button.loading { color:transparent !important; pointer-events:none; position:relative; }
      button.loading::after { content:""; position:absolute; left:50%; top:50%; width:14px; height:14px; margin:-7px 0 0 -7px;
            border:2px solid rgba(255,255,255,.35); border-top-color:#fff; border-radius:99px; animation:spin .65s linear infinite; }
      input,select,textarea { background:#0c0e12; border:1px solid var(--bd); color:var(--fg); padding:8px; border-radius:8px; font-size:13px; font-family:inherit; }
      textarea { line-height:1.55; }
      textarea::placeholder,input::placeholder { color:var(--mut); }
      pre#logs { background:#0a0c10; border:1px solid var(--bd); border-radius:8px; padding:12px; height:380px; overflow:auto; font-size:12px; }
      .hidden{display:none}
      img#qr{background:#fff; padding:8px; border-radius:8px; max-width:260px}
      img.qr{background:#fff; padding:8px; border-radius:8px; max-width:240px; display:block; margin:8px 0}
      .muted{color:var(--mut); font-size:12px}
      /* Big Green/Yellow/Red status indicator */
      .bigdot{width:16px;height:16px;border-radius:99px;display:inline-block;flex:0 0 auto;
              box-shadow:0 0 0 4px rgba(255,255,255,.05); animation:pulse 2s infinite}
      @keyframes pulse{0%{box-shadow:0 0 0 0 rgba(255,255,255,.12)}70%{box-shadow:0 0 0 8px rgba(255,255,255,0)}100%{box-shadow:0 0 0 0 rgba(255,255,255,0)}}
      .hero{display:flex;align-items:center;gap:14px;background:var(--card);border:1px solid var(--bd);
            border-radius:12px;padding:18px;margin-bottom:12px}
      .hero .htitle{font-size:18px;font-weight:600}
      .legend{display:flex;gap:16px;margin-left:auto;font-size:12px;color:var(--mut);flex-wrap:wrap}
      .legend span{display:inline-flex;align-items:center;gap:6px}
      .legend i{width:10px;height:10px;border-radius:99px;display:inline-block}
      .steps{counter-reset:s;list-style:none;padding:0;margin:8px 0 0}
      .steps li{counter-increment:s;position:relative;padding:6px 0 6px 30px;font-size:13px;border-bottom:1px solid var(--bd)}
      .steps li:last-child{border-bottom:none}
      .steps li::before{content:counter(s);position:absolute;left:0;top:6px;width:20px;height:20px;border-radius:99px;
            background:var(--acc);color:#fff;font-size:11px;display:flex;align-items:center;justify-content:center}
      code.k{background:#0c0e12;border:1px solid var(--bd);border-radius:6px;padding:1px 6px;font-size:12px}
      .live{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--mut);text-transform:uppercase;letter-spacing:.06em}
      .live i{width:8px;height:8px;border-radius:99px;background:var(--ok);display:inline-block;animation:blink 2s infinite}
      .live.stale i{background:var(--err);animation:none}
      @keyframes blink{0%,100%{opacity:1}50%{opacity:.25}}
      button.ghost{background:none;border:1px solid var(--bd);color:var(--fg);padding:6px 12px;border-radius:8px;cursor:pointer;font-size:13px}
      button.ghost:hover{background:var(--card)}
      button.ghost.spin{opacity:.6;pointer-events:none}
      button.ghost.spin::before{content:"";display:inline-block;width:11px;height:11px;margin-right:6px;border:2px solid var(--mut);border-top-color:var(--acc);border-radius:99px;animation:spin .7s linear infinite;vertical-align:-1px}
      @keyframes spin{to{transform:rotate(360deg)}}
      .inlspin{display:inline-block;width:12px;height:12px;border:2px solid var(--mut);border-top-color:var(--acc);border-radius:99px;animation:spin .7s linear infinite;vertical-align:-2px;margin-right:7px}
      /* Instant page preloader — shown the moment a nav link is clicked, before the screen's data resolves. */
      .viewload{display:flex;align-items:center;justify-content:center;min-height:55vh;animation:vlfade .15s ease-in}
      .viewload i{display:block;width:34px;height:34px;border:3px solid var(--bd,rgba(255,255,255,.12));border-top-color:var(--acc);border-radius:50%;animation:spin .7s linear infinite}
      @keyframes vlfade{from{opacity:0}to{opacity:1}}
      /* Overview cards: a shaped skeleton for a value that has genuinely never been fetched (cold first-ever
         open only — a warm open paints real numbers from cache), and a quiet ⟳ when a card's last refresh
         failed and it is showing its last known value. Neither is ever a full-screen spinner. */
      .ovskel{display:inline-block;height:1em;min-width:48px;border-radius:6px;vertical-align:-2px;color:transparent;
        background:linear-gradient(90deg,rgba(255,255,255,.05),rgba(255,255,255,.13),rgba(255,255,255,.05));
        background-size:220% 100%;animation:ovsk 1.15s linear infinite}
      @keyframes ovsk{from{background-position:120% 0}to{background-position:-120% 0}}
      .ovstale{font-size:10.5px;opacity:.5;cursor:help}
      /* ---- Settings form polish (TechTo) ---- */
      .lead{font-size:14px;line-height:1.6;color:#c2c9d6;margin:0}
      .card .eyebrow{font-size:11px;letter-spacing:.07em;text-transform:uppercase;color:var(--mut);font-weight:600;margin:0 0 14px}
      .note{display:flex;gap:9px;align-items:flex-start;background:#12161d;border:1px solid var(--bd);border-radius:10px;padding:11px 13px;font-size:12.5px;line-height:1.55;color:#aab2c2;margin-top:14px}
      .note .ni{flex:none;margin-top:1px}
      /* ── SETTINGS WIDTH (global, one place) ────────────────────────────────────────────────────────
         Every settings screen is built on .form/.frow, and .form used to cap ALL of them at 640px — on a
         2000px window that left half the screen empty while chip rows wrapped 3 per line. The cap is gone:
         `main`'s own max-width already gives the page its margins. Readability is protected where it
         actually matters — PROSE is capped, and short single-value controls stay short (a name field
         1300px wide isn't "using the space") — while the things that were being squeezed (chip groups,
         textareas, lists, multi-value rows) now get the whole content column. */
      .form{max-width:none;width:100%}
      .form .lead,.form>p.muted,.form .note,.frow .fhint{max-width:860px}
      .frow{display:grid;grid-template-columns:230px minmax(0,1fr);gap:18px;align-items:center;padding:15px 0;border-bottom:1px solid var(--bd)}
      /* Narrow pane / split view: stack the label above its control rather than crushing both. */
      @media (max-width:820px){ .frow{grid-template-columns:1fr;gap:8px} }
      .frow:first-child{padding-top:2px}
      .frow:last-child{border-bottom:none;padding-bottom:2px}
      .frow.top{align-items:flex-start}
      .flabel{font-size:14px;font-weight:600;color:var(--fg)}
      .fhint{font-size:11.5px;color:var(--mut);margin-top:3px;line-height:1.45}
      .frow .flabel{font-size:13.5px;font-weight:500;color:var(--fg)}
      .frow .fhint{font-size:11.5px;color:var(--mut);margin-top:3px;line-height:1.4}
      .ctl{width:100%;max-width:420px}
      /* Multi-value / free-text controls take the full content column — they are the ones that were cramped. */
      textarea.ctl,select[multiple].ctl,.ctl.wide,.frow .chipwrap,.frow .chips,.frow .chipwrap .chips{max-width:none}
      /* Clipped textareas: entered content was being sliced mid-line at ~2.5 rows. Floor them, let them be
         dragged taller, and let JS grow them to their content up to a cap (see autoGrowTextarea). */
      textarea.ctl{max-width:none;line-height:1.6;padding:11px 13px;min-height:104px;resize:vertical;overflow-y:auto}
      select.ctl{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238a93a6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 11px center;padding-right:30px}
      .ctl:focus{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px rgba(79,140,255,.18)}
      .ctl.invalid{border-color:#ff5d5d}
      .ctl.invalid:focus{border-color:#ff5d5d;box-shadow:0 0 0 3px rgba(255,93,93,.18)}
      .ferr{color:#ff8585;font-size:11.5px;margin-top:5px;line-height:1.35}
      /* Looks — avatar wardrobe grid */
      .looksGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(126px,1fr));gap:12px}
      .lookTile{position:relative;display:block;aspect-ratio:1;border-radius:14px;overflow:hidden;background:#1a1f2b;border:1px solid var(--bd);cursor:pointer}
      .lookTile img{width:100%;height:100%;object-fit:cover;display:block}
      .lookDel{position:absolute;top:7px;left:7px;z-index:3;width:22px;height:22px;line-height:1;padding:0;
        border-radius:7px;border:1px solid rgba(255,255,255,.22);background:rgba(12,14,20,.72);color:#fff;
        font-size:11px;cursor:pointer;opacity:0;transition:opacity .12s}
      .lookTile:hover .lookDel,.lookDel:focus{opacity:1}
      .lookDel:hover{background:#b3261e;border-color:#b3261e}
      .lookTile>input{position:absolute;top:7px;right:7px;width:21px;height:21px;accent-color:var(--acc);cursor:pointer;margin:0;z-index:2}
      .lookTile:has(input:not(:checked)){opacity:.42}
      .lookTile:has(input:checked){border-color:var(--acc);box-shadow:0 0 0 1px var(--acc)}
      .lookTile .lookCat{position:absolute;left:6px;right:6px;bottom:6px;font-size:11px;line-height:1.2;padding:3px 6px;border-radius:8px;
        background:rgba(10,13,20,.82);color:#e6e9ef;border:1px solid rgba(255,255,255,.2);cursor:pointer;opacity:0;transition:opacity .12s;z-index:3;appearance:none;-webkit-appearance:none}
      .lookTile:hover .lookCat,.lookTile:focus-within .lookCat{opacity:1}
      .lookTile .lookCat option{background:#161b26;color:#e6e9ef}
      /* chip multi-select (Focus) */
      .chipwrap{position:relative;width:100%}
      .chipwrap .chips{display:flex;flex-wrap:wrap;gap:6px}
      .fchip{display:inline-flex;align-items:center;gap:6px;background:rgba(79,140,255,.14);border:1px solid rgba(79,140,255,.5);color:#dfe7ff;border-radius:99px;padding:4px 6px 4px 11px;font-size:12.5px}
      .fchip button{background:none;border:none;color:#9fb4e6;cursor:pointer;font-size:14px;line-height:1;padding:0 2px}
      .fchip button:hover{color:#fff}
      .chipin{width:100%;margin-top:8px;background:#0c0e12;border:1px solid var(--bd);color:var(--fg);padding:8px;border-radius:8px;font-size:13px}
      .chipin:focus{outline:none;border-color:var(--acc);box-shadow:0 0 0 3px rgba(79,140,255,.18)}
      .chipwrap.invalid .chipin{border-color:#ff5d5d}
      .chipmenu{position:absolute;left:0;right:0;z-index:30;margin-top:4px;background:#11141b;border:1px solid #2a2f3a;border-radius:9px;max-height:230px;overflow:auto;box-shadow:0 10px 30px rgba(0,0,0,.5)}
      .chipgrp{font-size:10.5px;text-transform:uppercase;letter-spacing:.04em;color:#7c8699;padding:7px 11px 3px;position:sticky;top:0;background:#11141b}
      .chipopt{padding:7px 11px;font-size:13px;cursor:pointer;color:#d7dce6}
      .chipopt:hover{background:rgba(79,140,255,.16)}
      /* collapsible card */
      details.collapse > summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:8px;user-select:none}
      details.collapse > summary::-webkit-details-marker{display:none}
      details.collapse > summary::before{content:"▸";font-size:11px;color:#7c8699;transition:transform .15s}
      details.collapse[open] > summary::before{transform:rotate(90deg)}
      details.collapse > summary:hover{color:var(--fg)}
      .collbody{margin-top:14px}
      /* note rows */
      .noteRow{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:11px 2px;border-bottom:1px solid var(--bd)}
      .noteRow:last-child{border-bottom:none}
      .noteRow .nbtn{flex:none;background:none;border:1px solid transparent;color:#8a93a6;cursor:pointer;font-size:14px;line-height:1;border-radius:7px;padding:4px 8px;transition:.15s}
      .noteRow .nbtn:hover{color:#ff8585;border-color:#3a3d49;background:rgba(255,93,93,.08)}
      .noteRow.rem{border-left:2px solid rgba(79,140,255,.5);padding-left:10px;border-radius:2px}
      /* notepad — A4 pages in a horizontal scroll/flip carousel */
      /* real page flip — top-bound (spiral) pad: pages turn up & over the top binding */
      .padstage{position:relative;perspective:2600px;perspective-origin:50% 0;padding:6px 0 2px}
      /* Pop-out: the notepad fills the viewport as a focused full-height overlay; Esc or the button pops in. */
      .padstage.popped{position:fixed;inset:52px 20px 20px 20px;z-index:9000;margin:0;padding:16px;background:rgba(6,8,12,.62);backdrop-filter:blur(3px);border-radius:12px;overflow:auto;perspective:none}
      .padstage.popped .pad{min-height:calc(100vh - 120px)}
      .padstage.flipping{overflow:visible}
      .pad{width:100%;min-height:540px;display:flex;flex-direction:column;background:#fbf7ea;color:#23211c;border-radius:4px 4px 0 0;box-shadow:0 18px 50px rgba(0,0,0,.55);position:relative;overflow:hidden;font-family:var(--note-font,"Noteworthy","Marker Felt","Bradley Hand","Segoe Print",cursive)}
      .flipper{position:absolute;top:0;left:0;width:100%;z-index:3;transform-origin:top center;transform-style:preserve-3d;backface-visibility:hidden;will-change:transform}
      .flipper .pad{box-shadow:0 22px 55px rgba(0,0,0,.5)}
      .flipper.out{transform:rotateX(0deg);transition:transform .55s cubic-bezier(.45,.05,.25,1)}
      .flipper.out.go{transform:rotateX(-174deg)}
      .flipper.in{transform:rotateX(-174deg);transition:transform .55s cubic-bezier(.45,.05,.25,1)}
      .flipper.in.go{transform:rotateX(0deg)}
      /* subtle shading on the turning page so it reads as paper catching light */
      .flipper::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(to top,rgba(0,0,0,.28),rgba(0,0,0,0) 45%);opacity:0;transition:opacity .55s}
      .flipper.out.go::after,.flipper.in::after{opacity:1}
      .flipper.in.go::after{opacity:0}
      .pad .spiral{height:24px;background:#d4cbb0;display:flex;gap:20px;align-items:center;justify-content:center;border-bottom:1px solid #b6aa88}
      .pad .spiral i{width:9px;height:9px;border-radius:50%;background:#15161b;box-shadow:inset 0 -2px 2px rgba(255,255,255,.3)}
      .pad .padhead{display:flex;align-items:center;justify-content:space-between;padding:14px 22px 6px 58px;font-size:19px;color:#3a362c}
      .pad .tearbtn{font-family:system-ui;font-size:12px;color:#a06a4a;background:rgba(180,80,40,.08);border:1px solid rgba(180,80,40,.25);border-radius:7px;padding:4px 10px;cursor:pointer;transition:.15s}
      .pad .tearbtn:hover{background:rgba(180,80,40,.16);color:#8a4a2a;border-color:rgba(180,80,40,.45)}
      .pad.tearing{animation:tearoff .34s cubic-bezier(.4,.1,.7,.9) forwards;transform-origin:top center}
      @keyframes tearoff{0%{transform:none;opacity:1}55%{transform:translateY(-10px) rotate(-1.5deg)}100%{transform:translateY(-70px) rotate(-3deg);opacity:0}}
      .pad .padbody{position:relative;flex:1;padding:6px 20px 24px 58px;background-image:repeating-linear-gradient(transparent,transparent 33px,#cfe0ea 34px)}
      .pad .padbody::before{content:"";position:absolute;top:0;bottom:0;left:44px;width:2px;background:rgba(200,80,80,.45)}
      .padln{position:relative;min-height:34px;line-height:34px;font-size:15px;color:#23211c;display:flex;align-items:flex-start;gap:10px;padding-right:22px}
      .padln .ptime{flex:0 0 auto;min-width:60px;font-family:system-ui;font-size:11px;color:#9a7b4a;line-height:34px}
      .padln .padcreated{position:absolute;left:-54px;width:40px;text-align:right;font-family:system-ui;font-size:10px;color:#a98c5a;line-height:34px;opacity:.8;pointer-events:none}
      .padln .picon{flex:0 0 auto;font-size:15px;line-height:34px;margin-right:2px}
      /* Prominent sub-page links on a canvas note: big font + icon, full width, word-wrap */
      .subpagelink{display:flex;align-items:center;gap:11px;width:100%;box-sizing:border-box;font-family:-apple-system,system-ui,"Segoe UI",sans-serif;font-size:15.5px;font-weight:600;color:#1e5fc4;text-decoration:none;border:2px solid #4a8be0;border-radius:12px;padding:12px 16px;background:#eaf1fc;white-space:normal;word-break:break-word;line-height:1.35;transition:background .15s,border-color .15s,box-shadow .15s;cursor:pointer}
      .subpagelink:hover{background:#dcebfb;border-color:#1e5fc4;box-shadow:0 3px 10px rgba(30,95,196,.18)}
      .subpagelink .spttl{flex:1 1 auto;min-width:0}
      .subpagelink .sparr{flex:0 0 auto;font-size:19px;opacity:.7}
      .padln .pt{flex:1;white-space:pre-wrap;word-break:break-word;min-width:0}
      .padln .pt a{color:#2b6fd6;text-decoration:underline}
      .padln.clamp .pt{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer}
      .padln.clamp.open .pt{display:block;-webkit-line-clamp:none}
      .padln.clamp .pt::after{content:" …";color:#9a7b4a;font-family:system-ui}
      .padln.clamp.open .pt::after{content:""}
      .padln.padadd-row{cursor:text}
      .padln .padadd{flex:1;min-width:0;border:none;background:transparent;outline:none;font-family:inherit;font-size:15px;color:#23211c;line-height:34px;height:34px;padding:0;caret-color:#2a2a28}
      .padln .padadd::placeholder{color:#b8ae92;font-style:italic}
      .padln .padmic{flex:none;border:none;background:transparent;cursor:pointer;font-size:15px;line-height:1;padding:4px 6px;border-radius:8px;opacity:.6;transition:opacity .15s,background .15s}
      .padln .padmic:hover{opacity:1;background:rgba(0,0,0,.06)}
      .padln .padmic.rec{opacity:1;color:#d23b3b;animation:padmicpulse 1s ease-in-out infinite}
      @keyframes padmicpulse{0%,100%{transform:scale(1)}50%{transform:scale(1.18)}}
      .padln.addlink{cursor:pointer}
      .padln.addlink .addhint{color:#a98c5a;font-size:15px;transition:.15s}
      .padln.addlink:hover .addhint{color:#7c5e2e}
      /* Row actions live in ONE compact cluster, revealed on hover — they never clutter the resting note
         (only the tag pill stays visible). Keeping them together also stops them wrapping onto their own lines. */
      .padln .padacts{flex:0 0 auto;display:inline-flex;align-items:flex-start;gap:1px;white-space:nowrap;opacity:0;transition:opacity .13s}
      .padln:hover .padacts,.padln:focus-within .padacts{opacity:1}
      .padln .px{flex:0 0 auto;border:none;background:none;color:#a97b52;cursor:pointer;font-size:17px;transition:color .13s;font-family:system-ui;line-height:34px}
      .padln .px:hover{color:#c0392b}
      .padln .pcopy{flex:0 0 auto;border:none;background:none;color:#a2814f;cursor:pointer;font-size:14px;transition:color .13s;font-family:system-ui;line-height:34px;padding:0 2px}
      .padln .ptag{flex:0 0 auto;border:none;background:none;color:#a5762f;cursor:pointer;font-size:17px;transition:color .13s;font-family:system-ui;line-height:34px;padding:0 3px}
      .padln .ptag:hover,.padln .pcopy:hover{color:#7c5e2e}
      .padln.done .pt{text-decoration:line-through;opacity:.55}
      /* #51 — structured sourced note: headline + per sub-line rows (action, source-of-truth) */
      .padln .pt.ptstruct{white-space:normal;line-height:1.5;padding-top:5px}
      .ptstruct .pthead{font-weight:600;color:#23211c;margin-bottom:2px}
      .ptstruct .subln{display:flex;align-items:center;gap:7px;padding:1px 0;font-size:13.5px;color:#4a4536}
      .ptstruct .subln .subt{flex:1;min-width:0;word-break:break-word}
      .ptstruct .subln.act .subt{color:#a2381f;font-weight:600}
      .ptstruct .subln.act .subt::before{content:"→ ";color:#c05a2f}
      .ptstruct .subln.src{font-size:12px;color:#8a7f68}
      .ptstruct .subln .subm{flex:0 0 auto;border:none;background:none;color:#a5762f;cursor:pointer;font-size:14px;font-family:system-ui;line-height:1;padding:0 2px;opacity:0;transition:opacity .13s}
      .padln:hover .ptstruct .subln .subm,.ptstruct .subln:hover .subm{opacity:.85}
      .ptstruct .subln .subm:hover{color:#7c5e2e;opacity:1}
      .srcchip{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;border:1px solid #e0d3bd;background:#faf5ea;color:#7a6a4a;border-radius:11px;padding:1px 8px;font-size:11px;font-family:system-ui;cursor:pointer;transition:.13s;white-space:nowrap}
      .srcchip:hover{background:#f2e6cf;border-color:#d0bd9e;color:#5a4a2a}
      .srcchip .sci{font-size:11px}
      .srcchip .scv{color:#b0491f;font-weight:600}
      .notemenu .nm-row.danger{color:#c0392b}
      .notemenu .nm-row.danger:hover{background:#fbe9e7}
      .tagchip{display:inline-block;font-size:8.5px;font-weight:700;font-family:system-ui;padding:1px 6px;border-radius:10px;vertical-align:middle;letter-spacing:.02em;text-transform:uppercase}
      .t-important{background:#fcdede;color:#b3261e}.t-urgent{background:#ffe6cc;color:#b35a00}.t-followup{background:#dce8fb;color:#1b4fa0}.t-working{background:#d2eef0;color:#0f6b73}.t-waiting{background:#e6e3da;color:#6b6256}.t-hold{background:#f3e7c6;color:#8a6a17}.t-postponed{background:#efe1d6;color:#7a5230}.t-reminder{background:#ecdcfb;color:#6b2fb3}.t-completed{background:#d8f0dd;color:#1f7a3d}.t-idea{background:#fdf0c4;color:#8a6a00}.t-delegate{background:#d8e7fb;color:#25549e}.t-reference{background:#e3e6ec;color:#4a5162}.t-ignore{background:#e9e6e2;color:#736b60}
      /* tight tag label next to the dropdown */
      .padln .ptaglbl{flex:0 0 auto;align-self:center;font-size:8.5px;font-weight:700;font-family:system-ui;padding:1px 5px;border-radius:5px;text-transform:uppercase;letter-spacing:.03em;line-height:1.5}
      /* subtle row tint by tag (no big inline chip) */
      .padln.tag-important{background:rgba(179,38,30,.07)}.padln.tag-urgent{background:rgba(179,90,0,.09)}
      .padln.tag-followup{background:rgba(27,79,160,.07)}.padln.tag-working{background:rgba(15,107,115,.08)}
      .padln.tag-waiting{background:rgba(107,98,86,.06)}.padln.tag-hold{background:rgba(138,106,23,.09)}
      .padln.tag-postponed{background:rgba(122,82,48,.07)}.padln.tag-reminder{background:rgba(107,47,179,.07)}
      .padln.tag-completed{background:rgba(31,122,61,.08)}
      .padln.tag-idea{background:rgba(138,106,0,.08)}.padln.tag-delegate{background:rgba(37,84,158,.07)}.padln.tag-reference{background:rgba(74,81,98,.06)}
      .padln.tag-ignore{background:rgba(115,107,96,.06)}.padln.tag-ignore .pt{opacity:.45;text-decoration:line-through}
      .notesep{display:flex;align-items:center;gap:10px;margin:16px 0 8px;padding-right:22px}
      .notesep .notesep-l{flex:1;height:1px;background:rgba(160,140,90,.4)}
      .notesep .notesep-t{flex:0 0 auto;font-family:system-ui;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:#9c7f45}
      .appicn{width:15px;height:15px;vertical-align:-3px;border-radius:3px;margin-right:2px;box-shadow:0 0 0 .5px rgba(0,0,0,.06)}
      .notemenu{z-index:10000;background:#fff;border:1px solid #ddd;border-radius:10px;box-shadow:0 12px 36px rgba(0,0,0,.22);padding:8px;min-width:200px;font-family:system-ui}
      .notemenu .nm-h{font-size:10px;font-weight:700;color:#888;text-transform:uppercase;letter-spacing:.04em;margin:2px 2px 5px}
      .notemenu .nm-tags{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:7px}
      .notemenu .nm-tag{font-size:10px;font-weight:600;border:1px solid transparent;border-radius:8px;padding:3px 7px;cursor:pointer}
      .notemenu .nm-tag.on{outline:2px solid rgba(0,0,0,.3)}
      .notemenu .nm-row{display:block;width:100%;text-align:left;background:none;border:none;border-radius:7px;padding:7px 8px;font-size:13px;color:#333;cursor:pointer}
      .notemenu .nm-row:hover{background:#f1f0ec}
      .notemenu .mvgrid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-top:4px}
      .notemenu .cdow{font-size:10px;color:#aaa;text-align:center}
      .notemenu .mvday{text-align:center;font-size:12px;padding:5px 0;border-radius:6px;cursor:pointer;color:#333}
      .notemenu .mvday:hover{background:#e8f0ff}
      .notemenu .mvday.past{color:#ccc;cursor:default}.notemenu .mvday.past:hover{background:none}
      .notemenu .mvday.today{font-weight:700;outline:1px solid #bbb}
      .notemenu .mvnav{border:none;background:#eee;border-radius:6px;cursor:pointer;padding:2px 8px}
      .pad .torn{height:11px;background:#fbf7ea;clip-path:polygon(0 0,3% 70%,6% 10%,9% 75%,12% 5%,15% 70%,18% 0,21% 75%,24% 8%,27% 70%,30% 0,33% 75%,36% 10%,39% 70%,42% 0,45% 75%,48% 8%,51% 70%,54% 0,57% 75%,60% 10%,63% 70%,66% 0,69% 75%,72% 8%,75% 70%,78% 0,81% 75%,84% 10%,87% 70%,90% 0,93% 75%,96% 8%,99% 70%,100% 0,100% 100%,0 100%)}
      .coveract{display:flex;flex-wrap:wrap;gap:10px;margin-top:26px;justify-content:center}
      .covbtn{font-family:system-ui;font-size:13px;background:#efe7d2;border:1px solid #c9bd9c;color:#3a362c;border-radius:8px;padding:8px 14px;cursor:pointer;box-shadow:0 1px 0 #d9cfb0;transition:.15s}
      .covbtn:hover{background:#e7ddc2;border-color:#b6a982}
      /* real notepad COVER (page 0) — kraft/leather board, not ruled paper */
      .pad.cover{background:#6b4f33;background-image:radial-gradient(rgba(255,255,255,.04) 1px,transparent 1px);background-size:5px 5px;color:#f0e9dc;border-radius:4px}
      .pad.cover .spiral{background:#5a4129;border-bottom-color:#3f2d1b}
      .pad.cover .padbody{background-image:none;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 34px}
      .pad.cover::after{content:"";position:absolute;top:24px;bottom:0;right:26px;width:9px;background:linear-gradient(#1f1810,#4a3622);border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.5)} /* elastic band */
      .coverbrand{font-family:system-ui;letter-spacing:.32em;font-size:11px;color:#caa877;opacity:.85;margin-bottom:14px}
      .coverlabel{color:#fdf8ec;font-family:"Noteworthy","Marker Felt",cursive;font-size:46px;font-weight:700;margin-bottom:24px;text-shadow:0 2px 12px rgba(0,0,0,.38)}
      .covintro{font-family:system-ui;font-size:13px;color:#e6dcc8;line-height:1.75;max-width:380px}
      .covintro b{color:#fff}
      .pad.cover .covbtn{background:#caa877;border-color:#a9895a;color:#2a2114;box-shadow:0 1px 0 #8d6f44}
      .pad.cover .covbtn:hover{background:#d6b585}
      .padnav{display:flex;align-items:center;justify-content:space-between;margin:14px 0 22px;color:#9aa3b4;font-size:12.5px}
      .padnav button{background:#161922;border:1px solid #2f3442;color:#c7ccd6;border-radius:8px;padding:7px 14px;cursor:pointer;transition:.15s}
      .padnav button:hover{border-color:#475066;color:#fff}
      .padnav button:disabled{opacity:.35;cursor:default}
      /* calendar jump (green dot on days having notes) */
      .notecalwrap{position:relative}
      /* Header-mounted date picker drops DOWN below its button (right-aligned so it never overflows the viewport). */
      .notecalwrap.caltop .notecal{bottom:auto;top:calc(100% + 8px);left:auto;right:0;transform:none}
      .caljump{display:inline-flex;align-items:center;gap:6px;background:#161922;border:1px solid #2f3442;color:#c7ccd6;border-radius:8px;padding:7px 14px;cursor:pointer;font:inherit;font-size:12.5px}
      .caljump:hover{border-color:#475066;color:#fff}
      .notecal{position:absolute;z-index:60;bottom:40px;left:50%;transform:translateX(-50%);background:#11141b;border:1px solid #2a2f3a;border-radius:12px;padding:12px;box-shadow:0 16px 44px rgba(0,0,0,.55);width:268px}
      .notecal .cth{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-size:13px;color:#d7dce6}
      .notecal .cth button{background:none;border:none;color:#9aa3b4;cursor:pointer;font-size:17px;padding:0 8px}
      .notecal .cgrid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
      .notecal .cdow{font-size:10px;color:#7c8699;text-align:center;padding:3px 0}
      .notecal .cday{position:relative;text-align:center;font-size:12px;color:#9aa3b4;padding:7px 0;border-radius:7px}
      .notecal .cday.has{cursor:pointer;color:#eef1f6}
      .notecal .cday.has:hover{background:rgba(79,140,255,.18)}
      .notecal .cday.today{outline:1px solid rgba(79,140,255,.4)}
      .notecal .cday.sel{background:rgba(79,140,255,.28);color:#fff}
      .notecal .cday .dot{position:absolute;left:50%;bottom:3px;transform:translateX(-50%);width:5px;height:5px;border-radius:50%;background:#1f9d55;box-shadow:0 0 4px rgba(31,157,85,.6)}
      .notecal .ccover{margin-top:10px;width:100%;background:#161922;border:1px solid #2f3442;color:#c7ccd6;border-radius:8px;padding:7px;cursor:pointer;font-size:12px}
      .notecal .ccover:hover{border-color:#475066;color:#fff}
      /* global confirmation toast (survives a view re-render — appended to body) */
      .flashtoast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%) translateY(12px);background:#173a26;border:1px solid #1f9d55;color:#dff5e6;padding:11px 20px;border-radius:11px;font-size:13.5px;font-weight:500;box-shadow:0 12px 34px rgba(0,0,0,.55);opacity:0;transition:opacity .25s ease,transform .25s ease;z-index:10001;pointer-events:none}
      .flashtoast.show{opacity:1;transform:translateX(-50%) translateY(0)}
      .flashtoast.err{background:#3a1717;border-color:#d23b3b;color:#f7e2e2}
      /* Long-operation progress strip (#34) — pinned below the nav; shown only while an op runs */
      /* The progress strip belongs to the CONTENT COLUMN, not the window. Spanning edge-to-edge made a
         background learn look like a system-wide banner sitting above the app, rather than a status line for
         the panel whose cards it is about. Same 1440px cap and centring as `main`, so it lines up with the
         content beneath it. (The fullscreen-graph rule below deliberately overrides this to full width —
         there the page has no content column to align to.) */
      #opbar{position:sticky;top:0;z-index:9998;display:flex;flex-direction:column;gap:6px;
             width:80%;max-width:1720px;margin:0 auto;padding:9px 24px;
             background:linear-gradient(180deg,rgba(20,26,40,.96),rgba(16,20,30,.96));
             border-bottom:1px solid #26304a;border-radius:0 0 10px 10px;backdrop-filter:blur(6px)}
      /* When the graph is EXPANDED fullscreen (.kgfull, fixed z9000) the page isn't scrolled, so a sticky
         opbar floats at its natural mid-page spot and pokes through the canvas. Pin it to the true top of
         the viewport as a clean full-width strip above the graph instead of cutting across it. */
      body:has(.kg-shell.kgfull) #opbar{position:fixed;top:0;left:0;right:0;z-index:9002;margin:0;border-radius:0}
      #opbar .opitem{display:flex;flex-direction:column;gap:5px}
      #opbar .opmeta{display:flex;align-items:center;gap:8px;font-size:12.5px;color:#dfe4ea}
      #opbar .opmeta .opel{margin-left:auto;color:#8b93a1;font-variant-numeric:tabular-nums}
      #opbar .opspin{width:11px;height:11px;border-radius:50%;border:2px solid #2b3a5c;border-top-color:#5b8cff;animation:opspin .7s linear infinite;flex:none}
      @keyframes opspin{to{transform:rotate(360deg)}}
      #opbar .opline{height:5px;border-radius:99px;background:#1b2540;overflow:hidden}
      #opbar .opline i{display:block;height:100%;background:linear-gradient(90deg,#4f8cff,#7c5bff);border-radius:99px;transition:width .4s ease}
      #opbar .opline i.indet{width:38%!important;animation:opindet 1.15s ease-in-out infinite}
      /* BACKGROUND upkeep marker — a small breathing dot. Scheduled work the user did not just ask for gets
         this, never the full-width bar: it should be noticeable if looked for, and ignorable otherwise. */
      .owpulse{width:7px;height:7px;border-radius:50%;background:var(--acc);display:inline-block;flex:none;animation:owpulse 1.5s ease-in-out infinite}
      @keyframes owpulse{0%,100%{opacity:.28;transform:scale(.82)}50%{opacity:1;transform:scale(1)}}
      @media (prefers-reduced-motion: reduce){.owpulse{animation:none;opacity:.85}}
      @keyframes opindet{0%{margin-left:-40%}100%{margin-left:100%}}
      /* Owner-desk LEARN progress — same instrument as #opbar, reusing its two keyframes, scoped so the
         global strip is untouched. Used by the Actions-tab card and the desk-wide strip. */
      .owrun .opspin{width:11px;height:11px;border-radius:50%;border:2px solid #2b3a5c;border-top-color:#5b8cff;animation:opspin .7s linear infinite;flex:none;display:inline-block}
      .owrun .opline{height:5px;border-radius:99px;background:#1b2540;overflow:hidden;margin-top:7px}
      .owrun .opline i{display:block;height:100%;background:linear-gradient(90deg,#4f8cff,#7c5bff);border-radius:99px;transition:width .4s ease}
      .owrun .opline i.indet{width:38%!important;animation:opindet 1.15s ease-in-out infinite}
      .owrun .num{font-variant-numeric:tabular-nums}
      /* memory stat tiles */
      .memstats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-top:16px}
      @keyframes optslide{0%{transform:translateX(-100%)}100%{transform:translateX(400%)}}
      .modalbg{position:fixed;inset:0;background:rgba(0,0,0,.62);display:flex;align-items:flex-start;justify-content:center;z-index:1000;overflow:auto;padding:42px 16px}
      .modal{background:#11141b;border:1px solid var(--bd);border-radius:14px;max-width:640px;width:100%;padding:22px 22px 18px;box-shadow:0 24px 70px rgba(0,0,0,.55)}
      .modal h3{margin:0 0 2px}
      .modal .seg{display:inline-flex;border:1px solid var(--bd);border-radius:9px;overflow:hidden}
      .modal .seg button{background:#0c0e12;border:0;color:var(--fg);padding:7px 13px;font-size:13px;cursor:pointer}
      .modal .seg button.on{background:#2563eb;color:#fff}
      #hzSeg{display:inline-flex;border:1px solid var(--bd);border-radius:9px;overflow:hidden}
      #hzSeg button{background:transparent;border:0;color:var(--fg);padding:6px 14px;font-size:13px;cursor:pointer}
      #hzSeg button.on{background:#2563eb;color:#fff}
      .daypick{display:flex;gap:5px;flex-wrap:wrap}
      .daypick label{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--bd);border-radius:8px;padding:4px 9px;font-size:12px;cursor:pointer}
      .rstat{font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px;display:inline-block}
      .rstat.ok{background:#0e2a16;color:#46d369}.rstat.error{background:#2a0e0e;color:#f0a}.rstat.missed{background:#2a230e;color:#e6b800}.rstat.running{background:#0e1f2a;color:#3bd}.rstat.idle{background:#1a1d24;color:#9aa}
      .memstat{background:#0c0e12;border:1px solid var(--bd);border-radius:10px;padding:11px 13px}
      .memstat .ms-v{font-size:20px;font-weight:700;color:var(--fg);line-height:1.1}
      .memstat .ms-l{font-size:11px;font-weight:600;color:var(--fg);margin-top:4px}
      .memstat .ms-c{font-size:10.5px;color:var(--mut);margin-top:3px;line-height:1.4}
      /* Long memory text: clamp to 2 lines with an ellipsis; click toggles full text. */
      .memclamp{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;cursor:pointer;line-height:1.45}
      .memclamp.expanded{-webkit-line-clamp:unset;overflow:visible}
      .memclamp::after{content:'';}
      /* Agenda detail panel — an inline card in the page's normal flow, directly under the calendar grid;
         the page scrolls to it (no fixed/floating overlay). */
      #hzPanel{scroll-margin-top:72px}
      #hzPanel .hzHead{margin-bottom:2px}
      #hzPanel .hzGrid{max-width:820px}
      #hzPanel .hzGrid > *{min-width:0}
      .pager{display:flex;align-items:center;gap:10px;margin-top:12px;font-size:12px;color:var(--mut)}
      /* Knowledge-Graph GUI */
      .kg-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:10px 12px;margin:14px 0 12px}
      .kg-seg .kgf .kgf-c{font-size:10px;opacity:.6;margin-left:3px}
      .kg-legchip.off{opacity:.4;text-decoration:line-through}
      .kg-legchip:hover{filter:brightness(1.25)}
      .kg-empty-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:24px;color:var(--mut,#8a93a5);font-size:13.5px;pointer-events:none;z-index:2}
      .kg-ctl input[type=search],.kg-ctl input.kg-search{min-width:180px}
      .kg-searchwrap{position:relative;display:inline-block}
      .kg-sugg{position:absolute;top:calc(100% + 4px);left:0;min-width:230px;max-width:340px;max-height:280px;overflow-y:auto;background:var(--card,#0c0e12);border:1px solid var(--bd,#242832);border-radius:10px;box-shadow:0 12px 34px rgba(0,0,0,.55);z-index:10001;display:none;padding:4px}
      .kg-sugg.on{display:block}
      .kg-sugg .kgsg{display:flex;align-items:center;gap:8px;padding:7px 9px;border-radius:7px;cursor:pointer;font-size:12.5px;color:var(--fg,#e6e9ef);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
      .kg-sugg .kgsg:hover,.kg-sugg .kgsg.sel{background:rgba(120,150,255,.16)}
      .kg-sugg .kgsg .dot{width:9px;height:9px;border-radius:99px;flex:none}
      .kg-sugg .kgsg .sub{color:var(--mut,#8a93a5);font-size:11px;margin-left:auto;padding-left:10px}
      .kg-seg{display:inline-flex;border:1px solid var(--bd);border-radius:9px;overflow:hidden}
      .kg-seg button{background:#0c0e12;border:0;color:var(--mut);padding:6px 12px;font-size:12px;cursor:pointer}
      .kg-seg button.on{background:var(--acc);color:#fff}
      .kg-seg button:focus-visible{outline:2px solid var(--acc);outline-offset:-2px}
      .kg-slabel{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--mut)}
      /* The stage has a real, viewport-proportional height so its children (canvas + panel) can fill it. */
      .kg-stage{display:flex;gap:14px;align-items:stretch;margin-top:4px;height:min(68vh,680px)}
      /* Pop-out: the SHELL (controls + stage) fills the window as a column — so search/filter/Fit/Refresh/
         Rebuild/Import stay usable while expanded. The stage flexes to fill below the controls. */
      .kg-shell.kgfull{position:fixed;inset:0;z-index:9000;background:#05070b;padding:14px;display:flex;flex-direction:column;gap:10px;overflow:hidden}
      .kg-shell.kgfull .kg-ctl{flex:0 0 auto;margin:0;flex-wrap:wrap}
      .kg-shell.kgfull #kgImportPanel{flex:0 0 auto;overflow:auto;max-height:40vh}
      .kg-shell.kgfull .kg-stage{flex:1 1 auto;height:auto;min-height:0;margin:0}
      .kg-shell.kgfull .kg-canvas-wrap{min-height:0}
      .kg-canvas-wrap{position:relative;flex:1;min-width:0;min-height:0;border:1px solid var(--bd);border-radius:12px;background:#0b0d11;overflow:hidden}
      .kg-canvas-wrap canvas{display:block;width:100%;height:100%;cursor:grab}
      .kg-canvas-wrap canvas.grabbing{cursor:grabbing}
      .kg-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:14px;font-size:11px;color:var(--mut);background:rgba(12,14,18,.72);border:1px solid var(--bd);border-radius:8px;padding:6px 10px;pointer-events:none;flex-wrap:wrap;max-width:calc(100% - 24px)}
      .kg-legend [role=button]{pointer-events:auto}
      .kg-zoom{position:absolute;right:14px;top:70px;height:210px;display:flex;flex-direction:column;align-items:center;gap:6px;pointer-events:auto;z-index:3}
      .kg-zoom input[type=range]{-webkit-appearance:slider-vertical;appearance:slider-vertical;width:8px;height:170px;accent-color:var(--acc);cursor:pointer}
      .kg-zoom .zb{width:22px;height:22px;border-radius:7px;border:1px solid var(--bd);background:rgba(12,14,18,.8);color:var(--mut);font-size:15px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center}
      .kg-legend .dot{display:inline-block;width:9px;height:9px;border-radius:99px;margin-right:5px;vertical-align:0}
      .kg-hint{position:absolute;right:12px;top:12px;font-size:10.5px;color:var(--mut);background:rgba(12,14,18,.72);border:1px solid var(--bd);border-radius:8px;padding:5px 9px;pointer-events:none;max-width:200px;line-height:1.5}
      .kg-panel{flex:0 0 288px;max-width:none;min-height:0;border:1px solid var(--bd);border-radius:12px;background:#0c0e12;padding:14px;overflow:auto}
      /* Draggable divider between the canvas and the inspector panel — drag LEFT widens the panel, RIGHT narrows it. */
      .kg-resizer{flex:0 0 6px;align-self:stretch;cursor:col-resize;position:relative;background:transparent;border-radius:6px;touch-action:none;transition:background .15s ease}
      .kg-resizer::before{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:2px;height:34px;border-radius:2px;background:var(--bd);opacity:.6;transition:opacity .15s ease,background .15s ease}
      .kg-resizer:hover{background:rgba(127,127,127,.10)}
      .kg-resizer:hover::before{opacity:1;background:var(--acc)}
      .kg-stage.kg-resizing{cursor:col-resize;user-select:none;-webkit-user-select:none}
      .kg-stage.kg-resizing .kg-resizer::before{opacity:1;background:var(--acc)}
      .kg-panel .kg-empty{color:var(--mut);font-size:12.5px;line-height:1.55}
      .kg-ev-row{margin-bottom:11px}
      .kg-ev-head{font-size:12px;font-weight:600;color:var(--fg);margin-bottom:3px}
      .kg-ev-rel{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--acc);background:rgba(79,140,255,.12);border-radius:5px;padding:1px 6px;margin-left:4px;vertical-align:1px}
      .kg-ev-snip{font-size:11.5px;color:var(--mut);line-height:1.5;padding:3px 0 3px 10px;border-left:2px solid var(--bd);margin:2px 0}
      .kg-ev-src{font-size:9.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--acc);opacity:.75}
      .kg-pn-name{font-size:16px;font-weight:700;color:var(--fg);word-break:break-word;line-height:1.25}
      .kg-pn-sub{font-size:11.5px;color:var(--mut);margin-top:3px}
      .kg-bar-row{margin-top:10px}
      .kg-bar-row .kg-bl{display:flex;justify-content:space-between;font-size:11px;color:var(--mut);margin-bottom:3px}
      .kg-bar-row .kg-bl b{color:var(--fg);font-weight:600}
      .kg-bar{height:7px;border-radius:5px;background:#171a21;overflow:hidden}
      .kg-bar span{display:block;height:100%;border-radius:5px;background:linear-gradient(90deg,#3b82f6,#22d3ee)}
      .kg-neigh{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}
      .kg-neigh button{background:#171a21;border:1px solid var(--bd);color:#cfd6e6;border-radius:99px;padding:3px 9px;font-size:11px;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
      .kg-neigh button:hover{border-color:var(--acc);color:#fff}
      @media (max-width:820px){ .kg-stage{flex-direction:column} .kg-panel{flex:1 1 auto!important;width:auto!important;max-width:none;max-height:none} .kg-resizer{display:none} }
      /* ── EMBEDDED KG viewer (.kgv) — the SAME engine + the same .kg-* chrome classes as the main
         Knowledge-Graph screen, re-proportioned for a narrow modal: canvas on top, inspector beneath.
         Every rule here is scoped under .kgv so the main screen is untouched. ─────────────────────── */
      .kgv{border:1px solid var(--bd);border-radius:9px;background:#0f1117;padding:11px;margin-bottom:12px}
      .kgv .kgv-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px;margin-bottom:7px}
      .kgv .kgv-title{font-size:11px;text-transform:uppercase;letter-spacing:.4px;color:var(--mut)}
      .kgv .kg-ctl{margin:0 0 9px;gap:7px 9px}
      .kgv .kg-ctl input.kg-search{min-width:150px}
      .kgv .kg-seg{flex-wrap:wrap}
      .kgv .kg-seg button{padding:5px 9px;font-size:11.5px}
      .kgv .kg-stage{flex-direction:column;height:auto;gap:9px;margin-top:0}
      .kgv .kg-canvas-wrap{height:430px;flex:0 0 auto}
      .kgv .kg-panel{flex:0 0 auto;width:auto;max-width:none;max-height:320px;padding:11px 13px}
      .kgv .kg-zoom{top:auto;bottom:14px;right:12px;height:132px}
      .kgv .kg-zoom input[type=range]{height:96px}
      /* Hint top-left, zoom bottom-right, legend along the bottom-left — same three overlays as the
         north star, re-parked so they cannot collide on a 430px canvas. The legend is capped and
         scrolls: a desk with a dozen node types would otherwise cover half the graph. */
      .kgv .kg-hint{top:10px;left:12px;right:auto;bottom:auto;max-width:none;font-size:10px}
      .kgv .kg-legend{font-size:10.5px;gap:9px;max-height:66px;overflow-y:auto;max-width:calc(100% - 56px);background:rgba(12,14,18,.86)}
      .kgv.kgvfull .kg-legend{max-height:96px}
      .kgv.kgvfull .kg-hint{font-size:10.5px}
      .kgv .kgv-cite{font-size:11px;color:var(--mut);margin-top:7px;word-break:break-word}
      .kgv .kgv-cite code{font-size:10.5px}
      .kgv .kgv-typebadge{font-size:10px;border-radius:5px;padding:1px 6px;margin-left:6px;vertical-align:1px;background:#1c1f27;color:var(--mut)}
      .kgv .kgv-body{font-size:12px;color:var(--mut);line-height:1.55;margin-top:6px;white-space:pre-wrap;word-break:break-word}
      .kgv h3{margin:0 0 4px;font-size:15px}
      .kgv .kgv-blurb{font-size:12px;color:var(--mut);line-height:1.55;margin:0 0 4px}
      .kgv .memstats{grid-template-columns:repeat(auto-fit,minmax(118px,1fr));gap:7px;margin-top:11px}
      .kgv .memstat{padding:8px 10px}
      .kgv .memstat .ms-v{font-size:16px}
      .kgv .memstat .ms-l{font-size:10.5px}
      .kgv .memstat .ms-c{font-size:9.5px}
      .kgv .note{margin-top:10px;padding:8px 11px;font-size:11.5px}
      .kgv .kg-neigh button .kgv-x{opacity:.45;margin-left:5px;font-size:10px}
      .kgv .kg-neigh button:hover .kgv-x{opacity:1;color:var(--err)}
      /* EXPAND — the desk viewer's own overlay (deliberately NOT .kg-shell.kgfull: that class is the main
         screen's, and its Esc handler + kgFull() querySelector would fight over which shell is expanded).
         z-index sits above .modalbg (1000) so it escapes the desk modal it is mounted inside. */
      .kgv.kgvfull{position:fixed;inset:0;z-index:9600;margin:0;border-radius:0;padding:14px;background:#05070b;display:flex;flex-direction:column;gap:8px;overflow:hidden}
      .kgv.kgvfull .memstats{flex:0 0 auto;overflow:auto;max-height:22vh}
      .kgv.kgvfull .kg-ctl{flex:0 0 auto}
      .kgv.kgvfull .kg-stage{flex:1 1 auto;min-height:0;flex-direction:row;height:auto}
      .kgv.kgvfull .kg-canvas-wrap{flex:1 1 auto;height:auto;min-height:0}
      .kgv.kgvfull .kg-panel{flex:0 0 330px;max-height:none;height:auto}
      @media (max-width:820px){ .kgv.kgvfull .kg-stage{flex-direction:column} .kgv.kgvfull .kg-panel{flex:0 0 auto;max-height:38vh} }
      /* timezone converter day/night panels */
      .tzpanel{flex:1;min-width:230px;border-radius:14px;padding:14px 16px;border:1px solid var(--bd);background:#15171c;transition:background .5s ease,color .5s ease,border-color .5s ease}
      .tzpanel .tzp-head{font-size:11px;letter-spacing:.14em;text-transform:uppercase;opacity:.85;margin-bottom:9px;font-weight:600}
      .tzpanel .tzp-sel{width:100%;margin-bottom:9px}
      .tzpanel .tzp-meta{font-size:12px;display:flex;align-items:center;gap:6px;min-height:18px;font-weight:500}
      /* inline calendar */
      .tzcal{margin-top:10px;font-size:12.5px}
      .tzcal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-weight:600}
      .tzcal-nav button{background:transparent;border:none;color:inherit;cursor:pointer;opacity:.65;font-size:13px;padding:2px 6px;border-radius:6px}
      .tzcal-nav button:hover{opacity:1;background:rgba(127,127,127,.22)}
      .tzcal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;text-align:center}
      .tzcal-grid .dow{opacity:.5;font-size:10.5px;padding:2px 0}
      .tzcal-grid .cell{padding:5px 0;border-radius:7px;cursor:pointer}
      .tzcal-grid .cell:hover{background:rgba(127,127,127,.22)}
      .tzcal-grid .cell.out{opacity:.28;cursor:default}
      .tzcal-grid .cell.today{outline:1px solid rgba(127,127,127,.55)}
      .tzcal-grid .cell.sel{background:#2f6ea3;color:#fff;font-weight:700}
      /* analog clock picker (dial background = the sky for that time) */
      .tzclock{margin-top:12px;display:flex;flex-direction:column;align-items:center;gap:9px}
      .tzdial{position:relative;width:152px;height:152px;border-radius:50%;background:#10131c;box-shadow:inset 0 0 0 2px rgba(255,255,255,.14);cursor:pointer;transition:background .5s ease,color .5s ease;touch-action:none}
      .tzdial .num{position:absolute;width:24px;height:24px;margin:-12px 0 0 -12px;left:50%;top:50%;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;border-radius:50%;pointer-events:none}
      .tzdial .num.act{box-shadow:inset 0 0 0 2px currentColor;font-weight:800}
      .tzdial .hand{position:absolute;left:50%;bottom:50%;transform-origin:bottom center;background:currentColor;border-radius:3px;pointer-events:none}
      .tzdial .hh{width:4px;height:38px;opacity:.95}
      .tzdial .mh{width:2px;height:56px;opacity:.85}
      .tzdial .pin{position:absolute;width:9px;height:9px;left:50%;top:50%;margin:-4.5px 0 0 -4.5px;border-radius:50%;background:currentColor;pointer-events:none}
      .tzclock-ctl{display:flex;gap:10px;align-items:center;font-size:12px}
      .tzseg button{padding:4px 11px;border:1px solid rgba(127,127,127,.4);background:transparent;color:inherit;cursor:pointer;font-size:12px}
      .tzseg button:first-child{border-radius:8px 0 0 8px}.tzseg button:last-child{border-radius:0 8px 8px 0;border-left:none}
      .tzseg button.on{background:#2f6ea3;color:#fff;border-color:transparent}
      /* commands reference */
      .cmdwrap{display:flex;flex-wrap:wrap;gap:8px}
      .cmdchip{background:#15181f;border:1px solid #2a2f3a;color:#d7dce6;border-radius:8px;padding:7px 12px;font-size:13px}
      /* api-note toast */
      .noteToast{position:fixed;top:64px;right:20px;z-index:9999;background:#13351f;border:1px solid #1f9d55;color:#dff5e6;border-radius:10px;padding:10px 14px;font-size:13px;box-shadow:0 10px 30px rgba(0,0,0,.5);display:flex;align-items:center;gap:8px;animation:toastIn .18s ease}
      @keyframes toastIn{0%{opacity:0;transform:translateY(-8px)}100%{opacity:1;transform:none}}
      /* iOS-style switch */
      .switch{position:relative;display:inline-block;width:44px;height:26px;flex:none}
      .switch input{opacity:0;width:0;height:0;position:absolute}
      .switch .track{position:absolute;inset:0;background:#2f3442;border-radius:99px;transition:.18s;cursor:pointer}
      .switch .track::before{content:"";position:absolute;height:20px;width:20px;left:3px;top:3px;background:#fff;border-radius:50%;transition:.18s;box-shadow:0 1px 3px rgba(0,0,0,.4)}
      .switch input:checked + .track{background:var(--acc)}
      .switch input:checked + .track::before{transform:translateX(18px)}
      /* labeled inline toggle — same switch, with text beside it (replaces checkboxes) */
      .toggle{display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-size:13px;color:var(--fg);line-height:1.35}
      .toggle.top{align-items:flex-start}
      .toggle input{opacity:0;width:0;height:0;position:absolute}
      /* display:inline-block is LOad-BEARING. This rule was written for a .track that is a DIRECT flex item
         of .toggle (inline-flex blockifies its children, so width/height apply). Where the markup nests it
         one level deeper — <label class="toggle"><span class="switch"><input><span class="track">> — the track
         is no longer a flex item, AND this rule's position:relative overrides .switch .track's
         position:absolute (equal specificity, later wins), which un-blockifies it. An inline element ignores
         width/height, so the pill painted as a 0x0 box: the background was computed but had nothing to paint
         on, leaving only the absolutely-positioned ::before knob — a bare white dot, identical on and off. */
      .toggle .track{display:inline-block;position:relative;flex:none;width:40px;height:23px;background:#2f3442;border-radius:99px;transition:.18s}
      .toggle.top .track{margin-top:1px}
      .toggle .track::before{content:"";position:absolute;height:17px;width:17px;left:3px;top:3px;background:#fff;border-radius:50%;transition:.18s;box-shadow:0 1px 3px rgba(0,0,0,.4)}
      .toggle input:checked + .track{background:var(--acc)}
      .toggle input:checked + .track::before{transform:translateX(17px)}
      .toggle:hover .track{filter:brightness(1.15)}
      /* RULE: no checkboxes — plain checkboxes render as toggle switches (existing .switch/.toggle/.sotgl/.ropill toggles untouched). */
      input.nwCat,input.imDay,input.pgchk,input.looksBox,input.secCh,input.tgl,#imNotif,#imWa,.romaster input[type="checkbox"]{
        appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;width:38px!important;height:22px!important;
        border-radius:999px;background:#2f3442;cursor:pointer;transition:background .16s;vertical-align:middle;margin:0;box-shadow:none;padding:0;}
      input.nwCat:checked,input.imDay:checked,input.pgchk:checked,input.looksBox:checked,input.secCh:checked,input.tgl:checked,#imNotif:checked,#imWa:checked,.romaster input[type="checkbox"]:checked{background:var(--acc);}
      input.nwCat::after,input.imDay::after,input.pgchk::after,input.looksBox::after,input.secCh::after,input.tgl::after,#imNotif::after,#imWa::after,.romaster input[type="checkbox"]::after{
        content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:transform .16s;}
      input.nwCat:checked::after,input.imDay:checked::after,input.pgchk:checked::after,input.looksBox:checked::after,input.secCh:checked::after,input.tgl:checked::after,#imNotif:checked::after,#imWa:checked::after,.romaster input[type="checkbox"]:checked::after{transform:translateX(16px);}
      input.tgl:focus-visible,input.nwCat:focus-visible,input.imDay:focus-visible,input.pgchk:focus-visible,input.looksBox:focus-visible,input.secCh:focus-visible,#imNotif:focus-visible,#imWa:focus-visible,.romaster input[type="checkbox"]:focus-visible{box-shadow:0 0 0 3px rgba(79,140,255,.4);}
      input.tgl:disabled,input.nwCat:disabled,input.imDay:disabled,input.pgchk:disabled{opacity:.55;cursor:not-allowed;}
      /* Compact light-up chips already signal state — hide the native square so no checkbox shows. */
      .sotgl input[type="checkbox"],.ropill input[type="checkbox"]{opacity:0;position:absolute;width:0;height:0;margin:0;}
      /* Instant, :checked-driven light-up so the hidden-input read-only chips respond on click (handlers re-render only after an await). */
      .ropill:has(input[type="checkbox"]:checked){background:rgba(204,75,58,.14);border-color:#cc4b3a;color:#cc4b3a;font-weight:600;}
      /* notification feed rows */
      .notif{display:flex;gap:12px;align-items:flex-start;padding:13px 4px;border-bottom:1px solid var(--bd)}
      .notif:last-child{border-bottom:none}
      .notif .nicon{flex:none;width:34px;height:34px;border-radius:9px;background:#1b2330;display:flex;align-items:center;justify-content:center;font-size:16px}
      .notif.unseen .nicon{background:rgba(79,140,255,.16)}
      .notif .nbody{flex:1;min-width:0}
      .notif .ntitle{font-size:13px;font-weight:600;color:var(--fg);display:flex;align-items:center;gap:8px}
      .notif .ndot{width:7px;height:7px;border-radius:50%;background:var(--acc);flex:none}
      .notif .ntext{font-size:12.5px;color:#aab2c2;line-height:1.45;margin-top:2px;word-break:break-word}
      .notif .ntime{font-size:11px;color:var(--mut);white-space:nowrap;margin-left:8px;flex:none}
      /* grouped-notification stack (macOS/iOS style: count badge + hover dropdown) */
      .notifgroup{position:relative}
      .notifgroup.stack{cursor:default}
      .notifgroup.stack::after{content:"";position:absolute;left:14px;right:14px;bottom:-4px;height:8px;border-radius:0 0 11px 11px;background:#13161d;border:1px solid var(--bd);border-top:none;z-index:0}
      .gcount{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 6px;border-radius:99px;background:#2a3344;color:#aeb6c6;font-size:11px;font-weight:600}
      .notifgroup.unseen .gcount{background:rgba(79,140,255,.22);color:#bcd2ff}
      .gdrop{position:absolute;left:34px;right:6px;top:calc(100% - 2px);z-index:40;background:#161922;border:1px solid var(--bd);border-radius:11px;box-shadow:0 14px 36px rgba(0,0,0,.55);padding:6px;display:none;flex-direction:column;gap:1px}
      .notifgroup.stack:hover .gdrop{display:flex}
      .gitem{display:flex;justify-content:space-between;gap:12px;padding:8px 10px;border-radius:7px;font-size:12.5px;color:#c2c9d6}
      .gitem:hover{background:#1f2532}
      .gitem .gt{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
      .gitem .gtime{font-size:11px;color:var(--mut);white-space:nowrap}
      /* dismiss (x) + clear-all */
      .nx{flex:none;width:20px;height:20px;border-radius:6px;border:none;background:transparent;color:var(--mut);font-size:12px;line-height:1;cursor:pointer;opacity:0;transition:.12s;margin-left:8px;z-index:2}
      .notif:hover > .nx,.gitem:hover .nx{opacity:.65}
      .nx:hover{opacity:1 !important;background:#3a2530;color:#e7b3c8}
      .gclear{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 8px 7px;border-bottom:1px solid var(--bd);margin-bottom:3px}
      .gca{background:none;border:none;color:var(--acc);font-size:11px;cursor:pointer;padding:2px 4px;border-radius:5px}
      .gca:hover{background:rgba(79,140,255,.12)}
      .rolegrid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:6px}
      @media (max-width:760px){ .rolegrid{grid-template-columns:1fr} }
      .rolecard{background:#12161d;border:1px solid var(--bd);border-radius:11px;padding:14px 16px}
      /* toggle pills (channel selection) */
      .pillrow{display:flex;flex-wrap:wrap;gap:9px}
      .tpill{user-select:none;background:#161922;color:#9aa3b4;border:1px solid #2f3442;padding:8px 14px;border-radius:99px;cursor:pointer;font-size:12.5px;display:inline-flex;align-items:center;gap:8px;transition:.15s}
      .tpill:hover{border-color:#475066;color:#d7dce6}
      .tpill .dot{width:7px;height:7px;border-radius:50%;background:#3a3d49;transition:.15s}
      .tpill.on{background:rgba(79,140,255,.13);color:#fff;border-color:rgba(79,140,255,.6)}
      .tpill.on .dot{background:var(--acc);box-shadow:0 0 0 3px rgba(79,140,255,.2)}
      /* GREEN = this one is actually doing the work (selected, keyed, switched on). Hollow green = keyed and
         ready, one click away. Grey = no key yet. */
      .tpill .dot.live{background:#3DBC5B;box-shadow:0 0 0 3px rgba(61,188,91,.22)}
      .tpill.on .dot.live{background:#3DBC5B;box-shadow:0 0 0 3px rgba(61,188,91,.28)}
      .tpill .dot.ready{background:transparent;border:2px solid #3DBC5B;width:9px;height:9px;box-sizing:border-box}
      /* A favourite is a decision the owner made — it should be visible at a glance down a list of 141. */
      .vfav{color:#6b7280;border-color:transparent!important;background:transparent!important}
      .vfav:hover{color:#f0b34a}
      .vfav.on{color:#f0b34a}
      .cardfoot{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;padding-top:16px;border-top:1px solid var(--bd)}
      .behav{list-style:none;padding:0;margin:14px 0 0;display:grid;gap:1px}
      .behav li{display:flex;gap:11px;align-items:flex-start;padding:11px 2px;font-size:13px;line-height:1.5;color:#aab2c2;border-bottom:1px solid var(--bd)}
      .behav li:last-child{border-bottom:none}
      .behav li b{color:var(--fg);font-weight:600}
      .behav .bi{flex:none;width:22px;height:22px;border-radius:7px;background:rgba(79,140,255,.12);color:var(--acc);display:flex;align-items:center;justify-content:center;font-size:12px;margin-top:1px}
    html.embed header, html.embed nav#nav{ display:none !important; } html.embed body{ padding-top:0; }
/* embedded in a LIGHT page (the Present page follows the system theme): the host's own palette, so the screen reads as part of that page */
html.embed.light{ --bg:#f2f1ee; --card:#ffffff; --fg:#1d1d1f; --mut:#86868b; --bd:#e3e1dc; }
/* SENT TO AI — every [[REDACTED_n]] placeholder in an opened send is lit in the same green as the "N reduced"
   badge (owner, 8 Oct 2026: "highlight REDACTED placeholder in Sent to AI logs"). The raw pane is always
   dark (#0a0d12), so one green reads in both themes; the light override only deepens it for contrast. */
.egraw .redacted-ph{ background:rgba(26,158,95,.18); color:#1a9e5f; border:1px solid rgba(26,158,95,.45); border-radius:4px; padding:0 3px; font-weight:600; }
html.embed.light .egraw .redacted-ph{ color:#13864f; }
.egraw .restored-ph{ background:rgba(150,110,230,.18); color:#a98cf0; border:1px solid rgba(150,110,230,.45); border-radius:4px; padding:0 3px; font-weight:600; }   /* a value put back on this device, shown masked (section 4) — the chip's purple */
html.embed.light .egraw .restored-ph{ color:#6f4fd0; }
.egraw .sec-h{ background:rgba(255,196,0,.16); color:#ffc400; border:1px solid rgba(255,196,0,.45); border-radius:4px; padding:0 6px; font-weight:700; }   /* the section lines of the round trip (1 · SENT … 4 · RECONSTRUCTED), lit yellow so each leg is found at a glance (owner, 8 Oct 2026) */
html.embed.light .egraw .sec-h{ background:rgba(214,158,46,.18); color:#8a5a00; }
html.embed.light body{ background:var(--bg); color:var(--fg); }
html.embed.light .card{ background:var(--card); border-color:var(--bd); color:var(--fg); }
html.embed.light .card h3, html.embed.light .card h4, html.embed.light .kgv h3{ color:var(--fg); }
html.embed.light .memstat{ background:#f7f6f4; border-color:var(--bd); }
html.embed.light .ms-v{ color:var(--fg); } html.embed.light .ms-l{ color:var(--fg); } html.embed.light .ms-c{ color:var(--mut); }
html.embed.light .kgv{ color:var(--fg); } html.embed.light .kgv-blurb, html.embed.light .muted{ color:var(--mut); }
html.embed.light .kg-ctl .ico, html.embed.light .ico, html.embed.light .kgf{ background:#f7f6f4; color:var(--fg); border-color:var(--bd); }
html.embed.light .kgf.on{ background:var(--acc); color:#fff; border-color:var(--acc); }
html.embed.light .kg-search, html.embed.light select, html.embed.light input[type=text]{ background:#fff; color:var(--fg); border-color:var(--bd); }
html.embed.light .kg-canvas-wrap{ background:#ffffff; border-color:var(--bd); }
html.embed.light .kg-panel{ background:#fff; border-color:var(--bd); color:var(--fg); }
html.embed.light .kg-hint, html.embed.light .kg-legend{ background:rgba(255,255,255,.9); color:var(--fg); border-color:var(--bd); }
html.embed.light .kg-legchip, html.embed.light .kg-pn-name{ color:var(--fg); }
html.embed.light .kg-zoom{ background:rgba(255,255,255,.9); border-color:var(--bd); } html.embed.light .kg-zoom .zb{ color:var(--fg); }
html.embed.light .kgv-body{ color:var(--fg); }
html.embed.light .lib-fig{ border-top-color:var(--bd); }
html.embed.light .kgv{ background:var(--card); border-color:var(--bd); }
html.embed.light .kg-bar{ background:#e6e3dd; }
html.embed.light .kg-neigh button{ background:#f7f6f4; color:var(--fg); border-color:var(--bd); }
html.embed.light .kg-panel [style*="#1c1f27"], html.embed.light .kg-panel [style*="#15181f"], html.embed.light .kg-panel [style*="#171a21"]{ background:#eceae6 !important; color:var(--fg) !important; border-color:var(--bd) !important; }
html.embed.light .kgv-body{ color:#4a4f5c; } html.embed.light .kg-bl{ color:var(--mut); }
html.embed.light .kg-panel .act{ color:#fff; }
html.embed.light .kgv .kg-legend, html.embed.light .kgv .kgv-typebadge{ background:#f7f6f4; color:var(--fg); }
html.embed.light .kgv.kgvfull{ background:var(--bg); }
/* the inspector is a SIDE panel here, as on every desk (owner, 13 Sep: "clicking on a node, side information panel is missing") */
#libKgv .kg-stage{ flex-direction:row; height:min(68vh,680px); gap:14px; }
#libKgv .kg-canvas-wrap{ height:auto; flex:1 1 auto; }
#libKgv .kg-panel{ flex:0 0 320px; width:320px; max-height:none; overflow:auto; }
@media (max-width:900px){ #libKgv .kg-stage{ flex-direction:column; height:auto; } #libKgv .kg-panel{ width:auto; flex:0 0 auto; max-height:320px; } }
