/* UI-36 · The Chat page: a full-screen list (public/chat-list.js), phone
   and desktop. Rule zero: 17 pt titles, 15 pt times, 44 pt targets, few words. */
.chat-list-page { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; height: 100%; width: 100%; overflow: hidden; background: var(--bg); }
.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; width: 100%; padding: 8px 0 120px; -webkit-overflow-scrolling: touch; }
.chat-list > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
.chat-list-heading { margin: 8px auto 12px; padding: 0 20px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }

/* The agents: one row, stories style, scrolling sideways. */
.chat-list-agents { display: flex; gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 4px 20px 14px; }
.chat-list-agents::-webkit-scrollbar { display: none; }
.chat-list-agent { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.chat-list-agent:disabled { opacity: .6; cursor: progress; }
.chat-list-agent-ring { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; padding: 3px; background: var(--line-2); transition: background .15s ease; }
.chat-list-agent.is-running .chat-list-agent-ring { background: var(--green, #22c55e); }
.chat-list-agent-avatar { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--bg); box-shadow: 0 0 0 2px var(--bg); color: var(--ink-2); }
.chat-list-agent-avatar > *, .chat-list-agent-avatar :is(svg, img, .agent-identity) { width: 100%; height: 100%; }
.chat-list-agent-add .chat-list-agent-avatar > svg { width: 26px; height: 26px; }
.chat-list-agent-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; line-height: 1.2; }
.chat-list-agent:hover .chat-list-agent-ring { background: var(--ink-3); }
.chat-list-agent:focus-visible { outline: none; }
.chat-list-agent:focus-visible .chat-list-agent-ring { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The chats: one row each. */
.chat-list-rows { list-style: none; margin: 0 auto; padding: 0 8px; }
.chat-list-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.chat-list-row:hover { background: var(--hover); text-decoration: none; }
.chat-list-row :is(.chat-list-row-title, .chat-list-row-when) { text-decoration: none; }
@media (hover: none) { .chat-list-row:hover { background: transparent; } }
.chat-list-row:active { background: var(--raise); }
.chat-list-row:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.chat-list-row-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.chat-list-row-avatar > *, .chat-list-row-avatar :is(svg, img, .agent-identity) { width: 100%; height: 100%; }
.chat-list-mono { display: grid; place-items: center; border-radius: 50%; background: var(--raise); color: var(--ink-2); font-weight: 650; }
.chat-list-row-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-list-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 450; line-height: 1.3; }
.chat-list-row-when { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 1.3; color: var(--ink-3); }
.chat-list-row .run-dot { flex: none; }
.chat-list-row.is-running .run-dot { display: inline-block; }
.chat-list-empty { margin: 24px auto; padding: 0 20px; color: var(--ink-3); font-size: 16px; text-align: center; }

/* Search floats at the bottom, the bar's full width, over the list (it fades under it). */
.chat-list-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 24px 16px calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 26px); }
.search-field.chat-list-search { flex: 1 1 0; min-width: 0; max-width: 728px; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 26px;
  background: color-mix(in srgb, var(--panel-2) 90%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); color: var(--ink-3); }
.search-field.chat-list-search svg { flex: none; width: 20px; height: 20px; }
.search-field.chat-list-search input { flex: 1; width: 0; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; }
.search-field.chat-list-search:focus-within { border-color: var(--ink-3); }

/* The page itself: the list fills the chat area (no rail beside it). */
[data-page="chat"] .content:has(> .inner > .chat-list-page), [data-page="chat"] .content > .inner:has(> .chat-list-page) { display: flex; min-height: 0; height: 100%; padding: 0; }

@media (max-width: 600px) {
  /* Below the floating menu and new-chat buttons. */
  .chat-list { padding-top: calc(env(safe-area-inset-top, 0px) + 60px); }
  .chat-list-heading { margin-top: 0; }
  .chat-list-rows { padding: 0 4px; }
  }
/* The desktop's title bar already says Chat. */
@media (min-width: 601px) { .chat-list-heading { display: none; } .chat-list { padding-top: 20px; } }

/* UI-38: a code chat's </> before its time. */
.chat-list-code { display: inline-flex; vertical-align: -3px; margin-right: 6px; color: var(--ink-2); }
.chat-list-code svg { width: 16px; height: 16px; }
