/* Bob's row in the column and Memory in his chat are the desktop page's (below); everywhere else they are not shown. */
.ws-bob-mark, .ws-bob-line, .bob-memory-button { display: none; }
/* Paper · Editorial — Bob's page on the desktop (1024 px and wider, app/bob-page.js), version A of 12 Nov: a head card with
   what Bob does and his switches, then two cards, Bob's chat and the stage. The stage carries the control center's views as
   tabs on top. Bob's chat opens from the column. Text is larger than the control center's elsewhere.
   Loaded before paper.css. */

.bob-head-avatar, .bob-head-tag, .bob-head-state, .bob-head-pause, #controlChat .bob-fold { display: none; }
body:not(.focus-ui) .bob-settings-head { display: none; }
.control-tab .bob-tab-icon { display: none; }

/* Refresh and Exit are icon buttons in the top bar at every width; the text is their tooltip and label. */
#controlCenterPanel > .panel-bar > button:is(#controlCenterRefresh, #controlCenterCloseButton) {
  display: inline-flex; flex: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0;
}
#controlCenterPanel > .panel-bar .bob-head-label, #controlCenterPanel > .panel-bar kbd { display: none; }
.bob-head-icon { display: block; flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 1024px) {
  /* ---------- the frame: a head card, then the chat and the stage as two cards ---------- */
  body.bob-desk.ws-desktop.view-control #controlCenterPanel {
    position: relative; display: flex; flex-direction: column; gap: var(--ws-gap, 14px); background: transparent; box-shadow: none; overflow: visible; border-radius: 0;
  }
  body.bob-desk #controlCenterPanel > #controlTabs { display: none; }
  body.bob-desk #controlCenterPanel > .control-exit-prompt { z-index: 3; }
  body.bob-desk #controlCenterPanel > .control-main { flex: 1; min-height: 0; gap: var(--ws-gap, 14px); overflow: visible; background: transparent; }
  body.bob-desk #controlCenterPanel > .panel-bar,
  body.bob-desk .control-main > .control-stage,
  body.bob-desk .control-main > .control-chat {
    border: 0; border-radius: var(--ws-card-radius, 24px); background: var(--panel); box-shadow: var(--shadow-soft); overflow: hidden;
  }
  :root[data-theme="dark"] body.bob-desk #controlCenterPanel > .panel-bar,
  :root[data-theme="dark"] body.bob-desk .control-main > :is(.control-stage, .control-chat) { box-shadow: 0 0 0 1px var(--line); }
  body.bob-desk .control-main > .control-chat { overflow: visible; }

  /* ---------- the head: hat, Bob, what he does, the team, what he watches, his switch and settings, Refresh, Exit ---------- */
  body.bob-desk #controlCenterPanel > .panel-bar {
    display: flex; align-items: center; gap: 12px; min-height: 0; height: auto; padding: 16px 22px 16px 24px;
  }
  body.bob-desk #controlCenterPanel > .panel-bar > .panel-title { display: contents; }
  body.bob-desk #controlCenterPanel > .panel-bar h1 { flex: none; margin: 0; color: var(--heading); font: 400 30px/1.1 var(--serif); }
  body.bob-desk #controlCenterPanel > .panel-bar .control-count { display: none; }
  body.bob-desk .bob-head-avatar {
    display: grid; flex: none; place-items: center; order: -1; width: 42px; height: 42px; border-radius: 50%; background: var(--paper-raised);
  }
  body.bob-desk .bob-head-tag { display: inline-block; flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--muted); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  body.bob-desk .bob-head-tag[hidden] { display: none; }
  body.bob-desk .bob-head-state { display: inline-flex; flex: 0 1 auto; gap: 8px; min-width: 0; margin-left: auto; }
  body.bob-desk .bob-head-state:empty { display: none; }
  body.bob-desk .bob-head-state:empty + .bob-head-pause { margin-left: auto; }
  .bob-state-pill {
    display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap;
    background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
  }
  .bob-state-pill.waiting { background: color-mix(in srgb, var(--amber) 13%, transparent); color: var(--amber); }
  .bob-state-pill.live::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: control-pulse 1.4s infinite; }
  @media (prefers-reduced-motion: reduce) { .bob-state-pill.live::before { animation: none; } }
  body.bob-desk .bob-head-pause {
    display: inline-flex; flex: none; align-items: center; gap: 10px; min-height: 0; height: 38px; padding: 0 8px 0 14px; border: 0; border-radius: 999px;
    background: var(--field); box-shadow: none; color: var(--text); font: 600 14px/1 var(--sans); cursor: pointer;
  }
  body.bob-desk #controlCenterPanel > .panel-bar > button { flex: none; padding-inline: 12px; font-size: 14px; }
  .bob-switch-knob { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); transition: background 0.15s; }
  .bob-switch-knob::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
  }
  [aria-checked="true"] > .bob-switch-knob { background: var(--accent); }
  [aria-checked="true"] > .bob-switch-knob::after { transform: translateX(16px); background: var(--btn-fg, #fff); }
  @media (prefers-reduced-motion: reduce) { .bob-switch-knob, .bob-switch-knob::after { transition: none; } }
  @media (max-width: 1360px) {
    body.bob-desk .bob-head-tag { display: none; }
    body.bob-desk #controlCenterPanel > .panel-bar kbd { display: none; }
  }
  @media (max-width: 1200px) {
    body.bob-desk .bob-state-pill:not(.waiting) { display: none; }
    body.bob-desk #controlCenterPanel > .panel-bar { gap: 8px; padding-inline: 16px; }
  }

  /* ---------- the stage: the views as tabs on top ---------- */
  body.bob-desk .control-stage { zoom: 1.12; }
  /* Bob's views: a sub-menu under Bob in the left column, there while Bob's page is open. */
  /* Bob's pages are places of the column like Projects and Costs (app/bob-page.js moves #controlTabs there). Bob himself is
     the first conversation of the list, Automations has its own place, and his memory opens from his chat. */
  body.bob-desk .ws-places > #controlTabs { display: contents; }
  body.bob-desk .ws-places > #controlTabs .control-tab {
    position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; height: 38px; min-height: 38px; padding: 0 10px; margin: 0; border: 0; border-radius: 10px;
    background: transparent; box-shadow: none; color: var(--muted); font: 550 15px/1.2 var(--sans); text-align: left; white-space: nowrap; cursor: pointer;
  }
  body.bob-desk .ws-places > #controlTabs .control-tab:hover { color: var(--text); background: color-mix(in srgb, var(--paper-raised) 60%, transparent); }
  body.bob-desk.view-control:not(.costs-page) .ws-places > #controlTabs .control-tab.active { color: var(--text); background: var(--paper-raised); }
  body.bob-desk .ws-places > #controlTabs .control-tab-badge { margin-left: auto; }
  body.bob-desk .ws-places > #controlTabs .control-tab:is([data-view="live"], [data-view="automations"], [data-view="memory"]) { display: none; }
  /* In team context, hide Bob's head pills/pause switch and keep the team workspace stage full-width. */
  body.bob-desk.team-context-active :is(.bob-head-state, .bob-head-pause) { display: none; }
  body.bob-desk.team-context-active .ws-side > .ws-place-bob.on { background: transparent; box-shadow: none; }
  /* First-class Teams section in the desktop sidebar, right under Bob. */
  body.bob-desk .ws-side > .team-sidebar-section { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 6px; padding: 8px 6px 6px; border-top: 1px solid var(--line); }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-side > .team-sidebar-section { display: none; }
  body.bob-desk:not(.view-control) #controlTabs .control-tab.active .bob-tab-icon, body.bob-desk.costs-page #controlTabs .control-tab.active .bob-tab-icon { stroke: currentColor; }
  /* Bob as a conversation: the app's mark where a row has its dot, his name, and what he does under it. */
  body.bob-desk .ws-side > .ws-place-bob {
    display: grid !important; grid-template-columns: 8px minmax(0, 1fr) auto; grid-template-areas: "mark name badge" "mark line line"; column-gap: 10px; row-gap: 0; align-items: start;
    width: 100%; height: 56px; min-height: 56px; margin: 6px 0 2px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; box-shadow: none; color: var(--text); text-align: left;
  }
  body.bob-desk .ws-side > .ws-place-bob:hover { background: color-mix(in srgb, var(--paper-raised) 55%, transparent); }
  body.bob-desk .ws-side > .ws-place-bob.on { background: var(--panel); box-shadow: var(--shadow-soft); }
  body.bob-desk .ws-side > .ws-place-bob > svg { display: none; }
  /* The mark sits where a row has its dot, so his name lines up with every title under it. */
  body.bob-desk .ws-side > .ws-place-bob .ws-bob-mark { display: block; grid-area: mark; width: 20px; max-width: none; height: 20px; margin: 0 0 0 -7px; }
  body.bob-desk .ws-side > .ws-place-bob .ws-place-label { grid-area: name; overflow: hidden; font-size: 13.5px !important; font-weight: 600; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
  body.bob-desk .ws-side > .ws-place-bob .ws-bob-line { display: block; grid-area: line; overflow: hidden; color: var(--muted); font-size: 12.5px; font-weight: 400; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
  body.bob-desk .ws-side > .ws-place-bob .control-icon-badge { grid-area: badge; margin: 0; }
  /* A short window: the places share two columns, so the list keeps its room. */
  @media (max-height: 800px) {
    body.bob-desk:not(.projects-collapsed, .ws-auto-rail, .ws-column-projects) .ws-places { grid-template-columns: 1fr 1fr; column-gap: 4px; }
    body.bob-desk:not(.projects-collapsed, .ws-auto-rail, .ws-column-projects) .ws-places .ws-place-note { display: none; }
  }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-side > .ws-place-bob { display: grid; grid-template-columns: 22px; grid-template-areas: "mark"; justify-content: center; padding: 6px 0; }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-side > .ws-place-bob :is(.ws-place-label, .ws-bob-line) { display: none; }
  /* The folded column is icons only: Bob's mark centred, his and his pages' counts as corner badges, the pages' names hidden. */
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-side > .ws-place-bob .ws-bob-mark { margin: 0; }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-side > .ws-place-bob .control-icon-badge { position: absolute; top: 1px; right: 2px; min-width: 16px; height: 15px; padding: 0 4px; font-size: 10px; }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-places > #controlTabs .control-tab { justify-content: center; padding: 0; font-size: 0; }
  body.bob-desk:is(.projects-collapsed, .ws-auto-rail) .ws-places > #controlTabs .control-tab-badge { position: absolute; top: 1px; right: 2px; min-width: 16px; height: 15px; margin: 0; padding: 0 4px; font-size: 10px; line-height: 15px; text-align: center; }
  body.bob-desk .control-chat-head .bob-memory-button { display: inline-flex; align-items: center; align-self: center; }
  body.bob-desk #controlTabs .bob-tab-icon { display: block; flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  body.bob-desk #controlTabs .control-tab.active .bob-tab-icon { stroke: var(--accent); }
  body.bob-desk #controlTabs .control-tab-badge { margin-left: 0; padding: 1px 8px; border-radius: 999px; background: var(--paper-raised); color: var(--muted); font-size: 12.5px; font-weight: 700; font-style: normal; }
  /* The Assistants list is a tab here at every width: the 1700 px column (control-assistants.css) would be a third column. */
  body.bob-desk .control-asst-rail { display: none !important; }
  body.bob-desk .control-stage > #controlTabs .control-tab[data-view="assistants"] { display: inline-flex; }
  /* A view's empty note sits inside the stage, not on its edge. */
  body.bob-desk .control-mydash .control-empty { margin: 48px auto; max-width: 560px; padding: 0 20px; text-align: center; font-size: 15px; line-height: 1.6; }

  /* ---------- Bob's chat: one column, larger text ---------- */
  /* Its parts are zoomed, not the chat itself, so its width and the resize edge keep the pointer's pixels. */
  body.bob-desk .control-chat > :not(.control-chat-resize) { zoom: calc(var(--ui-zoom-chat, 1) * 1.15); }
  body.bob-desk .control-chat-head { padding: 12px 16px; }
  body.bob-desk .control-chat-head > div > b { font: 400 19px/1.2 var(--serif); color: var(--heading); }
  body.bob-desk .control-chat-head small { display: none; }
  /* The head of the page has Bob's switch; Bob's settings stay in this header. */
  body.bob-desk #controlChatMonitor { display: none; }
  body.bob-desk #controlCenterPanel > .team-context-label { display: none; }
  body.bob-desk #controlChat .bob-fold { display: inline-flex; flex: none; min-width: 28px; justify-content: center; color: var(--muted); }
  /* Bob's window is the conversation only: the items (background updates, their filters) live on the board in the stage. */
  body.bob-desk :is(.control-chat-updates, .control-chat-filters) { display: none; }

  /* ---------- folding: hide the chat window ---------- */
  body.bob-desk.bob-chat-folded #controlChat { display: none; }
}

/* Bob's page shares the app's shell: the left column (the places and the Inbox list) stays beside it. The views are Bob's
   sub-menu in that column (app/bob-page.js moves #controlTabs there); on the board, which is a list of its own, the
   column's list steps aside. The workspace's own grids place the page (workspace.css). */
@media (min-width: 1024px) {
  /* Half a page: the head keeps Bob, what waits, his switch, settings, Refresh and Exit. */
  body.bob-desk.view-control.browser-visible #controlCenterPanel > .panel-bar :is(.bob-head-tag, kbd, .bob-state-pill:not(.waiting)) { display: none; }
  body.bob-desk.view-control.browser-visible #controlCenterPanel > .panel-bar { gap: 8px; padding-inline: 16px; }
  /* A group's full list (Show all in the column) takes the page's place until it is closed. */
  body.bob-desk.ws-desktop.view-control.ws-page-open #controlCenterPanel { display: none; }
}

/* The head gives way from the left: the tag line shortens first, the context list has a fixed width, the pills never shrink. */
@media (min-width: 1024px) {
  body.bob-desk .bob-head-tag { flex: 1 1 auto; }
  body.bob-desk .bob-head-state { flex: none; }
}

/* A conversation opened from the page: over the stage, beside Bob's chat (app/bob-page.js keeps --bob-pop-* on the
   stage's box). No dimming, so the chat stays usable. One control line: the popup bar takes "Give back to Bob" from the
   lease banner, which then has nothing left to say. */
@media (min-width: 1024px) {
  body.bob-desk.ws-desktop.view-control.control-popup .shell > #chatPanel {
    inset: auto; left: var(--bob-pop-x); top: var(--bob-pop-y); width: var(--bob-pop-w); height: var(--bob-pop-h);
    border-radius: var(--ws-card-radius, 24px); box-shadow: var(--shadow-soft), 0 18px 50px rgb(0 0 0 / 30%); overflow: hidden;
    /* Its cards have gaps between them: the page's own colour fills them, so nothing of the page shows through. */
    background: var(--bg);
  }
  /* The browser fills the right half of the page (the columns above), not a second floating window over it. */
  body.bob-desk.view-control.control-popup.browser-visible .shell > #browserPanel {
    grid-area: browser; position: static; inset: auto; width: auto; height: 100%; z-index: auto;
    border-radius: var(--ws-card-radius, 24px); box-shadow: var(--shadow-soft);
  }
  body.bob-desk.ws-desktop.view-control.control-popup #controlCenterPanel > .panel-bar,
  body.bob-desk.view-control.control-popup #controlCenterPanel::after { display: none; }
  body.bob-desk.view-control.control-popup #controlLeaseBanner { display: none; }
  body.bob-desk.view-control.control-popup .control-popup-bar { gap: 12px; padding: 10px 18px; font-size: 14px; }
  body.bob-desk.view-control.control-popup.control-held .control-popup-bar { background: color-mix(in srgb, var(--amber) 13%, transparent); }
  body.bob-desk .control-popup-bar .control-popup-project { color: var(--accent); }
  body.bob-desk .control-popup-bar :is(button, .control-popup-keep-out) { font-size: 13.5px; }
  body.bob-desk:not(.control-held) .control-popup-bar #controlLeaseGiveBack { display: none; }
}

/* The control line stays one line: the mode text shortens, the buttons keep their size. */
@media (min-width: 1024px) {
  body.bob-desk .control-popup-bar .control-popup-mode { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.bob-desk .control-popup-bar > :not(.control-popup-mode) { flex: none; }
}

/* Contextual Ask Bob actions open a floating chat window (app/bob-float.js). */
@media (min-width: 1024px) {
  body.bob-desk.view-control:not(.bob-chat-folded) .control-main > .control-chat {
    /* Above the conversation popup (z-index 40, later in the DOM): the floating chat must never sit behind it. */
    position: fixed; z-index: 41; flex: none; width: 440px; height: 640px; min-width: 340px; min-height: 380px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
    resize: both; overflow: hidden; border: 0; border-radius: 22px; box-shadow: 0 0 0 1px var(--line-strong), 0 24px 60px rgb(0 0 0 / 45%);
  }
  body.bob-desk.view-control:not(.bob-chat-folded) :is(.control-chat-resize, #controlChatSide) { display: none; }
  body.bob-desk.view-control:not(.bob-chat-folded) .control-chat-head { cursor: grab; touch-action: none; user-select: none; }
  body.bob-desk .control-chat-head.dragging { cursor: grabbing; }
}

/* Bob's own view, the "live" one (app/bob-page.js): his chat alone fills the page beside the left column; no stage, button or
   fold. Any window that has the left column (the phone's control center is his chat already). */
body:not(.focus-ui).bob-chat-page .control-main > .control-stage { display: none; }
body:not(.focus-ui).bob-chat-page .control-main > .control-chat {
  display: flex !important; flex: 1 1 0 !important; position: static !important; inset: auto !important; left: auto !important; top: auto !important;
  width: auto !important; height: auto !important; max-width: none !important; z-index: auto !important; resize: none; box-shadow: none; border-left: 0;
}
body:not(.focus-ui).bob-chat-page :is(.control-chat-resize, #controlChat .bob-fold) { display: none !important; }
/* What Bob and the system raise on their own (a check that found work waiting, Guardian, a stuck conversation) sits beside the
   conversation with him: with no board, his own page is where these are read and acted on. The floating window keeps only the chat. */
body:not(.focus-ui).bob-chat-page .control-chat-updates { display: block; }
/* Nothing raised: no empty column beside the chat. */
body:not(.focus-ui).bob-chat-page .control-chat-updates:has(> #controlChatUpdates:empty) { display: none; }

/* System messages (app/control-system.js): what the system found wrong with itself. The Inbox shows them above its groups
   (app/inbox-system.js) and each opens in a dialog with what it means and how to fix it. */
.inbox-system, .inbox-system-dialog { --sys: var(--danger); --sys-soft: color-mix(in srgb, var(--danger) 15%, transparent); --warn: color-mix(in srgb, var(--danger) 45%, var(--amber)); }
.control-sys-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sys-soft); color: var(--sys); font-weight: 800; }
.control-sys-icon svg { display: block; width: 15px; height: 15px; }
.control-sys-icon.big { width: 34px; height: 34px; font-size: 18px; }
.control-sys-pill { padding: 3px 11px; border-radius: 999px; background: var(--field); color: var(--muted); font-size: 12.5px; font-weight: 700; }
.control-sys-pill.error { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.control-sys-pill.warn { background: color-mix(in srgb, var(--danger) 12%, var(--field)); color: color-mix(in srgb, var(--danger) 45%, var(--amber)); }
.control-sys-why { padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 12%, transparent); box-shadow: inset 3px 0 0 var(--danger); font-size: 14.5px; }
.control-sys-why b { display: block; margin-bottom: 4px; color: var(--danger); }
.control-sys-why p { margin: 0; }
.control-sys-steps { display: grid; gap: 8px; margin: 0; padding: 0; counter-reset: fix; list-style: none; }
.control-sys-steps li { display: block; position: relative; padding: 11px 14px 11px 46px; border-radius: 12px; background: var(--field); font-size: 14.5px; line-height: 1.5; counter-increment: fix; }
.control-sys-steps li::before { content: counter(fix); position: absolute; top: 11px; left: 12px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--btn-fg, #fff); font-size: 13px; font-weight: 700; }
.control-sys-steps code { padding: 1px 7px; border-radius: 6px; background: var(--panel); font-size: 13px; }
.control-sys-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.control-sys-hint { color: var(--muted); font-size: 12px; }

/* the pin, star and folder menu, and the delete's Undo (app/control-marks.js) */
.control-pop { position: fixed; z-index: 60; display: flex; flex-direction: column; gap: 2px; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong), 0 18px 50px rgb(0 0 0 / 35%); }
.control-pop button { display: flex; justify-content: space-between; gap: 12px; min-height: 0; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; }
.control-pop button:hover, .control-pop button.on { background: var(--field); }
.control-pop button.on { color: var(--accent); font-weight: 700; }
.control-pop input { height: 32px; margin-top: 2px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); color: var(--text); font-size: 13.5px; outline: none; }
.control-pop input:focus { border-color: var(--accent); }
.toast-undo { flex: none; min-height: 0; padding: 2px 10px; border: 0; border-radius: 8px; background: var(--accent); color: var(--btn-fg, #fff); font-weight: 700; cursor: pointer; }

/* motion (app/motion.js) */
.motion-flash { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.motion-spark { position: fixed; z-index: 1000; pointer-events: none; }
.motion-plus { position: fixed; z-index: 1000; pointer-events: none; color: var(--amber); font: 700 14px var(--sans); }
