/* Customer chat app, Mayfair Skin layout: system things (new chat, search, chats, account) in the
   left bar; page things (chat title, allowance) in the top bar. */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 14px 14px 8px; }
.brand { font-weight: 700; font-size: var(--fs-xl); letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.55rem; }
.brand::before { content: ""; width: 4px; height: 1.15em; border-radius: 2px; background: var(--accent); }
.sidebar .new-chat { margin: 4px 12px 8px; width: calc(100% - 24px); height: var(--h-l); }
.search { padding: 0 12px 8px; }
.search input { width: 100%; }
.section-label { padding: 10px 16px 4px; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; }
.chatlist { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.chatlist li { position: relative; display: flex; align-items: center; border-radius: var(--r-ctl); height: 34px; margin-bottom: 2px; }
.chatlist li:hover, .chatlist li:focus-within { background: var(--bg-soft2); }
.chatlist li.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.chat-open { flex: 1; min-width: 0; height: 100%; text-align: left; font: inherit; font-size: var(--fs-md); color: var(--text); background: none; border: 0; padding: 0 10px 0 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-ctl); }
.chatlist li.active .chat-open { font-weight: 600; }
.chat-actions { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: flex; opacity: 0; background: var(--bg-soft2); border-radius: var(--r-ctl); }
.chatlist li.active .chat-actions { background: transparent; }
.chatlist li:hover .chat-actions, .chatlist li:focus-within .chat-actions, .chatlist li.active .chat-actions { opacity: 1; }
.chatlist li:hover .chat-actions { background: var(--bg-soft2); }
.rename-input { flex: 1; min-width: 0; margin: 0 2px; height: 30px; }
.empty-list { height: auto !important; padding: 0.6rem 0.9rem; color: var(--muted); font-size: var(--fs-sm); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); }
.who { min-width: 0; flex: 1; line-height: 1.25; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
.who-plan { font-size: var(--fs-xs); color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 48px; flex: none; border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.chat-title { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-lg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notices { padding: 12px 16px 0; }
.notices:empty { display: none; }
.notices .banner { margin-bottom: 8px; }

.thread { flex: 1; overflow-y: auto; min-height: 0; padding: 20px 16px 8px; }
.thread-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.empty-state { margin: 12vh auto 0; text-align: center; max-width: 30rem; }
.empty-state h2 { font-size: var(--fs-h1); letter-spacing: -0.025em; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.msg-who { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.msg-user { align-items: flex-end; }
.msg-user .msg-body { background: var(--bg-soft2); border-radius: var(--r-panel) var(--r-panel) 4px var(--r-panel); padding: 10px 14px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-lg); line-height: 1.55; }
.msg-assistant .msg-body { max-width: 100%; }
.msg-actions { display: flex; gap: 2px; opacity: 0.7; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps li { font-size: var(--fs-sm); color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 4px 10px; overflow-wrap: anywhere; }
.steps .step-bad { border-color: var(--danger-border); }
.steps .step-state { font-weight: 600; color: var(--accent-text); }
.steps .step-bad .step-state { color: var(--danger); }
.msg-error { border: 1px solid var(--danger-border); background: var(--danger-bg); border-radius: var(--r-panel); padding: 12px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.msg-error p { margin: 0; flex: 1 1 14rem; }
.msg-error small { display: block; color: var(--muted); margin-top: 4px; }

.composer-wrap { padding: 8px 16px 12px; flex: none; }
.composer { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--panel); padding: 6px 6px 6px 14px; }
.composer:focus-within { border-color: var(--accent-ring); }
.composer textarea { border: 0; background: transparent; padding: 6px 0; min-height: 32px; max-height: 200px; font-size: var(--fs-lg); outline: none; box-shadow: none; }
.composer textarea:focus-visible { outline: none; box-shadow: none; }
.composer:has(textarea:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-soft); }
.send-btn { flex: none; width: var(--h-m); height: var(--h-m); padding: 0; }
.fineprint { max-width: 760px; margin: 6px auto 0; text-align: center; font-size: var(--fs-xs); color: var(--muted); }

.scrim { display: none; }
.menu-close { display: none; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 88vw); z-index: 20; transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 10; border: 0; }
  .topbar .menu-btn, .menu-close { display: inline-flex; }
  .chat-actions { opacity: 1; }
  .msg-user .msg-body { max-width: 94%; }
  .topbar { padding: 0 8px; }
  .thread { padding: 14px 12px 6px; }
  .composer-wrap { padding: 6px 10px 10px; }
  .usage-chip { font-size: var(--fs-xs); white-space: normal; text-align: center; line-height: 1.2; max-width: 6.4rem; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* "Getting the AI ready" steps shown while the GPU switches on */
.boot-steps { list-style: none; margin: 8px 0 6px; padding: 0; display: grid; gap: 4px; }
.boot-steps li { color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
.boot-steps li.done { color: var(--ok); }
.boot-steps li.now { color: var(--text); font-weight: 600; }
.boot-steps .boot-mark { width: 1.1em; text-align: center; }
.boot-steps li.now .boot-mark { color: var(--accent-text); animation: boot-pulse 1.2s ease-in-out infinite; }
.msg.boot small { display: block; }
@keyframes boot-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .boot-steps li.now .boot-mark { animation: none; } }
