/* Revamp #2, slice 1. A presentation layer, not a second app shell.
   The existing grid solver, theme preference, routes, live events and resource
   controls remain the only owners of behavior. Use the frozen worktree for a
   complete comparison, including the original composer DOM. No generated UI
   lives here. */

/* The revamp's tokens (`--shell-*`, and the block that re-pointed style.css's
   names at them under `:root, :root[data-theme]`) moved to tokens.css on
   2026-11-20 (UI/UX PR 4), where each is an alias of a role. They were
   restated here and again, with other values, in beta-shell.css; the beta
   shell's won on every page, so those are the values tokens.css keeps. */

/* Flat regions share hairlines, not separate floating OS windows. The solver
   still decides all widths, stow states and minimum reading space. */
#app { background: var(--paper); }
#app :is(#chat-panel, #home-view, #today-view, #goals-view, #coworkers-view,
  #library-view, #customize-view, #connections-view, #crew-view,
  #results-view, #calendar-view, #shop-view, #spaces-view, #topbar) {
  background-image: none;
  background-color: var(--shell-surface);
}
#app:not(.view-welcome) #chat-panel { background: var(--shell-surface); }
#app:not(.view-welcome) #chat-panel .cp-head { background: var(--shell-surface); }
@media (min-width: 821px) {
  #app:not(.view-welcome) :is(#threads, #main, #chat-panel, .workbench) {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #app #threads { border-right: 1px solid var(--line); background: var(--paper); }
  #app #chat-panel { border-right: 1px solid var(--line); }
  #app .workbench { border-left: 1px solid var(--line); }
  #app #topbar { border-bottom: 1px solid var(--line); }
}

/* Navigation stays one moved control per destination. No CSS reordering that
   would make visual order disagree with keyboard/screen-reader order. */
#app #threads { --sb-bg: var(--paper); }
#threads .th-head { padding: 18px 16px 12px; }
#threads .sb-mark { font-size: 18px; letter-spacing: -.035em; }
#threads .sb-top { padding: 0 12px 8px; }
#threads :is(.sb-nav, .sb-setup) { padding-inline: 10px; gap: 2px; }
#threads :is(.side-item, .sb-item) {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 450;
}
#threads #threads-new { border: 1px solid var(--line); background: var(--card); }
#threads #threads-new:hover { border-color: var(--line-2); }
#threads :is(.cs-hit, .chat-item) { border-radius: 8px; }
#threads .cs-av { box-shadow: none; background: var(--shell-inset); color: var(--text); }
#threads :is(.cs-name, .ci-title) { font-size: 13px; }
#threads .tm-status { font-size: 11px; font-weight: 450; }
#threads .sb-foot { border-top: 1px solid var(--line); }
#threads .sb-setup-label { letter-spacing: normal; font-size: 12px; }
/* The collapsed rail retains the same line icons without shiny colored tiles. */
#app #sidebar .side-item .s-icon,
#app #sidebar .side-item:hover .s-icon {
  background: transparent;
  box-shadow: none;
  color: var(--dim);
  filter: none;
}
#app #sidebar .side-item.active .s-icon { color: var(--text); }

/* Reuse the existing semantic state colors only for actual state. Page/role
   identity should not make a rainbow of cards or gradient avatars. */
#app :is(.sec-tile, .cc-avatar, .cs-av, .wb-tab .wb-ic) {
  background-image: none;
  box-shadow: none;
}
#app .cc-avatar { background: var(--card-2); color: var(--text); }
#app .cpn-mark { background: var(--primary); }
#app :is(.goal-card, .cw-card, .cw-row.feed, .goal-detail, .skill-card, .mem-card) {
  background-image: none;
  background-color: var(--card);
}
#app :is(.seg, .schip.on, .cp-pill[aria-expanded="true"],
  .cp-icon[aria-pressed="true"], .lib-tab .badge) { background-image: none; }
#app .wb-tabs { mask-image: none; -webkit-mask-image: none; }
/* Preserve the existing measured figures and drill-downs, without presenting
   three empty KPI cards as the landing page's reason to exist. */
#app .td-stats-row { display: flex; flex-wrap: wrap; gap: 16px 24px; }
#app .td-stat {
  flex: 1 1 120px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#app .td-stat-num { font-size: 20px; font-weight: 550; }
#app .td-stat-sub { font-size: 12px; line-height: 1.4; }

/* One reading rhythm and one composer, with no new routing or context claims. */
#app { --cl-col: 760px; }
#chat-panel .stream { padding-top: 28px; padding-bottom: 28px; }
#chat-panel .stream .msg.user {
  background: var(--card-2);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 18px 18px 5px 18px;
}
#chat-panel .stream .msg.agent { font-size: 15px; line-height: 1.7; }
#chat-panel .who-av[data-scout] {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
}
#chat-panel #dock { padding-top: 12px; padding-bottom: 20px; background: var(--card); }
#chat-panel .composer, #sheet-dock .composer {
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: 0 2px 8px -5px rgb(25 33 20 / .18);
  background: var(--card);
}
#chat-panel .composer:focus-within, #sheet-dock .composer:focus-within {
  border-color: var(--focus-ring);
  outline: 2px solid color-mix(in srgb, var(--focus-ring) 22%, transparent);
  outline-offset: 2px;
}
/* Page-title weight and tracking, the same as every big title (2026-11-17):
   500 at -.035em was the one heading set lighter and tighter than the rest. */
#app .ce-greet { letter-spacing: -.02em; font-weight: 600; }
#chat-main .starter { background: transparent; box-shadow: none; }
#chat-panel .cp-head { border-bottom: 1px solid var(--line); }
#app .workbench { background: var(--card); }
#app .wb-head { background: var(--card); border-bottom: 1px solid var(--line); }

/* The control stays in the form that the phone sheet moves as one unit, but
   follows the action row in DOM order. No token figures are synthesized. */
#composer #modes-btn { min-width: 30px; }
#composer #ctx-meter {
  width: 100%;
  min-height: 32px;
  margin: 8px 0 -4px;
  padding: 6px 4px;
  justify-content: flex-start;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
#composer #ctx-meter .ctx-caption { margin-right: 4px; }
#composer #ctx-meter .ctx-track { width: 48px; }

/* Only the closed launcher yields to the main conversation. An explicitly
   opened read-only companion card/pane remains available and keeps its state. */
#app:is(.chat-wide, .chat-fills-window) #companion[data-shape="pill"] { display: none; }

/* The phone keeps its existing sheet/drag/keyboard implementation. Share the
   desktop's open answer typography instead of a card nested in a sheet. */
@media (max-width: 720px) {
  #sheet { background: var(--card); }
  #sheet .stream .msg.agent {
    padding: 0;
    border-radius: 0;
    background: transparent;
    /* 16px on a phone (2026-11-17): 15 is a desktop reading size held at arm's
       length; at hand distance the system's own body text is 17, and below 16
       a long answer is the thing people zoom. */
    font-size: 16px;
    line-height: 1.6;
  }
  #sheet .stream .msg.user { background: var(--card-2); color: var(--text); }
  #sheet .stream .who-av[data-scout] {
    background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  }
  #sheet-foot { background: var(--card); }
  #sheet-tabs { padding-bottom: 8px; }
  #sheet-dock .composer-bar { flex-wrap: wrap; gap: 6px; }
  #sheet-dock :is(#plus-btn, #model-pill, #modes-btn, #send) { min-height: 44px; min-width: 44px; }
  #sheet-dock #plus-btn { width: 44px; height: 44px; }
  #sheet-dock #input { font-size: 16px; }
  #sheet-dock #model-pill { min-width: 0; max-width: calc(100% - 150px); }
  #sheet-dock #ctx-meter { min-height: 44px; }
  #sheet .schip.on { color: var(--text); background: var(--card-2); border-color: var(--line); }
}

#composer[data-direct] #at-worker, #composer[data-direct] #plus-btn { display: none; }
#composer[data-direct] #model-pill { opacity: 1; cursor: default; }
#conversation-recipient { padding: 10px 18px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
#sheet .work-assistant-open { font-size: 12px; min-width: 44px; }

@media (prefers-reduced-motion: reduce) {
  #app, #app *, #sheet, #sheet * { scroll-behavior: auto; }
}
