/* Workstation conversation feed (2026-10-22).
   A centered column of turns, a prompt pinned at the bottom, and artifact cards inline:
   the Business Map (workstation-canvas) and the Diagla views (engine + revenue-diagrams).
   Tokens mirror the locked Diagla design in public/x/diagla/diagla.css. Light default; dark via the sun/moon button. */

:root {
  /* White base (owner 2026-10-22: never tan as the Workstation base). Ink and lines follow the reference palette. */
  --wf-bg: #ffffff;
  --wf-sand: #f7f2ff;      /* lavender mist for quiet secondary surfaces */
  --wf-paper: #ffffff;
  --wf-ink: #2c232e;
  --wf-muted: #4b5563;
  --wf-hair: #e2e8f0;
  --wf-hair-strong: #d1d5db;
  --wf-pale: #f7f2ff;
  --wf-violet: #beaaff;
  --wf-accent: #6643e8;
  --wf-fc-body: #ffffff;
  --wf-shadow: 0 1px 2px rgba(34, 32, 19, 0.04), 0 10px 28px -14px rgba(34, 32, 19, 0.16);
  --wf-col: 760px;
  --wf-wide: 1060px;
  --wf-gutter: clamp(16px, 4vw, 32px);
  --wf-z-bar: 20;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --wf-bg: #1c1a12;
  --wf-sand: #22201a;
  --wf-paper: #26241b;
  --wf-ink: #fffdf2;
  --wf-muted: #cfc9b6;
  --wf-hair: #3a382c;
  --wf-hair-strong: #4a4738;
  --wf-pale: #2b2840;
  --wf-violet: #4a3d7a;
  --wf-accent: #beaaff;
  --wf-fc-body: #fbf9ee;
  --wf-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Surfaces */
.app-layout[data-template="pulleyflow"],
.app-layout[data-template="pulleyflow"] .template-main,
.app-layout[data-template="pulleyflow"] .template-body,
.app-layout[data-template="pulleyflow"] .main-workspace,
.app-layout[data-template="pulleyflow"] .thread {
  background-color: var(--wf-bg) !important;
  background-image: none !important;
}
.app-layout[data-template="pulleyflow"] .template-main {
  position: relative;
}
.app-layout[data-template="pulleyflow"] .sidebar {
  background: var(--wf-sand);
  border-right-color: var(--wf-hair);
  color: var(--wf-ink);
}
.app-layout[data-template="pulleyflow"] .navigation-rail {
  background: var(--wf-sand);
  border-right-color: var(--wf-hair);
}
.app-layout[data-template="pulleyflow"] .navigation-rail .icon-button,
.app-layout[data-template="pulleyflow"] .sidebar-brand .icon-button {
  color: var(--wf-muted);
}
.app-layout[data-template="pulleyflow"] .sidebar-business-switch {
  background: var(--wf-paper);
  border-color: var(--wf-hair);
}
.app-layout[data-template="pulleyflow"] .sidebar-business-switch strong,
.app-layout[data-template="pulleyflow"] .brand-identity span {
  color: var(--wf-ink);
}
.app-layout[data-template="pulleyflow"] .sidebar-business-switch small {
  color: var(--wf-muted);
}
.app-layout[data-template="pulleyflow"] .sidebar-divider {
  background: var(--wf-hair);
}
.app-layout[data-template="pulleyflow"] .nav-item {
  color: var(--wf-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.app-layout[data-template="pulleyflow"] .nav-item:hover {
  background: color-mix(in srgb, var(--wf-pale) 70%, transparent);
  color: var(--wf-ink);
}
.app-layout[data-template="pulleyflow"] .nav-item.active-nav {
  background: var(--wf-pale);
  color: var(--wf-ink);
}

/* Top bar: business name, save state, controls. It floats over the feed on a fade. */
.feed-topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: var(--wf-z-bar);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 16px 8px var(--wf-gutter);
  background: linear-gradient(to bottom, var(--wf-bg) 62%, color-mix(in srgb, var(--wf-bg) 0%, transparent));
  pointer-events: none;
}
.feed-topbar > * {
  pointer-events: auto;
}
.feed-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(46vw, 360px);
  min-height: 40px;
  padding: 4px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--wf-ink);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.feed-title:hover {
  background: color-mix(in srgb, var(--wf-hair) 60%, transparent);
}
.feed-title-text {
  display: grid;
  min-width: 0;
}
.feed-title strong {
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-title small {
  overflow: hidden;
  color: var(--wf-muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-title svg {
  flex: none;
  color: var(--wf-muted);
}
.feed-signin {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--wf-ink);
  color: var(--wf-bg);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.feed-signin:hover {
  opacity: 0.88;
}
.feed-topbar .floating-corner-controls {
  position: static;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--wf-hair);
  border-radius: 999px;
  background: color-mix(in srgb, var(--wf-paper) 92%, transparent);
  box-shadow: none;
  backdrop-filter: none;
}
.feed-topbar .floating-corner-controls .icon-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--wf-muted);
}
.feed-topbar .floating-corner-controls .icon-button:hover,
.feed-topbar .floating-corner-controls .icon-button.active {
  background: var(--wf-pale);
  color: var(--wf-ink);
}

/* The feed column */
.app-layout[data-template="pulleyflow"] .thread-content.feed {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-height: 0 !important;
  padding: 76px var(--wf-gutter) calc(var(--composer-height, 132px) + 56px) !important;
}
.feed-turn {
  width: 100%;
  max-width: var(--wf-col);
  margin-inline: auto;
  color: var(--wf-ink);
}
.feed-turn.has-artifact {
  max-width: var(--wf-wide);
  display: grid;
  gap: 12px;
}

/* You */
.app-layout[data-template="pulleyflow"] .feed-user {
  display: flex;
  justify-content: flex-end;
  padding: 0;
}
.app-layout[data-template="pulleyflow"] .feed-user-bubble {
  display: block;
  max-width: min(82%, 600px);
  padding: 11px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--wf-pale);
  color: var(--wf-ink);
  overflow-wrap: anywhere;
}
.feed-user-bubble p,
.feed-text p {
  margin: 0;
  font-size: 15px;
  line-height: 1.62;
}
.feed-user-bubble p + p,
.feed-text p + p {
  margin-top: 10px;
}
.feed-user-bubble .message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.feed-user-bubble .message-attachments span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--wf-paper);
  color: var(--wf-muted);
  font-size: 12px;
}

/* Diagla */
.app-layout[data-template="pulleyflow"] .feed-assistant {
  padding: 0;
}
.feed-said {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: var(--wf-col);
  margin-inline: auto;
}
.feed-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--wf-ink);
  color: var(--wf-bg);
  font-size: 13px;
  font-weight: 700;
}
.feed-said-body {
  min-width: 0;
  padding-top: 4px;
}
.feed-author {
  display: block;
  margin-bottom: 4px;
  color: var(--wf-ink);
  font-size: 13px;
  font-weight: 600;
}
.has-artifact .feed-author {
  margin-bottom: 0;
}
.feed-text {
  max-width: 68ch;
  color: var(--wf-ink);
  overflow-wrap: anywhere;
}
.feed-thinking {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--wf-muted);
  font-size: 14px;
}
.feed-thinking span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: wf-think 1.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.feed-thinking span:nth-child(2) { animation-delay: 0.15s; }
.feed-thinking span:nth-child(3) { animation-delay: 0.3s; margin-right: 4px; }
@keyframes wf-think {
  0%, 100% { opacity: 0.25; }
  40% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .feed-thinking span { animation: none; opacity: 0.6; }
}

/* Artifact card */
.feed-artifact-slot {
  min-width: 0;
}
.app-layout[data-template="pulleyflow"] .diagram-card.feed-artifact {
  position: relative;
  margin: 0;
  padding: 0 !important;
  border: 1px solid var(--wf-hair);
  border-radius: 16px;
  background: var(--wf-paper);
  box-shadow: var(--wf-shadow);
  min-width: 0;
}
.fc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--wf-hair);
}
.fc-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--wf-pale);
  color: var(--wf-accent);
}
.fc-name {
  display: grid;
  flex: 1;
  min-width: 0;
}
.fc-name strong {
  overflow: hidden;
  color: var(--wf-ink);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-name small {
  overflow: hidden;
  color: var(--wf-muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-expand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--wf-hair-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--wf-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.fc-expand:hover {
  background: var(--wf-pale);
  border-color: var(--wf-violet);
}
.fc-expand:active,
.fc-view:active {
  transform: translateY(1px);
}
.fc-expand:focus-visible,
.fc-view:focus-visible,
.feed-title:focus-visible,
.feed-signin:focus-visible {
  outline: 2px solid var(--wf-accent);
  outline-offset: 2px;
}

/* Diagla view switch: the six regular Diagla views on any diagram card */
.fc-views {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--wf-hair);
  overflow-x: auto;
  scrollbar-width: none;
}
.fc-views::-webkit-scrollbar {
  display: none;
}
.fc-view {
  flex: none;
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wf-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.fc-view:hover {
  background: color-mix(in srgb, var(--wf-pale) 80%, transparent);
  color: var(--wf-ink);
}
.fc-view.active {
  background: var(--wf-ink);
  color: var(--wf-bg);
}

/* Artifact bodies. Diagrams keep a light sheet in both themes, like a document preview. */
.fc-body {
  min-width: 0;
  border-radius: 0 0 15px 15px;
  background: var(--wf-fc-body);
  overflow: hidden;
}
.feed-map-card .fc-body .canvas-surface {
  min-height: 460px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.app-layout[data-template="pulleyflow"] .feed-artifact .canvas-rail [data-expand] {
  display: none;
}
.feed-engine-card .fc-body {
  padding: 12px clamp(8px, 2vw, 20px) 18px;
}
.feed-engine-card .feed-engine-diagram .dg,
.feed-engine-card .feed-revenue-diagram.rd {
  padding: 0;
  background: transparent !important;
}

/* Pinned prompt: the column's width, resting on a fade so the feed passes under it */
.app-layout[data-template="pulleyflow"] .composer-wrap {
  z-index: var(--wf-z-bar);
  padding: 22px var(--wf-gutter) 14px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--wf-bg) 0%, transparent), var(--wf-bg) 34%);
}
.app-layout[data-template="pulleyflow"] .composer {
  width: 100%;
  max-width: var(--wf-col);
  margin-inline: auto;
  border: 1px solid var(--wf-hair-strong);
  border-radius: 22px;
  background: var(--wf-paper);
  box-shadow: var(--wf-shadow);
}
.app-layout[data-template="pulleyflow"] .composer:focus-within {
  border-color: var(--wf-violet);
}
.app-layout[data-template="pulleyflow"] .prompt-main {
  padding: 12px 18px 2px;
}
.app-layout[data-template="pulleyflow"] .prompt-main textarea {
  color: var(--wf-ink);
  font-size: 15px;
  background: transparent;
}
.app-layout[data-template="pulleyflow"] .prompt-main textarea::placeholder {
  color: var(--wf-muted);
  opacity: 1;
}
.app-layout[data-template="pulleyflow"] .composer-bottom {
  padding: 4px 10px 10px 12px;
}
.app-layout[data-template="pulleyflow"] .composer-tools > .icon-button,
.app-layout[data-template="pulleyflow"] .send-tools .mic-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--wf-muted);
}
.app-layout[data-template="pulleyflow"] .send-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--wf-ink) !important;
  color: var(--wf-bg) !important;
}
.app-layout[data-template="pulleyflow"] .attachment-tray > span {
  background: var(--wf-sand);
  color: var(--wf-ink);
}
.app-layout[data-template="pulleyflow"] .latest-message {
  border: 1px solid var(--wf-hair);
  background: var(--wf-paper);
  color: var(--wf-ink);
}

/* Full screen: the same artifact, larger, with a way back into the feed */
.full-canvas-engine .full-engine {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.full-canvas-engine .full-engine .fc-views {
  justify-content: center;
}
.full-canvas-engine .full-engine-scroll {
  flex: 1;
  min-height: 0;
  padding: 16px clamp(12px, 3vw, 40px) 32px;
  overflow: auto;
  background: #ffffff;
}
.full-canvas-engine .full-engine-scroll > * {
  max-width: 1280px;
  margin-inline: auto;
}

/* Phones */
@media (max-width: 640px) {
  .app-layout[data-template="pulleyflow"] .thread-content.feed {
    gap: 20px;
    padding-top: 68px !important;
  }
  .feed-said {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
  }
  .feed-avatar {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 12px;
  }
  .app-layout[data-template="pulleyflow"] .feed-user-bubble {
    max-width: 88%;
  }
  .app-layout[data-template="pulleyflow"] .diagram-card.feed-artifact {
    border-radius: 14px;
  }
  .fc-body {
    border-radius: 0 0 13px 13px;
  }
  .fc-head {
    padding: 8px 8px 8px 12px;
  }
  .fc-expand {
    width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
  }
  .fc-expand span {
    display: none;
  }
  .feed-map-card .fc-body .canvas-surface {
    min-height: 380px;
  }
  .feed-signin {
    display: none;
  }
  .feed-title {
    max-width: 52vw;
  }
}

/* Diagla views inside narrow cards: stack the Growth bands and let the brand wrap under the heading */
.feed-revenue-diagram.rd .rd-heading {
  flex-wrap: wrap;
}
@container (max-width: 620px) {
  .feed-revenue-diagram.rd .go-stage,
  .feed-revenue-diagram.rd .go-band {
    grid-template-columns: minmax(0, 1fr);
  }
  .feed-revenue-diagram.rd .rd-heading {
    gap: 12px;
  }
}

/* Replies: short lists and emphasis from the model read as text, not markup */
.feed-text ul,
.feed-text ol {
  margin: 8px 0 0;
  padding-left: 20px;
}
.feed-text li {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.6;
}
.feed-text strong {
  font-weight: 600;
}


/* The layout layers behind the feed read their own cream tokens; in light mode they are all white. */
:root:not([data-theme="dark"]) body:has(.app-layout),
:root:not([data-theme="dark"]) :is(.app-layout, .template-main, .template-body, .main-workspace, .thread) { background-color: #ffffff; }
