/* Control center: phone. Bob's chat fills the screen; the board and its tabs are not shown as columns (public/app/control-phone.js adds the strip, the sheet and the way back). Nothing here applies above 1023px. */
.phone-back, .phone-strip, .phone-control-shortcuts, .phone-agent, .phone-sheet, .phone-view-bar { display: none; }
.phone-waiting[hidden] { display: none; }
.app-menu-panel .phone-waiting { position: static; display: inline-grid; margin-left: 8px; vertical-align: middle; }
.focus-more .phone-waiting { top: 3px; right: 3px; min-width: 18px; height: 18px; border: 0; font-size: 10px; }

@media (max-width: 1023px) {
  body.view-control #controlCenterPanel { display: flex; position: relative; }
  #controlCenterPanel > .panel-bar, #controlCenterPanel > .control-tabs { display: none; }
  #controlCenterMain { position: relative; display: block; min-width: 0; }
  #controlCenterMain > .control-chat { position: absolute; inset: 0; width: auto; border: 0; }
  .control-chat-resize, #controlChatSide { display: none; }

  /* The other tabs: only the chosen one, over the chat, with the way back. */
  .control-stage { display: none; }
  body.control-phone-view .control-stage { display: flex; position: absolute; inset: 0; z-index: 6; background: var(--panel); }
  .phone-view-bar { display: flex; align-items: center; gap: 8px; flex: none; padding: calc(6px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--header); }
  body:not(.focus-ui) .phone-view-bar { padding-right: 56px; }
  .phone-view-bar b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Header: Bob and his state, the bell (added by the triggers feature) and the settings. */
  .control-chat-head { min-height: 52px; gap: 6px; padding: calc(8px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); }
  body:not(.focus-ui) .control-chat-head { padding-right: 56px; }
  .control-chat-head > div { flex: 1 1 auto; min-width: 0; }
  .control-chat-head small { display: none; }
  .control-chat-head > button { flex: none; }
  .phone-back { display: inline-grid; place-items: center; width: 34px; min-width: 34px; padding: 0; font-size: 24px; line-height: 1; }
  #controlChatMonitor { display: inline-flex; align-items: center; gap: 6px; border-color: var(--line-strong); border-radius: 999px; }
  #controlChatMonitor::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
  #controlChatMonitor.paused::before { background: #f2b44b; }

  /* The strip wraps instead of scrolling sideways. */
  .phone-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
  /* A tap acts at once: no wait to see whether it is a double tap. */
  .phone-chip, .phone-action, .control-chip, .control-action { touch-action: manipulation; }
  .phone-chip { display: inline-flex; align-items: center; min-height: 32px; max-width: 100%; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--field); color: var(--text); font: inherit; font-size: 12.5px; white-space: nowrap; }
  .phone-chip[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
  .phone-chip.ok { border-color: transparent; background: color-mix(in srgb, var(--danger) 82%, #000); color: #fff; font-weight: 600; }
  .phone-chip.you { border-color: transparent; background: #f2b44b; color: #1a1205; font-weight: 600; }

  .control-chat-settings { flex: none; max-height: min(60dvh, 440px); overflow-y: auto; }
  .control-chat-settings input[type="checkbox"] { flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; }
  .control-chat-filters { flex-wrap: nowrap; padding: 6px max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px)); }
  .control-chat-filters select { flex: 1 1 0; min-width: 0; min-height: 30px; }
  .control-chat-filters .control-chip { flex: none; min-height: 30px; padding: 0 10px; font-size: 12px; }
  /* No room for one more word: the cleared items' chip is its check. */
  .control-chat-filters .control-chip-word { display: none; }
  /* A phone on its side has no height to spare for filters. */
  @media (max-height: 520px) { .control-chat-filters { display: none; } }

  /* Messages: approvals and questions are calm Paper cards in the timeline, with buttons a thumb can hit. */
  .control-chat-messages { padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); font-size: 14.5px; }
  .control-entry { min-width: 0; }
  /* A short timeline sits at the bottom, over the composer, as in any chat; a long one scrolls from its top. */
  .control-chat-messages > :first-child { margin-top: auto; }
  .control-msg { max-width: 94%; }
  .control-action { min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; }
  .control-actions { gap: 8px; }
  .control-entry[data-importance="needs-ok"], .control-entry[data-importance="needs-you"] { padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--panel); }
  .control-entry[data-importance="needs-ok"] { border-color: color-mix(in srgb, var(--danger) 36%, var(--line)); }
  .control-entry[data-importance="needs-you"] { border-color: color-mix(in srgb, var(--amber) 36%, var(--line)); }
  .control-entry[data-importance="needs-ok"] .control-msg, .control-entry[data-importance="needs-you"] .control-msg { max-width: 100%; padding: 0; border: 0; background: none; }

  /* Composer: quiet pills above a minimalist single-line pill message box. */
  .control-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 8px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); background: var(--bg); }
  body.focus-ui .control-chat-form { padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); border-top: 0; background: var(--bg); }
  .control-chat-project { grid-column: 1; gap: 0; font-size: 0; }
  .control-chat-project select { width: 100%; max-width: none; min-height: 32px; padding: 0 26px 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; }
  .phone-agent { grid-column: 2; display: block; overflow: hidden; text-overflow: ellipsis; line-height: 30px; border: 0; background: transparent; color: var(--muted); }
  .control-chat-box { grid-column: 1 / -1; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 26px; background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
  .control-chat-box #controlChatAttach { border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
  .control-chat-box textarea { height: 44px; min-height: 44px; padding: 10px 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .control-chat-box .primary { flex: none; display: grid; place-items: center; width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; border-color: transparent; background: var(--btn-bg); color: var(--btn-fg); font-size: 0; }
  /* A drawn arrow: a text glyph sits above the middle of the circle. */
  .control-chat-box .primary::before { content: ""; width: 22px; height: 22px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5m-6 6 6-6 6 6'/%3E%3C/svg%3E") center / contain no-repeat; }

  /* The agents sheet: a compact bottom sheet over the chat; a row is an agent and its one action. */
  .phone-sheet:not([hidden]) { display: flex; }
  .phone-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; flex-direction: column; padding: 8px max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0; background: var(--header); box-shadow: 0 -10px 30px rgb(0 0 0 / 0.25); }
  body.focus-ui .phone-sheet { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .phone-grab { align-self: center; width: 40px; height: 4px; margin-bottom: 4px; border-radius: 2px; background: var(--line-strong); }
  .phone-sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .phone-sheet-list { min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
  .phone-heading { padding: 8px 2px 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
  .phone-heading b { color: var(--text); }
  .phone-heading.ok b { color: #ff9d9d; }
  .phone-heading.you b { color: #f2b44b; }
  .phone-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 2px; border-top: 1px solid var(--line); }
  .phone-row::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #4a4f57; }
  .phone-row.ok::before { background: #ef6b6b; }
  .phone-row.you::before { background: #f2b44b; }
  .phone-row.running::before { background: var(--accent); }
  .phone-row.review::before { background: #7b8cff; }
  .phone-row-text { flex: 1 1 0; min-width: 0; }
  .phone-row-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .phone-row-text small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
  .phone-row.ok .phone-row-text small { -webkit-line-clamp: 3; font-family: var(--mono); font-size: 11.5px; }
  .phone-row-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 58%; }
  .phone-action { min-height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--field); color: var(--text); font: inherit; font-size: 12.5px; white-space: nowrap; }
  .phone-action.warn { border-color: transparent; background: #f2b44b; color: #1a1205; font-weight: 600; }
  .phone-action:disabled { opacity: 0.5; }
  .phone-empty { margin: 8px 2px; color: var(--muted); }

  /* The Focus menu's round handle sits above the composer, not on the send button. */
  body.view-control #focusControlsButton { bottom: 156px; }
  body.control-phone-sheet #focusControlsButton { display: none; }
}
