*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* One monospace stack for the whole app. Lands on Consolas (Windows), SF Mono/Menlo (macOS);
     'JetBrains Mono'/'Fira Code' were never web-loaded, so old stacks fell to Courier on Windows. */
  --font-mono: Consolas, 'SF Mono', Menlo, 'Cascadia Code', ui-monospace, monospace;
  --bg:          #E8EBF5;
  --bg2:         #FFFFFF;
  --bg3:         #F2F4FB;
  --bg4:         #E4E8F5;
  --accent:      #3B7DE8;
  --accent2:     #7C5CBF;
  --accent-pale: rgba(59,125,232,0.08);
  /* `--accent2` 的淡底。⚠️ bundle id 那一格刻意**不用 `--accent`** ——
     这一屏（以及全站）的按钮都是那个蓝，一个高亮的标识符长得像按钮，
     用户 2026-09-11：*「别用蓝色 蓝色 好多按钮是蓝色 换一个」*。 */
  --accent2-pale: rgba(124,92,191,0.11);
  /* 分发卡片里正文的左缩进 —— 给那个 radio 让位。
     ⚠️ 卡里每一行都要用它：写死第二份 24px，就会有一天它们不对齐
     （而用户 2026-09-13 报的正是这个）。 */
  --dist-card-indent: 24px;
  --text:        #1A1A2E;
  --text2:       #7580A0;
  --border:      rgba(0,0,0,0.07);
  --border2:     rgba(0,0,0,0.11);
  --user-bg:     #EAF0FE;
  --ai-bg:       #FFFFFF;
  --danger-red:  #E53E3E;
  --warn:        #E8923B;
  --warn-pale:   rgba(232,146,59,0.14);
  --danger-pale: rgba(229,62,62,0.12);
  --radius:      14px;
  --radius-lg:   22px;
  --radius-chip: 6px;                 /* 待发区里那种小 chip（附件 / session 引用） */
  --bento-gap:   10px;
  --sidebar-w:   268px;
  --shadow:      0 8px 40px rgba(59,80,160,0.13), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-sm:   0 2px 16px rgba(59,80,160,0.09), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(59,80,160,0.07);
  --font-head:   'Syne', system-ui, sans-serif;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --text-secondary: var(--text2);
  --surface2:    var(--bg3);
  --mx-ok:       #2F9E6E;   /* metrics: up / 2xx / healthy */
  --mx-ok-pale:  rgba(47,158,110,0.12);
  --surface3:    var(--bg4);
}

html, body {
  height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
}

/* ── Login Page ── */
#login-page {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  flex-direction: row;
  justify-content: center;   /* center the two-column group so it doesn't drift on wide screens */
  background: var(--bg);
}
#login-page.visible { display: flex; }

/* ── Login page two-column layout ── */
.lp-left {
  /* cap width (660px inner + 56/36 padding) so the left panel hugs the divider
     instead of growing to fill a wide desktop and leaving a huge gap */
  flex: 0 1 752px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 36px 32px 56px;
  overflow: hidden;
}
.lp-right {
  width: 500px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 64px;
  overflow-y: auto;
  border-left: 1px solid var(--border2);
}

/* Welcome layer + Chat window — stacked layers in lp-left-inner */
.lp-left-inner {
  position: relative;
  width: 100%;
  max-width: 660px;
  height: min(74vh, 540px);
}
.lp-cover,
.lp-chat-window {
  position: absolute;
  inset: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--bg2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.lp-cover.lp-layer-on,
.lp-chat-window.lp-layer-on { opacity: 1; pointer-events: auto; }
.lp-chat-window {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  display: flex;
  flex-direction: row;
  text-align: left;
}

/* Cover layer content — product hero */
.lp-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px 40px;
  font-family: var(--font-body);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-pale) 0%, transparent 55%),
    var(--bg2);
}
.lp-cover-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.lp-cover-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: contain;
}
.lp-cover-title {
  font-family: var(--font-head);
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.18;
  letter-spacing: -0.03em;
  text-align: center;
  min-height: 2.36em;
}
/* blinking caret on the element currently being typed */
.lp-cover-title .lp-caret,
.lp-cover-tagline .lp-caret {
  border-right: 2px solid var(--accent);
  margin-left: 1px;
  animation: lp-blink 0.9s steps(1) infinite;
}
@keyframes lp-blink { 50% { border-color: transparent; } }
.lp-cover-tagline {
  font-size: 15px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.01em;
  min-height: 1.2em;
}
.lp-tag-accent { color: var(--accent); }
.lp-cover-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 430px;
}
.lp-cover-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.lp-cover-feature.lp-reveal-on {
  opacity: 1;
  transform: none;
}
.lp-cf-icon {
  font-size: 1.45rem;
  flex-shrink: 0;
  line-height: 1;
}
.lp-cf-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.lp-cf-text b {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.lp-cf-text span {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.45;
}
.lp-cover-hint {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lp-cover-hint.lp-reveal-on { opacity: 0.7; }

/* Sidebar */
.lp-chat-sidebar {
  width: 148px;
  flex-shrink: 0;
  background: var(--bg3);
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lp-sidebar-header {
  padding: 12px 12px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text2);
  border-bottom: 1px solid var(--border2);
  font-family: var(--font-body);
}
.lp-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.lp-sidebar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  cursor: default;
  border-radius: 8px;
  margin: 0 4px;
  transition: background 0.15s;
}
.lp-sidebar-item.active { background: var(--accent-pale); }
.lp-sidebar-icon { font-size: 0.85rem; flex-shrink: 0; }
.lp-sidebar-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-sidebar-item.active .lp-sidebar-name { color: var(--accent); font-weight: 600; }
.lp-sidebar-new {
  margin: 6px 8px 10px;
  padding: 6px 0;
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  font-family: var(--font-body);
  cursor: default;
  background: none;
}

/* Main chat area */
.lp-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.lp-chat-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border2);
  min-height: 44px;
  flex-shrink: 0;
}
.lp-chat-menu-btn {
  font-size: 1rem;
  color: var(--text2);
  padding: 4px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: default;
}
.lp-chat-tool-select {
  padding: 4px 8px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg2);
  flex-shrink: 0;
  font-family: var(--font-body);
  cursor: default;
  pointer-events: none;
}
.lp-session-title {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-body);
}

.lp-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: var(--bg2);
}

/* User bubble */
.lp-msg-user {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px;
}
.lp-msg-bubble {
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  max-width: 78%;
  line-height: 1.55;
  font-size: 0.875rem;
}
.lp-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-bottom: 2px;
  border: 1px solid var(--border2);
}

/* AI bubble */
.lp-msg-ai { display: flex; align-items: flex-start; gap: 8px; }
.lp-msg-ai .lp-msg-avatar {
  background: #2d2d3d;
  border-color: #2d2d3d;
  margin-top: 2px;
  padding: 3px;
}
.lp-ai-body {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 14px;
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.lp-ai-text { color: var(--text); font-size: 0.875rem; line-height: 1.55; font-family: var(--font-body); }
.lp-ai-step { color: var(--accent); font-size: 0.82rem; line-height: 1.4; font-family: var(--font-mono); }

/* Result card */
.lp-result-card {
  margin-top: 6px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  font-family: var(--font-body);
}
.lp-result-header {
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg3);
  border-bottom: 1px solid var(--border2);
}
.lp-result-qr-row {
  display: flex;
  border-bottom: 1px solid var(--border2);
}
.lp-result-qr-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 10px;
  border-right: 1px solid var(--border2);
}
.lp-result-qr-item:last-child { border-right: none; }
.lp-qr-placeholder {
  width: 54px; height: 54px;
  flex-shrink: 0;
  border: 2px solid var(--text);
  border-radius: 4px;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, var(--border2) 3px, var(--border2) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, var(--border2) 3px, var(--border2) 4px);
}
.lp-result-qr-label { font-size: 0.75rem; font-weight: 600; color: var(--text); }
.lp-result-qr-sub   { font-size: 0.68rem; color: var(--text2); }
.lp-result-qr-row.single { justify-content: center; }
.lp-result-qr-row.single .lp-result-qr-item { max-width: 160px; border-right: none; }
.lp-result-actions { display: flex; flex-direction: column; gap: 5px; padding: 10px 14px 12px; }
.lp-result-btn {
  padding: 6px 12px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg2);
  text-align: left;
  font-family: var(--font-mono);
  cursor: default;
}
.lp-result-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Chat footer */
.lp-chat-footer {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border2);
  background: var(--bg2);
  flex-shrink: 0;
}
.lp-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg3);
  outline: none;
  resize: none;
  line-height: 1.5;
}
.lp-chat-send-btn {
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  white-space: nowrap;
  flex-shrink: 0;
  border: none;
  cursor: default;
}

/* Hide left panel on small screens */
@media (max-width: 860px) {
  .lp-left { display: none; }
  .lp-right { width: 100%; padding: 40px 24px; }
  .lp-right::before { display: none; }
}

/* Login card */
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-logo { height: 48px; width: auto; margin-bottom: 18px; }
.login-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  letter-spacing: -1px;
}
.login-subtitle {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 32px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}
.login-error { width: 100%; color: var(--danger-red); font-size: 12px; min-height: 18px; margin-bottom: 2px; }
.login-lbl {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text2);
  margin: 16px 0 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.login-card input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,125,232,0.12);
}
.login-card input::placeholder { color: var(--text2); opacity: 0.6; }
.login-submit {
  width: 100%;
  margin-top: 24px;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(59,125,232,0.30);
}
.login-submit:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 8px 26px rgba(59,125,232,0.38); }
.login-submit:active { transform: translateY(0); }
.login-submit:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }
.login-switch { margin-top: 18px; font-size: 12px; color: var(--text2); text-align: center; }
.login-switch a { color: var(--accent); text-decoration: none; font-weight: 600; }
.login-switch a:hover { text-decoration: underline; }

/* ── App Layout — bento grid container ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding: var(--bento-gap);
  gap: var(--bento-gap);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 55% 45% at 5% 95%, rgba(59,125,232,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 95% 5%, rgba(124,92,191,0.06) 0%, transparent 55%);
}

/* ── Sidebar — left bento cell ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: width .22s ease, min-width .22s ease, opacity .18s ease, border-width .22s ease;
}
#app.sidebar-hidden #sidebar {
  width: 0; min-width: 0; opacity: 0; pointer-events: none; border-width: 0;
}

#sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#sidebar-header h1 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.8px;
}
#sidebar-header p {
  font-size: 10px;
  color: var(--text2);
  margin-top: 2px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 500;
}

#new-session-btn {
  margin: 12px 12px 8px;
  padding: 9px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-head);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 3px 14px rgba(59,125,232,0.28);
  flex-shrink: 0;
}
#new-session-btn:hover {
  opacity: 0.90;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,125,232,0.38);
}
#new-session-btn:active { transform: translateY(0); }

#session-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.session-group-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text2);
  margin: 14px 8px 6px;
  letter-spacing: 0.2px;
}

/* Session items as micro bento cards */
.session-item {
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}
.session-item:hover { background: var(--bg3); border-color: var(--border); color: var(--text); }
.session-item.active {
  background: rgba(59,125,232,0.07);
  border-color: rgba(59,125,232,0.22);
  color: var(--accent);
}

.session-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  padding: 2px;
}
.session-pin { font-size: 10px; flex-shrink: 0; }
/* Phase 1: green dot marking a session whose app is deployed live */
/* Fixed-pixel CSS circle, not a text glyph — the ● glyph renders larger on macOS than
   Windows for the same font-size, so draw the dot ourselves for identical size everywhere. */
.session-live { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #4caf50; flex-shrink: 0; margin-left: 4px; vertical-align: middle; }
/* @-mention badge: someone @-mentioned you in this session while you were elsewhere */
.session-mention {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; flex-shrink: 0;
  background: var(--danger-red); color: #fff; border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.session-meta { font-size: 10px; color: var(--text2); flex-shrink: 0; }
.session-menu-btn {
  visibility: hidden;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s;
}
.session-item:hover .session-menu-btn,
.session-item.active .session-menu-btn { visibility: visible; }
.session-menu-btn:hover { background: var(--bg4); color: var(--text); }

/* Context menu */
#session-ctx-menu {
  position: fixed;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 13px;
  box-shadow: var(--shadow);
  z-index: 200;
  min-width: 160px;
  overflow: hidden;
}
#session-ctx-menu button {
  display: block;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  background: none;
  border: none;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}
#session-ctx-menu button:hover { background: var(--bg3); }
#session-ctx-menu .danger { color: var(--danger-red); }

/* Sidebar tabs */
#sidebar-tabs {
  flex-shrink: 0;
  display: flex;
  border-top: 1px solid var(--border);
  padding: 6px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 11px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-radius: 8px;
}
.tab-btn:hover { background: var(--bg3); color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  background: rgba(59,125,232,0.08);
}

/* Deploy panel */
#deploy-panel { display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#deploy-panel.visible { display: flex; }
#deploy-content { flex: 1; overflow-y: auto; padding: 10px 8px; }
.status-badge { display:inline-block; padding:1px 7px; border-radius:20px; font-size:10px; font-weight:700; margin-left:5px; }
.status-badge.running { background:#e6f9ee; color:#1a8a45; }
.status-badge.stopped { background:#fef2f2; color:#b91c1c; }
.deploy-section h3 {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text2);
  padding: 8px 4px 6px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.deploy-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text2);
  padding: 10px 4px 5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.deploy-group-label:first-child { padding-top: 4px; }
.deploy-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 12px;
}
.deploy-item .name { font-weight: 600; color: var(--text); font-size: 13px; }
.deploy-item.active {
  background: rgba(59,125,232,0.13);
  border-color: rgba(59,125,232,0.45);
  border-left: 3px solid var(--accent);
}
.deploy-item.active .name { color: var(--accent); }
.deploy-item .meta { color: var(--text2); margin-top: 2px; font-size: 11px; }
.deploy-item .actions { display: flex; gap: 4px; margin-top: 8px; }
.deploy-item .actions button {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  font-size: 11px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.deploy-item .actions button:hover {
  color: var(--accent);
  border-color: rgba(59,125,232,0.35);
  background: rgba(59,125,232,0.05);
}

/* ── Main — right bento cell ── */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Topbar */
#topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#back-btn {
  display: none;
  align-items: center;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
#back-btn:hover { color: var(--text); background: var(--bg3); }
#menu-btn { display: none; }
#sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: none; border: none;
  color: var(--text2); font-size: 16px; cursor: pointer;
  border-radius: 7px; transition: background .15s, color .15s; flex-shrink: 0;
}
#sidebar-collapse-btn:hover { background: var(--bg3); color: var(--text); }
/* Floating expand button — visible only when sidebar is collapsed */
#sidebar-expand-btn {
  display: none; position: fixed; left: calc(var(--bento-gap) + 4px); top: 50%;
  transform: translateY(-50%); z-index: 50;
  width: 22px; height: 48px; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 0 8px 8px 0; color: var(--text2); font-size: 14px; cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: color .15s, background .15s;
}
#sidebar-expand-btn:hover { background: var(--bg3); color: var(--accent); }
#app.sidebar-hidden #sidebar-expand-btn { display: flex; }
#app.sidebar-hidden #sidebar-collapse-btn { display: none; }

/* Tool selector styled as a mini bento chip */
#tool-select {
  padding: 6px 28px 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 9px;
  font-size: 12px;
  font-family: var(--font-head);
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237580A0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#tool-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,125,232,0.10);
}

/* Title + group widget stay together, left-aligned; the wrapper takes the flex space
   so the right-side buttons (Code/Stop/avatar) are still pushed to the right. */
.titlebar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
#session-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 13px;
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

#cancel-btn {
  display: none;
  padding: 5px 14px;
  background: rgba(229,62,62,0.07);
  color: var(--danger-red);
  border: 1px solid rgba(229,62,62,0.22);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.3px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
#cancel-btn:hover { background: rgba(229,62,62,0.14); border-color: rgba(229,62,62,0.4); }

/* ── Messages ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
/* ── Welcome Page ─────────────────────────────────────────────────────────── */
#welcome-page {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.wlc-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 28px; width: 100%; max-width: 640px;
}
.wlc-top { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.wlc-logo { height: 48px; width: auto; opacity: .9; }
.wlc-title { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -.3px; }
.wlc-sub { font-size: 14px; color: var(--text2); line-height: 1.6; }
.wlc-input-card {
  width: 100%; background: var(--bg2);
  border: 1.5px solid var(--border2); border-radius: 18px;
  padding: 16px 16px 12px; box-shadow: 0 4px 24px rgba(59,125,232,0.07);
}
.wlc-input-card textarea {
  width: 100%; background: none; border: none; outline: none; resize: none;
  font-size: 15px; color: var(--text); line-height: 1.6;
  font-family: inherit; min-height: 80px;
}
.wlc-input-card textarea::placeholder { color: var(--text2); opacity: .7; }
.wlc-input-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.wlc-attach-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.wlc-attach-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--border2);
  background: none; color: var(--text2); font-size: 20px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s; flex-shrink: 0;
}
.wlc-attach-btn:hover { border-color: var(--accent); color: var(--accent); }
.wlc-start-btn {
  padding: 8px 22px; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity .15s; white-space: nowrap; flex-shrink: 0;
}
.wlc-start-btn:hover { opacity: .88; }
.wlc-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%;
}
.wlc-chip {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 16px; font-size: 13px;
  color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.wlc-chip:hover { background: var(--accent-pale); border-color: var(--accent); color: var(--accent); }

.msg-wrap { display: flex; margin-bottom: 16px; gap: 10px; }
.msg-wrap.user { flex-direction: row-reverse; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 1px solid var(--border2);
}
.msg-wrap.user .avatar { background: var(--user-bg); }
.msg-wrap.ai   .avatar { background: var(--bg3); }
.avatar-img { border-radius: 50%; object-fit: cover; background: transparent; }

.bubble {
  max-width: 72%;
  padding: 12px 16px;
  border-radius: var(--radius);
  line-height: 1.65;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.msg-wrap.user .bubble {
  background: var(--user-bg);
  border: 1px solid rgba(59,125,232,0.16);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #2556B8;
}
.msg-wrap.ai .bubble {
  background: var(--ai-bg);
  border: 1px solid var(--border2);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-card);
}

/* Tool badges */
.tool-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 8px;
  border: 1px solid;
  text-transform: uppercase;
}
.tool-badge.claude { color: #B84A1A; border-color: rgba(184,74,26,0.22); background: rgba(184,74,26,0.07); }
.tool-badge.gemini { color: #1A5FC8; border-color: rgba(26,95,200,0.22); background: rgba(26,95,200,0.07); }
.tool-badge.codex    { color: #0A7A44; border-color: rgba(10,122,68,0.22);  background: rgba(10,122,68,0.07);  }
.tool-badge.deepseek { color: #4F46E5; border-color: rgba(79,70,229,0.22);  background: rgba(79,70,229,0.07);  }

/* Bubble content */
.bubble h1,.bubble h2,.bubble h3 { margin: 14px 0 7px; color: var(--text); font-family: var(--font-head); }
.bubble h1 { font-size: 18px; } .bubble h2 { font-size: 16px; } .bubble h3 { font-size: 14px; }
.bubble p  { margin: 6px 0; }
.bubble ul,.bubble ol { margin: 6px 0 6px 20px; }
.bubble li { margin: 3px 0; }
.bubble pre {
  margin: 10px 0;
  border-radius: 10px;
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--border2);
}
.bubble code:not(pre code) {
  background: #EEF0F8;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: #c0392b;
}
.bubble pre code { font-size: 12px; }
.bubble blockquote { border-left: 3px solid var(--accent2); padding-left: 12px; color: var(--text2); }
.bubble table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 8px 0; display: block; overflow-x: auto; white-space: nowrap; }
.bubble th,.bubble td { border: 1px solid var(--border2); padding: 6px 10px; }
.bubble th { background: var(--bg3); font-family: var(--font-head); font-size: 12px; letter-spacing: 0.3px; }
.bubble a { color: var(--accent); text-decoration: none; }
.bubble a:hover { text-decoration: underline; }

/* ── Output files ── */
.ai-error-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--danger-red);
  border-radius: var(--radius);
  background: var(--danger-pale);
  font-size: 14px;
  line-height: 1.4;
}
.ai-error-icon { flex: 0 0 auto; }
.ai-error-msg { color: var(--text); }

/* 这一轮被用户 Stop 掉了（#1004）。刻意用 warn 而不是 danger：它不是一次失败，
   是一次「他叫停了」—— 两者要的下一步动作完全不同。
   ⚠️ 全部走 var()，不 hardcode（ai.md 的 UI 铁律）。 */
.ai-stopped-card {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-pale);
  font-size: 13px;
  line-height: 1.4;
}
.ai-stopped-icon { flex: 0 0 auto; }
.ai-stopped-msg { color: var(--text); }

.output-files { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.output-file {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  overflow: hidden;
}
.output-file-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.output-file-row img.ftype { width: 16px; height: 16px; flex-shrink: 0; }
.output-file-name { flex: 1; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-file-actions { display: flex; gap: 4px; flex-shrink: 0; }
.output-file-actions button {
  background: var(--bg2);
  border: 1px solid var(--border2);
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text2);
  font-family: var(--font-body);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.output-file-actions button:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.output-img-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: var(--bg3);
  cursor: zoom-in;
  display: block;
  border-top: 1px solid var(--border);
}

.deploy-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.deploy-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(59,125,232,0.30);
  background: rgba(59,125,232,0.06);
  color: var(--accent);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.deploy-actions button:hover { background: rgba(59,125,232,0.14); border-color: var(--accent); }

/* Streaming cursor */
.cursor::after { content: "▋"; animation: blink 0.8s step-end infinite; }
.ai-status {
  font-size: 11px;
  color: var(--text2);
  padding: 2px 0 6px;
  display: none;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* Message action buttons */
.resend-btn {
  visibility: hidden;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  padding: 4px;
  border-radius: 6px;
  transition: opacity 0.12s, background 0.12s;
}
.resend-btn:hover { opacity: 1; background: var(--bg3); }
.msg-time-row {
  font-size: 10px;
  color: var(--text2);
  margin-bottom: 5px;
  width: 100%;
  padding: 0 40px;
  opacity: 0.55;
  letter-spacing: 0.2px;
}
.copy-btn {
  visibility: hidden;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  padding: 4px;
  border-radius: 6px;
  transition: opacity 0.12s, background 0.12s;
}
.copy-btn:hover { opacity: 1; background: var(--bg3); }
.msg-wrap:hover .copy-btn { visibility: visible; }
.user-actions { display: flex; align-items: center; align-self: center; margin-right: -4px; gap: 2px; }
.msg-wrap.user:hover .user-actions .resend-btn,
.msg-wrap.user:hover .user-actions .copy-btn { visibility: visible; }
.ai-actions { margin-top: 4px; display: flex; gap: 8px; align-items: center; }

.bubble-col { display: flex; flex-direction: column; align-items: flex-end; max-width: 72%; }
.bubble-col .bubble { max-width: 100%; }
.bubble-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.bubble-sending .bubble { opacity: 0.6; }
.bubble-sending-dot { display: inline-block; font-size: 11px; color: var(--text-secondary); margin-left: 6px; animation: blink 1s step-start infinite; }
.bubble-sending-dot.dot-failed { color: var(--danger-red); animation: none; }
.bubble.bubble-failed { box-shadow: 0 0 0 1.5px var(--danger-red) inset; }
.retry-btn { font-size: 11px; color: var(--danger-red); background: none; border: none; cursor: pointer; padding: 2px 6px; margin-top: 4px; text-decoration: underline; }
.bubble-attachments .attach-chip { font-size: 11px; opacity: 0.8; cursor: default; }
.bubble-attachments .attach-chip .rm-attach { display: none; }

/* ── Pending attachments ── */
#pending-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
#pending-attachments:empty { display: none; }

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 3px 10px 3px 8px;
  font-size: 12px;
  color: var(--text2);
}
.attach-chip img { width: 14px; height: 14px; flex-shrink: 0; }
.attach-chip .rm-attach { cursor: pointer; margin-left: 2px; opacity: 0.5; line-height: 1; }
.attach-chip .rm-attach:hover { opacity: 1; color: var(--danger-red); }
.attach-chip.uploading { opacity: 0.75; }
.attach-chip.uploading::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 5px;
  border: 1.5px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.attach-chip.upload-err { border-color: rgba(229,62,62,0.35); color: var(--danger-red); }

/* ── Input area ── */
#input-area {
  padding: 12px 14px;
  background: transparent;
  border-top: 1px solid var(--border);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  position: relative;
}

/* Sticky "Discussing" mode bar (shown above the input when chat_at == discussing) */
#discuss-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm, 8px);
  background: color-mix(in srgb, var(--accent2) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 40%, transparent);
  font-size: 12.5px;
}
#discuss-bar .db-label { color: var(--accent2); font-weight: 600; }

/* FREE lifetime bundle exhausted — persistent subscribe nudge. Warn palette so it reads as a
   soft wall (not an error), full-width in #main between the topbar/project-bar and messages. */
#free-exhausted-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 10px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--warn-pale);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
#free-exhausted-bar .fx-cta {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}
#discuss-exit-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-sm, 8px);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  min-height: 28px;
}
#discuss-exit-btn:hover { filter: brightness(1.08); }

/* @-mention autocomplete popup (sits above the input) */
.mention-popup {
  display: none; position: absolute; left: 14px; bottom: calc(100% - 4px);
  min-width: 200px; max-width: 320px; max-height: 240px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14); padding: 6px; z-index: 60;
}
.mention-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.mention-item.active, .mention-item:hover { background: var(--accent-pale); }
.mention-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: block; }
.mention-ai-av { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.mention-name { font-weight: 600; }
.mention-title { color: var(--text2); font-size: 12px; margin-left: auto; }
#input-row { display: flex; gap: 8px; align-items: stretch; }
#msg-input {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-body);
  resize: none;
  min-height: 74px;
  max-height: 240px;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#msg-input:focus {
  outline: none;
  border-color: rgba(59,125,232,0.45);
  box-shadow: 0 0 0 3px rgba(59,125,232,0.08);
}
#msg-input::placeholder { color: var(--text2); opacity: 0.6; }

#send-btn {
  padding: 0 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.4px;
  cursor: pointer;
  align-self: stretch;
  min-width: 68px;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 3px 14px rgba(59,125,232,0.28);
}
#send-btn:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 7px 22px rgba(59,125,232,0.36); }
#send-btn:active { transform: translateY(0); }
#send-btn:disabled {
  background: var(--bg3);
  color: var(--text2);
  box-shadow: none;
  transform: none;
  cursor: default;
  border: 1px solid var(--border2);
}

#upload-btn {
  align-self: stretch;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  border-radius: 12px;
  font-size: 22px;
  font-weight: 300;
  cursor: pointer;
  padding: 0 14px;
  line-height: 1;
  transition: border-color 0.2s, color 0.2s, background 0.15s;
}
#upload-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(59,125,232,0.05); }
#file-input { display: none; }

.user-profile-wrap:hover .dropdown-menu { display: block !important; }

/* ── Modals ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.visible { display: flex; }

/* Invite / members modal (group chat) */
.invite-modal { max-width: 440px; width: 92%; }
.iv-row { display: flex; gap: 10px; align-items: center; margin: 14px 0; }
.invite-modal .iv-email { flex: 1; min-width: 0; box-sizing: border-box; font-size: 16px; }
.iv-title-label,
.iv-roster-label { font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 7px; }
.iv-titles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.iv-chip {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 3px 11px; font-size: 11.5px;
  color: var(--text2); cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.iv-chip:hover { background: var(--accent-pale); border-color: var(--accent); color: var(--accent); }
.iv-chip.active {
  background: var(--accent2); border-color: var(--accent2); color: #fff;
}
.iv-invite-btn {
  flex: none; padding: 11px 22px; font-size: 14px; font-weight: 700;
  font-family: var(--font-head); cursor: pointer; white-space: nowrap;
  background: var(--accent); color: #fff;
  border: none; border-radius: 10px;
  transition: opacity 0.15s, transform 0.12s;
}
.iv-invite-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.iv-error { color: var(--danger-red, #d33); font-size: 13px; min-height: 18px; margin: 8px 0; }
/* #1008：邀请的代价（额度与 ASC 都是邀请人的）—— 次级说明的分量，但**默认可见**。
   ⚠️ 视觉值一律走变量（`ai.md` 那条），别 hardcode。 */
.iv-cost {
  font-size: 12px; line-height: 1.5; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-chip); padding: 8px 10px; margin: 0 0 10px;
}
.iv-cost strong { color: var(--text); font-weight: 600; }
.iv-roster-label { margin-top: 8px; }
.iv-roster { margin-top: 4px; }
.iv-member { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border2); }
.iv-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.iv-name { font-weight: 600; }
.iv-me {
  font-size: 10px; font-weight: 700; color: var(--accent);
  background: var(--accent-pale); border-radius: 6px; padding: 1px 6px; letter-spacing: 0.3px;
}
.iv-title { color: var(--text2); font-size: 12px; }
.iv-x { margin-left: auto; cursor: pointer; color: var(--danger-red, #d33); font-size: 18px; line-height: 1; padding: 0 4px; }
.session-shared { font-size: 11px; margin-left: 4px; opacity: 0.7; }

/* Chat-header group widget: members count + stacked avatars (shared/group sessions) */
.session-group { display: none; align-items: center; gap: 6px; cursor: pointer; flex-shrink: 0; }
.session-group .sg-count { font-size: 12px; font-weight: 600; color: var(--text2); }
.session-group .sg-avatars { display: inline-flex; align-items: center; }
.session-group .sg-av {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--bg2); background: var(--bg2); margin-left: -8px;
}
.session-group .sg-av:first-child { margin-left: 0; }
.session-group .sg-more { font-size: 11px; color: var(--text2); margin-left: 4px; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 28px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 100%);
}
.modal h2 {
  font-size: 17px;
  font-family: var(--font-head);
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
}
.modal label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text2);
  margin-bottom: 5px;
  margin-top: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.modal input:not([type=radio]):not([type=checkbox]),.modal select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 9px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
.modal input:not([type=radio]):not([type=checkbox]):focus,.modal select:focus { outline: none; border-color: var(--accent); }

/* iOS Build — distribution method cards */
#build-dist-selector { display: flex; flex-direction: column; gap: 8px; }
.dist-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: var(--bg3);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dist-card:hover { border-color: var(--border); }
.dist-card.selected { border-color: var(--accent); background: var(--bg2); }
/* ⚠️ 灰着但**画着**（#873）—— 没有可用机器时 My Server 那张卡不再消失。
   ⚠️ 不用 `pointer-events:none`：radio 自己 `disabled` 之后，点 label 本来
      就激活不了它 ⇒ 那一行是多余的；而留着 `cursor:not-allowed` 是为了让
      「点不动」在**按下去之前**就看得出来。 */
.dist-card.disabled { opacity: 0.45; cursor: not-allowed; }
.dist-card.disabled:hover { border-color: var(--border2); }
.dist-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dist-card input[type=radio] { flex-shrink: 0; accent-color: var(--accent); }
.dist-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.dist-card-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.45;
  padding-left: var(--dist-card-indent);
}
/* 卡内那行「Need to know?」+ 它的气泡（#927，用户定）。

   ⚠️⚠️ **hover 在移动端不存在** —— 纯 hover 会让手机上的用户永远看不到这段话，
   而那正是它要防的那类人（第一次发 Play 的）。⇒ 三条路都开：
   `:hover`（桌面）／`.open`（点一下，JS 加的，触屏走这条）／`:focus-within`（键盘）。
   同 #883 用 <details> 的理由：**露出来的那条路必须是用户真的走得到的那条**。

   ⚠️ 视觉上刻意**不报警**：不用 --warn / --danger，就是一行次级文字 ——
   它既不是错误也不紧急，只是一件该知道的事。 */
.dist-note {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  border-bottom: 1px dotted var(--text2);
  cursor: help;
  line-height: 1.2;
  letter-spacing: 0.2px;    /* 压掉 `.modal label` 那 1px —— 它是给分节标题写的 */
}
.dist-note-pop {
  display: none;
  position: absolute;
  right: 0;
  /* ⚠️⚠️ **向上开，不向下。** `.modal` 是 `overflow: hidden`（为圆角与顶部那条
     渐变）⇒ 任何超出 modal 盒子的绝对定位子元素**会被裁掉**，而 Google Play 是
     最下面那张卡 —— 2026-09-11 用户截图里那句 "YOUR OWN PREFIX" 就是这么没的。
     向上开，头上永远有 modal 标题 + APK 那张卡，装得下。
     ⚠️ 而真正让它安全的是**内容短**：两行。一个要靠「上面恰好够高」成立的布局，
     会在有人加第三个分发选项的那天再断一次 —— 所以别再把文案写长。 */
  bottom: calc(100% + 6px);
  z-index: 5;
  width: 260px;
  max-width: min(260px, calc(100vw - 48px));   /* 375px 视口也不横向溢出 */
  padding: 9px 11px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg2);
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text2);
  white-space: normal;
  text-align: left;
  cursor: auto;
  /* ⚠️ `.dist-card` **本身是个 `<label>`** ⇒ 它吃到 `.modal label` 那条
     `text-transform: uppercase` + `letter-spacing: 1px`（给 modal 分节标题写的）。
     卡片标题是短词，大写还好看；而这里是三句话 —— **一整段全大写没法读**
     （用户 2026-09-11 的截图）。同 `.byoc-field label` 那处破例，理由一起写下。 */
  text-transform: none;
  letter-spacing: normal;
}
.dist-note:hover .dist-note-pop,
.dist-note:focus-within .dist-note-pop,
.dist-note.open .dist-note-pop { display: block; }
.dist-note code {
  font-family: var(--font-mono, monospace);
  color: var(--text);
  word-break: break-all;
}

.dist-card-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: #10b98122;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* My Profile / My Devices */
/* ⚠️⚠️ **一条斜线，而它穿过用户给的三个真机点**（2026-09-06，#895 定稿）。
   `.modal` 的基线是 `width:90%; max-width:420px`，这一格此前是写死的 680px。

     Mac Air  1440 → 680  他说**最佳比例** ⇒ 这一档必须是 680
     Mac mini 1920 → 680  「目前看着可以，但屏幕宽了，**再宽一点更好：740–760**」
     Windows  2560 → 680  「很窄」；而 1040 他说「太宽」

   ⚠️⚠️ **这三个点不在一条固定占比上**（680/1440 = 47%，750/1920 = 39%）
   ⇒ `clamp(min, Xvw, max)` 那种形状**穿不过它们** —— 它要么是平的、要么是
   等比的。#893 用 45vw（等比）在 1920 上给出 864，#894 用 34vw（1440–1920
   全平）在 1920 上给出 680，**两次都是因为形状不对，不是参数没调好**。
   > **先看要穿过几个点，再决定用哪种形状 —— 参数救不了一个错的形状。**

   ⇒ **从 1440 起按每多 1px 视口涨 0.15px**：
     1440→680(47%)  1707→720(42%)  1920→**752**(39%)  2560→**848**(33%)
   上界 880 从 2773px 起生效 —— **一个弹窗不该长到 1500px**。
   ⚠️ 下界 680 让 1440 以下（含手机横屏）原样不动。

   ⚠️ **这一族里只有它该这么改**：`.modal`(420) / `.invite-modal`(440) /
   `.notif-modal-card`(460) 都是**单列表单**，固定窄上限对它们是对的 ——
   一个 420px 的表单被拉到 1000px 只会更难读。而这一个是**多栏面板**
   （150px 导轨 + 内容区，装着 MyCloud 的服务器卡、域名卡、ssh 命令块）。
   **别顺手把那三个也改了。**
   ⚠️ 下面 `@media (max-width: 640px)` 那条把它压回 460 —— 手机上不受影响。 */
.pf-modal { max-width: clamp(680px, calc(680px + (100vw - 1440px) * 0.15), 880px) !important; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.pf-header { flex-shrink: 0; }
.pf-body { display: flex; gap: 16px; flex: 1; min-height: 0; margin-top: 4px; }
.pf-rail { flex: 0 0 150px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 8px; }
.pf-rail-item { text-align: left; background: none; border: none; cursor: pointer; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text2); min-height: 44px; }
.pf-rail-item:hover { background: var(--bg3); color: var(--text); }
.pf-rail-item.active { background: var(--accent-pale); color: var(--accent); }
.pf-panes { flex: 1; min-width: 0; overflow-y: auto; padding-right: 4px; }
.pf-pane[hidden] { display: none; }
.pf-footer { flex-shrink: 0; }
/* Subscription plan (display-only) */
.pf-plan-row { display: flex; gap: 8px; margin-top: 6px; }
.pf-plan-card { flex: 1; text-align: center; padding: 10px 6px; border: 1px solid var(--border); border-radius: 10px; font-size: 12px; font-weight: 700; color: var(--text2); background: var(--bg3); }
.pf-plan-card.active { border-color: var(--accent); color: var(--accent); background: var(--accent-pale); box-shadow: 0 0 0 2px rgba(59,125,232,0.15); }

/* Header */
.pf-header { display: flex; align-items: center; gap: 14px; padding: 4px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.pf-avatar-hero { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid var(--border2); box-shadow: var(--shadow-sm); position: relative; cursor: pointer; }
.pf-avatar-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-avatar-edit-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.38); display: flex; align-items: center; justify-content: center; font-size: 16px; opacity: 0; transition: opacity .15s; }
.pf-avatar-hero:hover .pf-avatar-edit-overlay { opacity: 1; }
.pf-username { font-weight: 700; font-size: 16px; color: var(--text); }
.pf-useremail { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* Avatar picker */
.pf-avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 2px; }
.pf-av { width: 100%; aspect-ratio: 1/1; border-radius: 50%; cursor: pointer; border: 2px solid transparent; object-fit: cover; transition: border-color .12s, transform .12s; }
.pf-av:hover { border-color: var(--border2); transform: scale(1.07); }
.pf-av.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,125,232,0.18); }

/* Section label */
.pf-section-label { font-size: 12px; font-weight: 600; color: var(--text2); }

/* Field row: input + action button */
.pf-field-row { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.pf-field-row input { flex: 1; }
.pf-save-btn { background: var(--accent-pale); color: var(--accent); border: 1px solid rgba(59,125,232,0.22); border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: background .15s; }
.pf-save-btn:hover { background: rgba(59,125,232,0.14); }

/* Hint text */
.pf-hint { font-size: 11px; color: var(--text2); min-height: 16px; margin-top: 4px; }

/* Devices section header */
.pf-devices-hdr { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.pf-add-btn { background: var(--bg3); color: var(--accent); border: 1px solid var(--border2); border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .12s; }
.pf-add-btn:hover { background: var(--bg4); }

/* Device cards */
#pf-devices:empty::after { content: "No devices yet"; color: var(--text2); font-size: 13px; display: block; padding: 10px 0; }
.pf-device { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.pf-device-info { flex: 1; min-width: 0; }
.pf-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.pf-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.pf-edit { background: none; border: none; cursor: pointer; font-size: 11px; padding: 0 2px; opacity: 0.45; line-height: 1; flex-shrink: 0; }
.pf-edit:hover { opacity: 1; }
.pf-rename-input { font-size: 13px; font-weight: 600; border: 1px solid var(--accent); border-radius: 6px; padding: 2px 7px; background: var(--bg2); color: var(--text); outline: none; width: 150px; }
.pf-udid { font-size: 11px; color: var(--text2); font-family: var(--font-mono); word-break: break-all; margin-top: 2px; }
.pf-badge { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; margin-left: auto; }
.pf-badge.ok { background: rgba(16,185,129,0.12); color: #059669; }
.pf-badge.pending { background: rgba(245,158,11,0.15); color: #b45309; }
.pf-badge.fail { background: rgba(239,68,68,0.12); color: #dc2626; cursor: pointer; }
.pf-del { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 16px; flex-shrink: 0; line-height: 1; padding: 2px 4px; }
.pf-del:hover { color: var(--danger-red); }

/* Add device expandable */
.pf-add-box { margin-top: 10px; padding: 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: 14px; }
.pf-qr-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.pf-qr-wrap canvas, .pf-qr-wrap img { border-radius: 10px; box-shadow: var(--shadow-sm); }
.pf-add-scan-hint { font-size: 12px; color: var(--text2); text-align: center; margin-bottom: 10px; }
.pf-link-row { display: flex; gap: 6px; }
.pf-link-input { flex: 1; font-size: 11px; font-family: var(--font-mono); }
.pf-copy-btn { background: var(--bg4); border: 1px solid var(--border2); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text); flex-shrink: 0; transition: background .12s, color .12s; }
.pf-copy-btn:hover { background: var(--accent-pale); color: var(--accent); }
.pf-or-divider { text-align: center; font-size: 11px; color: var(--text2); margin: 12px 0 10px; position: relative; }
.pf-or-divider::before, .pf-or-divider::after { content: ''; position: absolute; top: 50%; width: 36%; height: 1px; background: var(--border2); }
.pf-or-divider::before { left: 0; }
.pf-or-divider::after { right: 0; }

/* Footer */
.pf-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pf-settings-row:last-of-type { border-bottom: none; }
.pf-settings-info { display: flex; flex-direction: column; gap: 2px; }
.pf-settings-title { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-settings-desc { font-size: 11px; color: var(--text2); }
.pf-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.pf-toggle input { opacity: 0; width: 0; height: 0; }
.pf-toggle-slider { position: absolute; inset: 0; background: var(--border2); border-radius: 22px; cursor: pointer; transition: background .2s; }
.pf-toggle-slider::before { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.pf-toggle input:checked + .pf-toggle-slider { background: var(--accent); }
.pf-toggle input:checked + .pf-toggle-slider::before { transform: translateX(18px); }
.pf-footer { justify-content: space-between !important; }
.pf-logout-btn { background: none; border: 1px solid var(--border2); color: var(--danger-red); border-radius: 10px; padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .12s; }
.pf-logout-btn:hover { background: rgba(229,62,62,0.07); }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; justify-content: flex-end; }
.modal-actions button {
  padding: 9px 20px;
  border-radius: 9px;
  border: none;
  font-size: 13px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%); color: #fff; }
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-cancel { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2) !important; }
.btn-cancel:hover { background: var(--bg4); color: var(--text); }

/* Usage-limit reached modal — text guidance + stacked full-width CTAs */
.usage-limit-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.usage-limit-body p { margin: 0 0 12px; }
.usage-limit-body p:last-child { margin-bottom: 0; }
.usage-limit-soon { color: var(--text2); font-size: 12px; }
#usage-limit-actions { flex-direction: column; align-items: stretch; }
#usage-limit-actions button { width: 100%; padding: 11px 20px; }
.name-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; cursor: pointer;
  background: var(--bg3); color: var(--text2); border: 1px solid var(--border2);
  transition: all 0.15s;
}
.name-chip:hover { background: var(--bg4); color: var(--text); border-color: var(--accent); }
.name-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.app-name-hint { font-size: 11px; min-height: 16px; margin-bottom: 6px; transition: color 0.2s; }
.app-name-hint.available { color: #4caf50; }
.app-name-hint.taken { color: #f44336; }
.app-name-hint.checking { color: var(--text2); }

#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 10; }

#list-user-profile { display: none !important; }

/* ── Mobile ── */
@media (max-width: 640px) {
  #app {
    position: relative;
    overflow: hidden;
    padding: 0;
    gap: 0;
  }
  #sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  #sidebar.has-user #list-user-profile { display: flex !important; }
  #sidebar-header { padding: 14px 16px; }
  #menu-btn { display: none !important; }
  #sidebar-collapse-btn { display: none !important; }
  #sidebar-expand-btn { display: none !important; }
  #sidebar-overlay { display: none !important; }
  #content-area { display: none; }
  #main { border-radius: 0; border: none; box-shadow: none; }
  #app.in-chat #sidebar { display: none; }
  #app.in-chat #content-area { display: flex; width: 100%; }
  #app.in-chat #main { display: flex; }
  /* Mobile: code panel overlays as full-screen drawer */
  #code-panel {
    position: fixed !important;
    top: 0; right: -100%; bottom: 0;
    width: 100% !important; min-width: unset !important;
    border-radius: 0; z-index: 60;
    transition: right 0.25s cubic-bezier(.4,0,.2,1);
  }
  #code-panel.open { right: 0; animation: none; }
  #back-btn { display: flex !important; }
  #session-list { padding: 0; }
  .session-item {
    padding: 14px 12px;
    min-height: 64px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    margin-bottom: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  .session-item:hover { background: var(--bg3); }
  .session-label { font-size: 14px; color: var(--text); }
  .session-menu-btn { visibility: visible; font-size: 20px; padding: 4px 8px; }
  .session-group-label { margin: 16px 12px 6px; }
  #tool-select { max-width: 88px; font-size: 12px; padding: 4px 6px; }
  .bubble { max-width: 88%; }
  .login-card { padding: 36px 24px; }
  #msg-input, .login-card input, .modal input:not([type=radio]):not([type=checkbox]), .modal select { font-size: 16px; }
}

/* ── Project Status Bar ── */
#project-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
#project-bar.visible { display: flex; }

.module-badges { display: flex; gap: 5px; flex-wrap: wrap; }
.module-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11px; font-weight: 700; font-family: var(--font-head);
  letter-spacing: 0.3px;
  background: rgba(59,125,232,0.1); color: var(--accent);
  border: 1px solid rgba(59,125,232,0.2);
}
.module-badge.inactive {
  background: var(--bg4); color: var(--text2);
  border-color: var(--border2); opacity: 0.6;
}
.module-badge::before { content: attr(data-check); }

.proj-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.proj-action-btn {
  padding: 4px 11px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 12px; font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.proj-action-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.proj-action-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.proj-action-btn.primary:hover { opacity: 0.88; }
.proj-action-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Contextual guide buttons below AI messages */
.guide-actions {
  margin-top: 10px; display: flex; gap: 7px; flex-wrap: wrap;
}
.guide-btn {
  padding: 5px 13px;
  border-radius: 8px;
  border: 1px solid rgba(59,125,232,0.25);
  background: rgba(59,125,232,0.06);
  color: var(--accent);
  font-size: 12px; font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.guide-btn:hover { background: rgba(59,125,232,0.14); border-color: var(--accent); }

@media (max-width: 640px) {
  #project-bar { padding: 6px 10px; }
  .proj-actions { margin-left: 0; }
}

/* ── Preview Modal ── */
#preview-modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,12,30,0.72);
  z-index: 80;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#preview-modal.visible { display: flex; }

.preview-inner {
  --preview-w: 1100px;
  width: min(var(--preview-w), calc(100vw - 40px));
  height: 90vh;
  background: var(--bg2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
#preview-resize-handle {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  transition: background 0.15s;
}
#preview-resize-handle:hover, #preview-resize-handle.active {
  background: var(--accent);
  opacity: 0.35;
}

.preview-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-url-bar {
  flex: 1; overflow: hidden;
  font-size: 12px; font-family: var(--font-mono);
  color: var(--text2);
  white-space: nowrap; text-overflow: ellipsis;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 4px 10px;
}
.preview-header-btns { display: flex; gap: 6px; flex-shrink: 0; }
.preview-header-btns button {
  padding: 4px 11px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px; font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.preview-header-btns button:hover { background: var(--bg4); color: var(--text); }
.preview-header-btns .close-btn { color: var(--danger-red); }
.preview-header-btns .close-btn:hover { background: rgba(229,62,62,0.08); }

.preview-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; flex: 1;
  color: var(--text2); font-size: 14px;
}
.preview-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#preview-iframe {
  flex: 1; border: none; width: 100%; display: none;
}

/* Preview error / status panel (replaces bare red text dumped over the spinner) */
.preview-error {
  display: none; flex: 1;
  align-items: center; justify-content: center;
  padding: 24px; background: var(--bg3);
}
.preview-error.visible { display: flex; }
.preview-error-card {
  max-width: 460px; width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 34px 30px; text-align: center;
  box-shadow: var(--shadow-card);
  animation: previewErrIn 0.18s ease-out;
}
@keyframes previewErrIn {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}
.preview-error-icon {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; border-radius: 50%;
  background: var(--bg3);
}
.preview-error.kind-fixing .preview-error-icon { background: var(--accent-pale); }
.preview-error.kind-env    .preview-error-icon { background: var(--warn-pale); }
.preview-error-title {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 600; color: var(--text);
  margin-bottom: 10px;
}
.preview-error-msg {
  font-size: 13.5px; line-height: 1.65; color: var(--text2);
  margin-bottom: 24px; white-space: pre-wrap;
}
.preview-error-actions { display: flex; gap: 10px; justify-content: center; }
.preview-error-actions button {
  min-height: 42px; padding: 0 20px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border2);
  transition: filter 0.15s, background 0.15s;
}
.preview-error-retry {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.preview-error-retry:hover { filter: brightness(1.06); }
.preview-error-close { background: var(--bg3); color: var(--text); }
.preview-error-close:hover { background: var(--bg4); }

@media (max-width: 640px) {
  #preview-modal { padding: 0; }
  .preview-inner { border-radius: 0; height: 100vh; max-width: 100%; }
}

/* ── Code Panel ── */
/* ── Content area: chat + code panel side by side ── */
#content-area {
  flex: 1;
  display: flex;
  gap: var(--bento-gap);
  min-width: 0;
  overflow: hidden;
}

#code-panel {
  --cp-width: 460px;
  width: var(--cp-width);
  min-width: var(--cp-width);
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
#code-panel.open {
  display: flex;
  animation: cpSlideIn 0.18s ease;
}
@keyframes cpSlideIn {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

#cp-resize-handle {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: background 0.15s;
}
#cp-resize-handle:hover, #cp-resize-handle.active {
  background: var(--accent);
  opacity: 0.35;
}

#code-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg3);
}
#code-panel-header h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-right: auto;
  letter-spacing: 0.3px;
}
.cp-tabs { display: flex; gap: 4px; }
.cp-tab {
  padding: 4px 12px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: none;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cp-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#close-code-panel {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text2); padding: 2px 6px;
  border-radius: 6px; transition: color 0.12s;
}
#close-code-panel:hover { color: var(--text); }

/* ── Database Panel ─────────────────────────────────────────────────────────── */
#db-panel {
  --dp-width: 380px;
  width: var(--dp-width);
  min-width: 160px;
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
#db-panel.open {
  display: flex;
  animation: cpSlideIn 0.18s ease;
}
#dp-resize-handle {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: background 0.15s;
}
#dp-resize-handle:hover, #dp-resize-handle.active {
  background: var(--accent);
  opacity: 0.35;
}
#db-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Wrapping is the SAFETY NET, not the plan. With the labelled Preview/Production
     control (~140px) the three-engine case needed ~418px and really did wrap at the
     380px default — the switch is now ~34px, so title + switch + three tabs ≈ 318px
     against 324px of content box: it fits on one row.
     ⚠️ Note that wrap means flex WRAPS BEFORE IT SHRINKS, so the h3 ellipsis below
     is not what saves a crowded row — it only helps once an item is itself too wide.
     Wrapping is kept anyway because on a hand-narrowed panel two rows beat a Redis
     tab clipped off the edge by the panel's overflow:hidden.
     row-gap keeps the two rows apart; padding-right reserves the close button's lane. */
  flex-wrap: wrap;
  row-gap: 6px;
  padding: 12px 40px 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg3);
  position: relative;
}
#db-panel-header h3 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
  /* Second-order guard only (see the wrap note above): if the title itself is
     ever wider than the row, it truncates instead of forcing a break. It carries
     the least information here — the panel is unmistakable. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Taken out of flow so wrapping can never carry it down to the second row —
   a close button that moves is a close button you hunt for. */
#close-db-panel { position: absolute; top: 10px; right: 12px; }
/* margin-left:auto rather than margin-right:auto on the title, so the tabs hug
   the right edge of WHICHEVER row they end up on. */
.dp-db-tabs { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.dp-db-tab {
  padding: 4px 12px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: none;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dp-db-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Preview / Production. Lives in the header beside the db tabs, because the
   environment qualifies EVERY view below it — including Redis, which has no tab
   of its own down there.
   One shared track (not two separate pills) so the pair reads as one A/B
   control and takes the width of two labels rather than two buttons. */
#dp-env-switch { flex-shrink: 0; display: flex; align-items: center; }
/* ~34px instead of the ~140px two words cost. The labels move into the tooltip;
   what stays visible is POSITION (which side the knob is on) and COLOUR. */
.dp-env-switch-btn {
  position: relative;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: var(--bg2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
/* Warning-coloured, not accent-coloured, and that is the point: Production is
   the side worth noticing, and colour is the one signal that costs no width. */
.dp-env-switch-btn.on { background: var(--warn); border-color: var(--warn); }
.dp-env-switch-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dp-env-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text2);
  transition: transform 0.15s, background 0.15s;
}
.dp-env-switch-btn.on .dp-env-knob { transform: translateX(16px); background: #fff; }
/* Redis view: top (db) / middle (Filter|Raw) / bottom (results) — mirrors the SQL panel */
#dp-redis-section { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#dp-redis-top { flex-shrink: 0; border-bottom: 1px solid var(--border2); padding-bottom: 8px; }
#dp-redis-dbinfo {
  display: inline-flex; align-items: center; margin: 0 14px;
  padding: 2px 12px; border-radius: 20px; border: 1px solid var(--border2);
  background: var(--bg3); font-size: 12px; color: var(--text); font-family: var(--font-mono);
}
#dp-redis-query { flex-shrink: 0; display: flex; flex-direction: column; border-bottom: 1px solid var(--border2); }
.dp-redis-mode-btn {
  padding: 3px 10px; border-radius: 6px; border: 1px solid var(--border2);
  background: none; font-size: 11px; font-family: var(--font-body); color: var(--text2);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.dp-redis-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#dp-redis-run-btn {
  margin-left: auto; padding: 4px 14px; border-radius: 7px; border: none;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  font-family: var(--font-body); cursor: pointer; transition: opacity 0.12s;
}
#dp-redis-run-btn:hover { opacity: 0.85; }
.dp-redis-mode-content { display: none; padding: 8px 12px; }
.dp-redis-mode-content.active { display: block; }
.dp-redis-mode-content input, .dp-redis-mode-content textarea {
  width: 100%; box-sizing: border-box; font-size: 12px; padding: 6px 8px;
  font-family: var(--font-mono);
  border: 1px solid var(--border2); border-radius: 7px; background: var(--bg3); color: var(--text);
}
.dp-redis-mode-content textarea { resize: none; min-height: 54px; }
.dp-redis-mode-content input:focus, .dp-redis-mode-content textarea:focus {
  outline: none; border-color: var(--accent);
}
/* Results: master-detail — keys list scrolls in its own pane so VALUE stays visible below */
#dp-redis-results { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#dp-redis-results > .dp-section-label { flex-shrink: 0; }
#dp-redis-filter-results { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#dp-redis-raw-results { flex: 1; min-height: 0; overflow-y: auto; }
#dp-redis-keys { flex: 4 1 0; min-height: 0; overflow-y: auto; }
#dp-redis-value { flex: 6 1 0; min-height: 0; overflow-y: auto; }
.dp-redis-vlabel {
  flex-shrink: 0;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text2); padding: 8px 14px 4px; margin-top: 6px; border-top: 1px solid var(--border2);
}
#dp-redis-count { margin-left: 8px; font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text2); }
.dp-redis-key { display: flex; gap: 8px; align-items: center; padding: 6px 8px; cursor: pointer; border-bottom: 1px solid var(--border2); }
.dp-redis-key:hover { background: var(--bg3); }
.dp-redis-type { font-size: 11px; color: var(--text2); border: 1px solid var(--border2); border-radius: 5px; padding: 0 5px; }
.dp-redis-keyname { flex: 1; font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.dp-redis-ttl { font-size: 11px; color: var(--text2); }
.dp-redis-vhdr { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); padding: 6px 8px; }
.dp-redis-vhdr-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dp-redis-pretty {
  flex-shrink: 0; padding: 2px 10px; border-radius: 6px; border: 1px solid var(--border2);
  background: none; color: var(--text2); font-size: 11px; font-family: var(--font-body);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.dp-redis-pretty:hover { background: var(--bg3); }
.dp-redis-pretty.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.dp-redis-pretty:disabled { opacity: 0.6; cursor: default; }
#dp-redis-value pre, #dp-redis-cmd-result pre { margin: 0; padding: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.dp-redis-note { font-size: 11px; color: var(--text2); padding: 4px 8px; }
#dp-redis-more, .dp-redis-vmore { flex-shrink: 0; margin: 6px 8px; border: 1px solid var(--border2); background: none; color: var(--text2); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
#close-db-panel {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text2); padding: 2px 6px;
  border-radius: 6px; transition: color 0.12s; flex-shrink: 0;
}
#close-db-panel:hover { color: var(--text); }

/* Tables section */
#dp-tables-section {
  height: 80px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}
.dp-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  padding: 6px 14px 4px;
}
#dp-tables-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 10px;
}
.dp-table-chip {
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.dp-table-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Query section */
#dp-query-section {
  height: 170px;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.dp-mode-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dp-mode-btn {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: none;
  font-size: 11px;
  font-family: var(--font-body);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dp-mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#dp-run-btn {
  margin-left: auto;
  padding: 4px 14px;
  border-radius: 7px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: opacity 0.12s;
}
#dp-run-btn:hover { opacity: 0.85; }
#dp-run-btn:disabled { opacity: 0.4; cursor: default; }
.dp-mode-content { display: none; flex: 1; overflow: auto; }
.dp-mode-content.active { display: flex; flex-direction: column; }
#dp-raw-input {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--bg2);
  color: var(--text);
  line-height: 1.5;
  box-sizing: border-box;
}
#dp-raw-input:focus { outline: none; }
#dp-filter-table-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#dp-filter-table-row label {
  font-size: 11px;
  color: var(--text2);
  flex-shrink: 0;
}
#dp-filter-table {
  flex: 1;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  font-size: 12px;
}
#dp-filter-rows {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dp-filter-row {
  display: flex;
  gap: 4px;
  align-items: center;
}
.dp-filter-row select, .dp-filter-row input {
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  font-size: 11px;
}
.dp-filter-row select { flex-shrink: 0; }
.dp-filter-row input { flex: 1; min-width: 0; }
.dp-filter-row button {
  background: none; border: none; cursor: pointer;
  color: var(--text2); font-size: 14px; padding: 0 4px;
  flex-shrink: 0;
}
.dp-filter-row button:hover { color: var(--danger-red); }
#dp-filter-add {
  margin: 4px 10px 6px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border2);
  background: none;
  color: var(--text2);
  font-size: 11px;
  cursor: pointer;
  align-self: flex-start;
  flex-shrink: 0;
}
#dp-filter-add:hover { border-color: var(--accent); color: var(--accent); }
#dp-ai-mode { padding: 8px 10px; gap: 6px; }
.dp-ai-input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
  flex-shrink: 0;
}
#dp-ai-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border2);
  border-radius: 8px;
  resize: none;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-body);
  background: var(--bg3);
  color: var(--text);
  box-sizing: border-box;
}
#dp-ai-input:focus { outline: none; border-color: var(--accent); }
#dp-ai-generate {
  padding: 4px 10px;
  border-radius: 7px;
  border: none;
  background: var(--accent-purple, #7C5CBF);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
#dp-ai-generate:disabled { opacity: 0.5; cursor: default; }
#dp-ai-preview {
  flex: 1;
  overflow: auto;
  background: var(--bg3);
  border-radius: 7px;
  border: 1px solid var(--border2);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}
#dp-ai-preview:empty { display: none; }

/* Results section */
#dp-results-section {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#dp-results-inner {
  flex: 1;
  overflow: auto;
  padding: 0 0 8px;
}
/* Results label row with export button */
#dp-results-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 10px;
}
.dp-export-btn {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.dp-export-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Single-row vertical display (\G style) */
.dp-result-vertical {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dp-result-vertical th {
  width: 40%;
  padding: 5px 10px 5px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--text2);
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}
.dp-result-vertical td {
  padding: 5px 14px 5px 10px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.dp-result-vertical tr:hover th,
.dp-result-vertical tr:hover td { background: var(--bg3); }

.dp-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dp-result-table th {
  position: sticky;
  top: 0;
  background: var(--bg3);
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
  color: var(--text2);
  font-size: 11px;
}
.dp-result-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dp-result-table tr:hover td { background: var(--bg3); }
.dp-result-json {
  margin: 0;
  padding: 10px 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}
.dp-empty {
  color: var(--text2);
  font-size: 12px;
  padding: 16px 14px;
}
.dp-error {
  color: var(--danger-red);
  font-size: 12px;
  padding: 10px 14px;
  background: rgba(214,48,49,0.06);
  border-radius: 7px;
  margin: 8px 10px;
}
.dp-truncated {
  font-size: 11px;
  color: var(--text2);
  padding: 4px 14px;
  font-style: italic;
}

/* Mobile: hide db-panel */
@media (max-width: 768px) {
  #db-panel { display: none !important; }
}

/* ── Buddep Panel ─────────────────────────────────────────────────────────────── */
#buddep-panel {
  --bd-width: 357px;   /* ~15% narrower default; user can still drag 280–700 */
  width: var(--bd-width);
  min-width: var(--bd-width);
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
#buddep-panel.open {
  display: flex;
  animation: cpSlideIn 0.18s ease;
}
#bd-resize-handle {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 2;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: background 0.15s;
}
#bd-resize-handle:hover, #bd-resize-handle.active {
  background: var(--accent);
  opacity: 0.35;
}
#buddep-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg3);
}
#bd-title {
  display: flex;
  flex-direction: column;
  margin-right: auto;
  min-width: 0;
}
#bd-appname {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-head);
}
#bd-url {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#bd-url:hover { text-decoration: underline; }
.bd-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.bd-tab {
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: none;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.bd-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#close-buddep-panel {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text2); padding: 2px 6px;
  border-radius: 6px; transition: color 0.12s; flex-shrink: 0;
}
#close-buddep-panel:hover { color: var(--text); }
.bd-content { display: none; flex: 1; overflow: auto; }
.bd-content.active { display: block; }

/* ── Metrics cards / tabs (shared by the in-layout metrics panel) ── */
.mp-tab {
  padding: 6px 16px; border-radius: 9px; border: 1px solid var(--border2);
  background: var(--bg2); font-size: 13px; font-family: var(--font-body);
  color: var(--text2); cursor: pointer; transition: background 0.12s, color 0.12s;
}
.mp-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Cards + grid */
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mp-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; min-width: 0;
}
.mp-card.wide { grid-column: 1 / -1; }
.mp-card-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text2); margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px;
}
.mp-card-label b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.mp-big { font-size: 22px; font-weight: 700; color: var(--text); font-family: var(--font-head);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.mp-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* "Today" card — four stats as small sub-cards (same treatment as PageSpeed vitals) */
.mp-today { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mp-today-stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 8px; text-align: center; min-width: 0; }
.mp-today-stat .mp-big { font-size: 20px; }
.mp-today-cap { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text2); margin-top: 3px; }

/* Users tab (Slice 1b) — copy prompt + retention table */
.mp-copy { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; margin: 8px 0; font-size: 12px; color: var(--text);
  font-family: var(--font-body); line-height: 1.5;
  white-space: pre-wrap; text-align: left; }
.mp-ret-wrap { overflow-x: auto; }   /* extra D3/D5 columns never overflow the page */
.mp-ret { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px;
  font-variant-numeric: tabular-nums; }
.mp-ret th, .mp-ret td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--border); }
.mp-ret th:first-child, .mp-ret td:first-child { text-align: left; }
.mp-ret th { color: var(--text2); font-weight: 600; }

/* Status pill */
.mp-status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.mp-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.mp-st-up   { color: var(--mx-ok); }      .mp-st-up   .mp-status-dot { background: var(--mx-ok); }
.mp-st-degr { color: var(--warn); }        .mp-st-degr .mp-status-dot { background: var(--warn); }
.mp-st-down { color: var(--danger-red); }  .mp-st-down .mp-status-dot { background: var(--danger-red); }
.mp-st-stale{ color: var(--text2); }       .mp-st-stale .mp-status-dot { background: var(--text2); }

/* Mem gauge */
.mp-gauge-track { height: 10px; border-radius: 5px; background: var(--border2); overflow: hidden; }
.mp-gauge-fill { height: 100%; border-radius: 5px; transition: width 0.3s; }

/* Time-range selector (web/api charts) */
.mp-range { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.mp-range-btn {
  padding: 3px 9px; border-radius: 7px; border: 1px solid var(--border2);
  background: var(--bg2); color: var(--text2); font-size: 11.5px;
  font-family: var(--font-body); cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.mp-range-btn:hover { border-color: var(--accent); color: var(--accent); }
.mp-range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Site Health (PageSpeed) — same rounded card as the traffic charts below */
.mp-sh { margin-bottom: 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; }
.mp-sh-head { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 10px;
  font-family: var(--font-head); letter-spacing: 0.3px; }
.mp-rings { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-ring { flex: 1 1 0; min-width: 66px; text-align: center; }
.mp-ring svg { width: 48px; height: 48px; }
.mp-ring-bg { fill: none; stroke: var(--border2); stroke-width: 4; }
.mp-ring-fg { fill: none; stroke-width: 4; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 24px 24px; transition: stroke-dashoffset .4s; }
.mp-ring text { font-size: 15px; font-weight: 700; font-family: var(--font-head); }
.mp-ring-label { font-size: 10px; color: var(--text2); margin-top: 2px; }
.mp-vitals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mp-vital { flex: 1 1 0; min-width: 56px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 4px; text-align: center; }
.mp-vital i { display: block; font-style: normal; font-size: 9.5px; font-weight: 600;
  letter-spacing: .04em; color: var(--text2); }
.mp-vital b { display: block; margin-top: 3px; font-size: 14px; font-weight: 700; line-height: 1.1;
  font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.mp-sh-mobile { margin-top: 8px; font-size: 11px; color: var(--text2);
  font-variant-numeric: tabular-nums; }
/* [Retry] on a failed / half-failed Site Health card. ⚠️ min-height 44px is the touch target
   (ai.md), and it is reached with padding + inline-flex rather than a fixed height so the
   button still sits on the same line as the sentence it belongs to. Colors are tokens, never
   literals — this card renders on both themes. */
.mp-retry { display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 12px; margin-left: 6px; vertical-align: middle;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg2);
  color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.mp-retry:hover { border-color: var(--accent); color: var(--accent); }
.mp-retry:disabled { opacity: .45; cursor: default; }
.mp-tips { margin-top: 12px; }
.mp-tips-h { font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text2); margin-bottom: 6px; }
.mp-tip { border-top: 1px solid var(--border); padding: 7px 0; }
.mp-tip summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer;
  font-size: 12px; color: var(--text); list-style: none; }
.mp-tip summary::-webkit-details-marker { display: none; }
.mp-tip summary b { color: var(--text2); font-weight: 600; white-space: nowrap; }
.mp-tip-desc { font-size: 11.5px; color: var(--text2); margin-top: 5px; line-height: 1.5; }

/* Sparkline */
.mp-spark { width: 100%; height: 44px; display: block; cursor: crosshair; }
/* Sparkline hover — shared floating tooltip + point marker */
#mp-tooltip {
  position: fixed; z-index: 3000; display: none; flex-direction: column; gap: 1px;
  pointer-events: none; background: var(--text); color: var(--bg2);
  padding: 5px 9px; border-radius: 7px; box-shadow: var(--shadow-sm); white-space: nowrap;
}
#mp-tooltip b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
#mp-tooltip span { opacity: 0.75; font-size: 10.5px; }
#mp-spark-dot {
  position: fixed; z-index: 3000; display: none; pointer-events: none;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg2); box-shadow: 0 0 0 1px var(--accent);
}
.mp-spark-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.mp-spark-area { fill: var(--accent-pale); stroke: none; }
.mp-spark-grid { stroke: var(--border); stroke-width: 1; }

/* Status-mix stacked bar */
.mp-mix-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: transparent; }
.mp-mix-seg { height: 100%; }
.mp-mix-2xx { background: var(--mx-ok); }
.mp-mix-4xx { background: var(--warn); }
.mp-mix-5xx { background: var(--danger-red); }
.mp-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--text2); }
.mp-legend span { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.mp-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* States */
.mp-state { padding: 40px 16px; text-align: center; color: var(--text2); font-size: 13px; }
.mp-state .mp-retry { margin-top: 10px; padding: 6px 16px; border: 1px solid var(--border2);
  border-radius: 8px; background: var(--bg2); color: var(--accent); font-size: 12px; cursor: pointer; }
.mp-state .mp-retry.mp-copied { cursor: default; color: var(--mx-ok); border-color: var(--mx-ok);
  background: var(--bg3); opacity: 0.85; }
.mp-spinner { width: 26px; height: 26px; border: 3px solid var(--border2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
.app-open-hint { flex-shrink: 0; font-size: 12px; opacity: 0.45; }
.deploy-item:hover .app-open-hint { opacity: 0.85; }
#bd-module-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bd-module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border2);
}
.bd-module-icon { font-size: 18px; }
.bd-module-info { flex: 1; min-width: 0; }
.bd-module-name { font-size: 13px; font-weight: 600; color: var(--text); }
.bd-module-url { font-size: 11px; color: var(--accent); text-decoration: none; }
.bd-module-url:hover { text-decoration: underline; }
.bd-module-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.bd-status-deployed { background: #1a3d2b; color: #4caf50; }
.bd-status-not_started { background: var(--bg4); color: var(--text2); }
.bd-status-failed { background: #3d1a1a; color: #f44336; }
.bd-status-deploying, .bd-status-building { background: #1a2d3d; color: #64b5f6; }
.mod-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.mod-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  padding: 2px 6px; border-radius: 4px; color: #fff;
  opacity: 0.9;
}
.mod-badge-icon {
  background: none; padding: 2px 3px; border-radius: 3px;
  display: inline-flex; align-items: center;
}
#bd-deploy-list, #bd-build-list {
  flex: 0 0 36%;
  border-bottom: 1px solid var(--border);
  overflow-y: auto;
}
#bd-deploy-detail, #bd-build-detail {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px;
  font-size: 12px;
  color: var(--text2);
  min-height: 0;
}
.bd-detail-table {
  flex-shrink: 0;
  max-height: 32%;
  overflow-y: auto;
}
.bd-log-viewer {
  flex: 1;
  overflow: auto;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  min-height: 0;
}
#bd-deploys, #bd-builds {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
#bd-deploys.active, #bd-builds.active { display: flex; }
.bd-record-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.bd-record-item:hover { background: var(--bg3); }
.bd-record-item.active { background: var(--bg4); border-left: 3px solid var(--accent); }
.bd-record-title { font-weight: 600; color: var(--text); }
.bd-record-meta { color: var(--text2); font-size: 11px; margin-top: 2px; }

#cp-files, #cp-history { flex: 1; overflow: hidden; display: none; flex-direction: column; }
#cp-files.active, #cp-history.active { display: flex; }

/* File tab: tree + viewer split */
#cp-file-tree {
  overflow-y: auto;
  border-bottom: 1px solid var(--border);
  min-height: 120px;
  max-height: 40%;
  padding: 8px 0;
}
.ft-dir, .ft-file {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; cursor: pointer;
  font-size: 13px; font-family: var(--font-body);
  transition: background 0.1s;
  user-select: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ft-dir:hover, .ft-file:hover { background: var(--bg3); }
.ft-file.active { background: var(--accent-pale); color: var(--accent); }
.ft-icon { font-size: 13px; flex-shrink: 0; }
.ft-file > img, .ft-folder-icon { width: 14px; height: 14px; flex-shrink: 0; }
.ft-children { padding-left: 16px; }
.ft-dir .ft-toggle { font-size: 10px; color: var(--text2); flex-shrink: 0; }

#cp-file-viewer {
  flex: 1; overflow: auto; background: #f8f9fc;
  padding: 16px;
}
#cp-file-viewer pre {
  margin: 0; font-size: 12px; line-height: 1.6;
  white-space: pre;
}
#cp-file-viewer pre code {
  font-family: var(--font-mono) !important;
  font-size: 12px;
}
#cp-file-viewer .cp-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text2); font-size: 13px;
}
/* Rendered markdown (README / CHANGELOG / docs) — GitHub-like */
.cp-md { font-size: 14px; line-height: 1.65; color: var(--text); word-wrap: break-word; }
.cp-md h1, .cp-md h2 { border-bottom: 1px solid var(--border2); padding-bottom: .3em; margin: 1em 0 .6em; }
.cp-md h1 { font-size: 1.6em; } .cp-md h2 { font-size: 1.3em; } .cp-md h3 { font-size: 1.1em; margin: 1em 0 .5em; }
.cp-md p, .cp-md ul, .cp-md ol, .cp-md blockquote, .cp-md table { margin: 0 0 .8em; }
.cp-md ul, .cp-md ol { padding-left: 1.6em; }
.cp-md code { background: var(--surface2); padding: .15em .4em; border-radius: 4px; font-size: .88em;
  font-family: var(--font-mono); }
.cp-md pre { background: var(--surface2); padding: 12px; border-radius: 6px; overflow: auto; margin: 0 0 .8em; }
.cp-md pre code { background: none; padding: 0; font-size: 12px; }
.cp-md a { color: var(--accent); }
.cp-md blockquote { border-left: 3px solid var(--border2); padding-left: 1em; color: var(--text2); }
.cp-md table { border-collapse: collapse; } .cp-md th, .cp-md td { border: 1px solid var(--border2); padding: 6px 10px; }
.cp-md img { max-width: 100%; }

/* History tab */
#cp-commit-list {
  overflow-y: auto;
  max-height: 40%;
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
.cp-commit {
  padding: 8px 14px; cursor: pointer;
  transition: background 0.1s; border-bottom: 1px solid var(--border);
}
.cp-commit:hover { background: var(--bg3); }
.cp-commit.active { background: var(--accent-pale); }
.cp-commit-msg { font-size: 12.5px; font-weight: 600; color: var(--text); }
.cp-commit-meta { font-size: 11px; color: var(--text2); margin-top: 2px; }
.cp-commit-badge {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 700; font-family: var(--font-head);
  background: var(--accent-pale); color: var(--accent);
  margin-left: 6px;
}
#cp-diff-viewer {
  flex: 1; overflow: auto; padding: 12px 14px;
  font-size: 12px;
}
#cp-diff-viewer .cp-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text2); font-size: 13px;
}
/* diff2html overrides */
.d2h-wrapper { font-size: 12px !important; }
.d2h-file-header { font-size: 11px !important; padding: 6px 10px !important; }
.d2h-code-line { font-size: 12px !important; }
.d2h-code-side-linenumber { padding: 0 12px 0 8px !important; }
.d2h-code-line-prefix { min-width: 18px; display: inline-block; text-align: center; }

/* Code Panel button in topbar */
#code-panel-btn {
  display: none;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
#code-panel-btn:hover { background: var(--bg4); border-color: var(--accent); color: var(--accent); }
#code-panel-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 640px) {
  #code-panel { width: 100%; right: -100%; }
  #code-panel.open { right: 0; }
}

/* ── Break-lock bubble buttons ─────────────────────────────────────────────── */
.blb-btn {
  padding: 4px 12px; border-radius: 5px; border: none;
  cursor: pointer; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.blb-resend { background: #f9a825; color: #fff; }
.blb-resend:hover { background: #f57f17; }
.blb-dismiss { background: #eee; color: #666; }
.blb-dismiss:hover { background: #ddd; }

@media (max-width: 640px) {
  .pf-modal { max-width: 460px !important; }
  .pf-body { flex-direction: column; gap: 10px; }
  .pf-rail { flex-direction: row; flex: 0 0 auto; border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 6px; overflow-x: auto; }
  .pf-rail-item { white-space: nowrap; padding: 8px 14px; }
  .pf-panes { overflow-y: visible; }
}

/* ── Profile usage chart ─────────────────────────────────────────────────── */
.pf-usage-tiles { display: flex; gap: 8px; margin: 6px 0 10px; }
.pf-usage-tile { flex: 1; text-align: center; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; }
.pf-usage-tile b { display: block; font-size: 18px; color: var(--text); }
.pf-usage-tile span { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: .4px; }
.pf-usage-chart { display: flex; align-items: flex-end; gap: 2px; height: 64px; padding: 4px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; }
.pf-usage-bar { flex: 1; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85; }
.pf-usage-bar.empty { background: var(--border2); opacity: .5; }
/* #1113: Balance cards — same tiles as Usage; a low balance turns its number amber. */
.pf-wallet-tiles .pf-usage-tile b { font-size: 16px; overflow-wrap: anywhere; }
.pf-usage-tile.low b { color: var(--warn); }
/* #1113: messages / tokens / spend by day — three rows, one shared day axis, one hover column. */
.pf-usage-chart3 { position: relative; padding: 6px 8px 4px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; }
.pf-uc-row { display: flex; align-items: stretch; gap: 8px; height: 44px; margin-bottom: 6px; }
.pf-uc-label { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text); }
.pf-uc-label small { font-size: 10px; font-weight: 400; color: var(--text2); white-space: nowrap; }
.pf-uc-bars { flex: 1; display: flex; align-items: stretch; gap: 2px; min-width: 0; border-bottom: 1px solid var(--border2); }
.pf-uc-col { flex: 1; display: flex; align-items: flex-end; min-width: 0; cursor: pointer; border-radius: 3px; }
.pf-uc-col .pf-usage-bar { width: 100%; }
.pf-uc-col.on { background: var(--accent-pale); }
.pf-uc-na { flex: 1; display: flex; align-items: center; font-size: 11px; color: var(--text2); }
.pf-uc-axis { display: flex; justify-content: space-between; margin-left: 72px; font-size: 10px; color: var(--text2); }
.pf-uc-tip { position: absolute; top: 4px; z-index: 2; min-width: 132px; padding: 6px 8px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px; box-shadow: var(--shadow-sm); font-size: 11px; color: var(--text); pointer-events: none; }
.pf-uc-tip b { display: block; margin-bottom: 2px; }
.pf-uc-tip div { display: flex; justify-content: space-between; gap: 12px; }
.pf-uc-tip div span:first-child { color: var(--text2); }
.pf-llm-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pf-llm-name { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-llm-action { margin-left: auto; }
.pf-llm-state { font-size: 11px; color: var(--text2); background: var(--bg3); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.pf-llm-state.mine { color: var(--accent); border-color: var(--accent); }
.pf-llm-edit { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.pf-llm-mask { font-family: var(--font-mono); font-size: 11px; color: var(--text2); letter-spacing: 0.3px; white-space: nowrap; }
.pf-llm-editbox { flex-basis: 100%; display: flex; gap: 8px; margin-top: 6px; }
.pf-llm-editbox input { flex: 1; }
/* My Profile 里那些**写一次就冻住**的配置（Bundle Prefix / Apple Developer Account）。

   ⚠️⚠️ **复用 My Devices 那套卡片**（`.pf-device` / `.pf-name` / `.pf-udid` / `.pf-badge`）
   —— 用户 2026-09-11 的两次反馈说的是同一件事：先是「太简陋了」（一行 `·` 串起来的灰字），
   然后是「搞成这个 row 跟上面 My Device 的样式不一致了」。
   **第二次才是根因：我上一刀发明了第二套行样式（`.pf-kv-*`），而这一屏已经有一套。**
   > 一屏里两套行样式，问题不是哪一套好看，是它们并排出现。

   下面这几个是**那套卡片没有的**几格，不是新的一套。 */

/* 高亮的 bundle —— 这一屏唯一要人一眼看到的东西（用户定：「加个颜色高亮」）。 */
.pf-bundle {
  font-family: var(--font-mono);
  /* ⚠️ **比它旁边那行（`.pf-name`，13px）小半格** —— 等宽字在同号下看着更大，
     13px/600 的等宽摆在 13px/600 的比例字旁边像是被放大了一号（用户 2026-09-11：
     *「这个包名 不用大字体 就 颜色高亮一下就行」*）。**高亮靠颜色，不靠字号。** */
  font-size: 12px;
  font-weight: 500;
  color: var(--accent2);
  background: var(--accent2-pale);
  border-radius: 5px;
  padding: 1px 5px;
  word-break: break-all;
}
/* 卡片里的次级说明（`Team … · Key …`、`Set up on …`）。 */
.pf-card-sub {
  font-size: 11.5px;
  color: var(--text2);
  margin-top: 3px;
  line-height: 1.5;
}
.pf-card-sub code {
  font-family: var(--font-mono);
  color: var(--text);
}
/* 一行「做过的事」：.p8 传过了 / 设过前缀了。⚠️ 它不是状态，是**收据**。 */
.pf-card-receipt {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text2);
  margin-top: 5px;
}
.pf-card-receipt code { font-family: var(--font-mono); color: var(--text2); }

.pf-ks-file { font-size: 12.5px; font-family: var(--font-mono); color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-ks-date { font-size: 12px; color: var(--text2); white-space: nowrap; }

/* ── Code Export & GitHub Sync ──────────────────────────────────────────── */
/* Match the Files/History (.cp-tab) look so the two buttons stay compact (no arrow icons) */
.cp-hdr-btn{padding:4px 12px;border-radius:7px;border:1px solid var(--border2);
  background:none;font-size:12px;font-family:var(--font-body);color:var(--text2);
  cursor:pointer;transition:background 0.12s,color 0.12s;}
.cp-hdr-btn:hover{background:var(--surface2);}
.modal-box{background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-lg);
  padding:24px;box-shadow:var(--shadow);}
.modal-x{background:none;border:none;cursor:pointer;font-size:18px;color:var(--text2);
  padding:2px 6px;border-radius:6px;transition:color 0.12s;}
.modal-x:hover{color:var(--text);}
.gh-box{max-width:560px;width:92%;}
.gh-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;}
.gh-key{font-family:var(--font-mono);font-size:11.5px;line-height:1.55;
  color:var(--text2);background:var(--surface2);border:1px solid var(--border);
  border-radius:var(--radius);padding:8px 10px;word-break:break-all;max-height:120px;overflow:auto;}
.gh-warn{background:var(--surface2);border-left:3px solid var(--warn,#e0a000);padding:8px 12px;
  font-size:13px;margin:12px 0;border-radius:var(--radius);}
.gh-input{width:100%;font-size:16px;padding:10px;border:1px solid var(--border);
  border-radius:var(--radius);box-sizing:border-box;margin:8px 0;}
/* Keep the input itself at 16px (avoids iOS focus zoom) but show a smaller, muted placeholder */
.gh-input::placeholder{font-size:13px;color:var(--text2);}
.gh-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:12px;}
.gh-status-fail{color:var(--danger,#d33);font-size:13px;}
.gh-status-ok{color:var(--text2);font-size:13px;}
.gh-recent{margin:8px 0;display:flex;flex-direction:column;gap:8px;}
.gh-recent-row{display:flex;flex-direction:column;gap:1px;padding-bottom:7px;border-bottom:1px solid var(--border2);}
.gh-recent-row:last-child{border-bottom:none;padding-bottom:0;}
.gh-recent-msg{font-size:13px;color:var(--text);word-break:break-word;}
.gh-recent-status{font-size:12px;}
.gh-push-ok{color:var(--success,#22c55e);}
.gh-push-pending{color:var(--warning,#f59e0b);}

/* ── System notifications ── */
.notif-modal-card { max-width: 460px; width: 92%; }
.notif-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.notif-modal-actions button { min-height: 40px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.notif-btn-secondary { border: 1px solid var(--border2); background: var(--bg3); color: var(--text); }
.notif-btn-secondary:hover { background: var(--bg4); }
.notif-item { border: 1px solid var(--border2); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.notif-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.notif-level { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.notif-level.info     { background: var(--accent-pale); color: var(--accent); }
.notif-level.warning  { background: var(--warn-pale);   color: var(--warn); }
.notif-level.critical { background: var(--danger-pale); color: var(--danger-red); }
.notif-about { font-size: 11px; color: var(--text2); }
.notif-title { font-weight: 600; color: var(--text); }
.notif-body  { font-size: 13px; color: var(--text2); white-space: pre-wrap; margin-top: 2px; }
.notif-resp  { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.notif-resp button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-size: 13px; }
.notif-tab-toggle { width: 100%; min-height: 38px; border: 1px solid var(--border2); border-radius: 10px; background: var(--bg3); color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; }
.notif-tab-toggle:hover { background: var(--bg4); }
.notif-dot { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--danger-red); border: 1.5px solid var(--bg2); }
.notif-unread { background: var(--accent-pale); }
.fb-new-btn { width: 100%; min-height: 40px; border: 1px solid var(--border2); border-radius: 10px; background: var(--bg3); color: var(--text); font-weight: 500; cursor: pointer; margin-top: 10px; }
.fb-new-btn:hover { background: var(--bg4); }
.fb-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.fb-form input, .fb-form textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border2); border-radius: 8px; background: var(--bg2); color: var(--text); font-size: 14px; font-family: inherit; }
.fb-form input:focus, .fb-form textarea:focus { outline: none; border-color: var(--accent); }
.fb-form textarea { resize: vertical; }
.fb-img-hint { font-size: 11px; color: var(--text2); }
.fb-add-tile { width: 60px; height: 60px; border-radius: 8px; border: 1px dashed var(--border2); background: var(--bg2); color: var(--text2); font-size: 26px; font-weight: 300; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.fb-add-tile:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-pale); }
.fb-staged .fb-add-tile { width: 54px; height: 54px; }
.fb-staged { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-staged:empty { display: none; }
.fb-staged-item { position: relative; width: 54px; height: 54px; }
.fb-staged-item img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border2); }
.fb-staged-rm { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: none; background: var(--danger-red); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fb-about-label { font-size: 11px; font-weight: 600; color: var(--text2); }
.fb-about-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-chip { background: var(--bg2); border: 1px solid var(--border2); border-radius: 14px; padding: 3px 11px; font-size: 11.5px; color: var(--text2); cursor: pointer; user-select: none; transition: background .15s, border-color .15s, color .15s; }
.fb-chip:hover { background: var(--accent-pale); border-color: var(--accent); color: var(--accent); }
.fb-chip.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.fb-form-actions, .fb-composer-actions { display: flex; gap: 8px; }
.fb-form-actions { margin-top: 2px; }
.fb-submit-btn, .fb-send-btn { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
.fb-cancel-btn { min-height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text); cursor: pointer; }
.fb-btn-loading { pointer-events: none; opacity: 0.85; }
.fb-btn-loading::after { content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 7px; vertical-align: -1px; border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.fb-err { color: var(--danger-red); font-size: 12px; min-height: 14px; }
.fb-thread { display: flex; flex-direction: column; gap: 8px; }
.fb-head { display: flex; align-items: center; gap: 8px; }
.fb-about { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--accent-pale); color: var(--accent); }
.fb-status { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.fb-status-open { background: var(--accent-pale); color: var(--accent); }
.fb-status-in_progress { background: var(--warn-pale); color: var(--warn); }
.fb-status-resolved { background: var(--bg3); color: var(--text2); }
.fb-status-withdrawn { background: var(--bg3); color: var(--text2); }
.fb-title { font-weight: 600; color: var(--text); }
.fb-body { font-size: 13px; color: var(--text2); white-space: pre-wrap; }
.fb-time { font-size: 11px; color: var(--text2); opacity: 0.75; }
.fb-shots { display: flex; gap: 6px; flex-wrap: wrap; }
.fb-shot { width: 60px; height: 60px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border2); background: var(--bg3) center / cover no-repeat; }
.fb-shot-loading { cursor: default; position: relative; }
.fb-shot-loading::after { content: ''; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
.fb-resolution { border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; background: var(--accent-pale); font-size: 13px; }
.fb-replies { display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }
.fb-reply { font-size: 12.5px; color: var(--text); line-height: 1.5; }
.fb-reply-time { font-size: 10px; color: var(--text2); opacity: 0.8; margin-right: 5px; }
.fb-reply-who { font-size: 11px; font-weight: 600; color: var(--text2); margin-right: 4px; }
.fb-reply-text { white-space: pre-wrap; word-break: break-word; }
.fb-composer { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.fb-composer-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fb-link { background: none; border: none; padding: 0; color: var(--accent); font-size: 13px; font-weight: 500; cursor: pointer; }
.fb-link:hover { text-decoration: underline; }
.fb-link-danger { color: var(--danger-red); }
.fb-reply-box { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.fb-composer textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border2); border-radius: 8px; background: var(--bg2); color: var(--text); font-size: 14px; font-family: inherit; resize: vertical; }
/* reply composer: compact textarea (no blue focus ring) + smaller Send/Cancel */
#fb-reply-text { font-size: 12.5px; padding: 5px 8px; }
#fb-reply-text:focus { outline: none; border-color: var(--border2); }
.fb-composer-actions button { min-height: 26px; padding: 0 10px; font-size: 12.5px; }

/* ── Ops mode: hide Vibe-only chrome, show the Opsai label (project bar stays) ── */
#ops-tool-label { display: none; }
body.ops-mode #tool-select,
body.ops-mode #code-panel-btn,
body.ops-mode #cancel-btn,
body.ops-mode #session-group { display: none !important; }
body.ops-mode #ops-tool-label { display: inline-flex; align-items: center; }
#ops-tool-label {
  font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 4px 10px; border: 1px solid var(--border2); border-radius: var(--radius);
}

/* ── Metrics panel: resizable inline panel, mirrors the code panel ── */
#metrics-panel {
  --mp-width: 420px;
  width: var(--mp-width); min-width: var(--mp-width); flex-shrink: 0;
  display: none; flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
#metrics-panel.open { display: flex; animation: cpSlideIn 0.18s ease; }
#mp-resize-handle {
  position: absolute; top: 0; left: 0; bottom: 0; width: 6px;
  cursor: col-resize; z-index: 2; transition: background 0.15s;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
#mp-resize-handle:hover, #mp-resize-handle.active { background: var(--accent); opacity: 0.35; }
#metrics-panel-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; background: var(--bg3);
  flex-wrap: wrap;   /* module tabs live here; wrap to a second row if they don't fit */
}
#mp-title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
#mp-appname { font-size: 15px; font-weight: 700; color: var(--text); font-family: var(--font-head); }
#mp-url { font-size: 12px; color: var(--accent); text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
#mp-url:hover { text-decoration: underline; }
#close-metrics-panel {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: var(--text2); cursor: pointer; padding: 0 4px; flex-shrink: 0;
}
#close-metrics-panel:hover { color: var(--text); }
#mp-top-tabs { display: flex; gap: 6px; flex-wrap: wrap; }   /* sits inline in the header, like other panels */
#metrics-panel .mp-tab { padding: 4px 12px; font-size: 12px; }   /* smaller tabs inside the panel */
#mp-body { flex: 1; overflow-y: auto; padding: 14px; }
#metrics-panel .mp-grid { grid-template-columns: 1fr; }          /* single column, top-to-bottom */

/* ── My Servers (profile tab) ──────────────────────────────────────────────── */
.srv-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  /* 卡片自己也要能缩，否则问题只是从 .byoc-kv 搬到了它的外面一层。 */
  min-width: 0;
}
.srv-head { display: flex; align-items: center; gap: 8px; }
/* ⚠️ `min-width: 0` 是让下面那三行**真的生效**的那一行（2026-08-24 补）。
   flex 项的默认 `min-width: auto` 会把它停在自己的全长上 ⇒ **永远不会窄到
   需要省略号的那一刻**，于是 45 字符的 agent_id 原样把卡片撑宽。
   声明在、看起来对、一行没生效 —— 与 `.byoc-kv` 那条是同一个根因的两个调用点。 */
.srv-name {
  font-family: var(--font-head);
  font-size: 14px; font-weight: 600; color: var(--text);
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Three states, not two: "never checked in" is a different situation from
   "stopped answering", and collapsing them hides a box that never worked. */
.srv-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.srv-dot.on    { background: var(--mx-ok); box-shadow: 0 0 0 3px var(--mx-ok-pale); }
.srv-dot.off   { background: var(--danger-red); box-shadow: 0 0 0 3px var(--danger-pale); }
.srv-dot.never { background: var(--text2); }
.srv-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--accent); background: var(--accent-pale);
  padding: 2px 6px; border-radius: 5px;
}
.srv-sub { font-size: 12px; color: var(--text2); margin-top: 3px; }
.srv-metrics { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.srv-metric { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.srv-metric-label { color: var(--text2); width: 54px; flex: none; }
.srv-metric-val { color: var(--text2); width: 36px; text-align: right; flex: none; }
.srv-metric-none { color: var(--text2); font-style: italic; }
.srv-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--bg4); overflow: hidden;
}
.srv-bar-fill { display: block; height: 100%; border-radius: 3px; }
.srv-bar-fill.ok   { background: var(--mx-ok); }
.srv-bar-fill.warm { background: var(--warn); }
.srv-bar-fill.hot  { background: var(--danger-red); }
.srv-foot {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 11px; color: var(--text2);
}
.srv-warn { color: var(--warn); }
/* 左对齐整块 —— 上一版标题居中而 `.pf-hint` 被单独扳回左边，两种对齐混在一格里。 */
.srv-empty { padding: 16px 2px 8px; color: var(--text2); }
.srv-empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* ⚠️ 这一格**不在 `.modal-actions` 里**，所以 `.btn-primary` / `.btn-cancel` 只拿得到
   自己那一行背景色 —— padding、圆角、`border: none` 全在 `.modal-actions button`
   这个后代选择器上。而 `.btn-secondary` **在这份 CSS 里根本不存在**。
   两者叠加的结果就是「按钮背景很丑」：一个带默认黑边的裸 <button>，或者一条
   没有内边距的全宽渐变色块。⇒ 这一格用自己的一套，不借别处的类名。 */
.srv-btn {
  font-family: var(--font-head); font-size: 13px; font-weight: 600;
  padding: 8px 16px; min-height: 38px; border-radius: 9px;
  border: 1px solid var(--border2); background: var(--bg2); color: var(--text);
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.srv-btn:hover { background: var(--bg3); border-color: var(--border); }
.srv-btn.primary { background: var(--accent-pale); border-color: transparent; color: var(--accent); }
.srv-btn.primary:hover { background: var(--bg4); }
.srv-btn.danger { color: var(--danger-red); }
.srv-btn:disabled { opacity: 0.55; cursor: default; }

.srv-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px;
}
/* ⚠️ 2026-08-26 起**暂时没有引用**：有机器之后不再给「再接一台」的入口
   （一机一人 —— 下游还不支持两台）。规则留着，等多机支持了它就回来；
   删掉的话下一个人会照着别处的按钮再拼一遍。 */
.srv-add-row { display: flex; justify-content: center; margin-top: 14px; }

/* ⚠️ 这里曾经是 `.srv-choice` —— 三张整行卡片，每张带标题 + 副标题 + 左侧 accent 竖条。
   那**是这个 app 里「一条数据」的形状**（APPs 列表行、Sessions 列表行、`.dist-card`
   全都长这样），于是三个动作被读成了三条记录。
   ⇒ 现在它们就是按钮：宽度随内容（不是整行），说明文字在按钮**外面**，
   第三条路在一条分隔线之下 —— 层级由位置表达，不由第四种卡片样式表达。 */
.srv-pick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.srv-pick .srv-btn { min-height: 42px; padding: 10px 18px; font-size: 13.5px; }
.srv-pick-note { margin-top: 10px; line-height: 1.5; }
.srv-pick-alt {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 12px; color: var(--text2);
}

/* 状态 ②：云账号绑好了、还没开机器。一朵云一行。
   ⚠️ 每条规则自带 padding / 圆角 / 边框，**不依赖任何祖先** —— [BUG-071] 就是
   借了 `.btn-primary`，而它的另一半住在 `.modal-actions button` 上。
   ⚠️ 这里刻意**不是** `.srv-card` 的形状：那是「一台机器」的形状，而这一行
   说的是「一把 key」。借一个语义属于别人的形状正是 [BUG-072]。 */
.srv-keys { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.srv-key-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg2);
}
.srv-key-name { font-weight: 600; color: var(--text); font-size: 13px; }
.srv-key-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--accent); background: var(--accent-pale);
  padding: 2px 6px; border-radius: 5px;
}
/* ⚠️ **动作自己占一行、左对齐**（用户 2026-08-28）。
   在此之前是 `margin-left:auto` 推到右边 —— 而名字与 tag 在左、按钮在右，
   眼睛要横跨整行才读得完「这把 key 能做什么」。
   `flex-basis:100%` 让它**总是**换行（不靠宽度碰巧），
   flex-wrap 仍然管 375px 上三个按钮自己再换一次
   （固定宽度会把最后一个挤出去 —— 通用原则 29 的同一个理由）。 */
.srv-key-actions {
  flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px;
}

/* ── BYOC-provision：用用户自己的云账号开机器 ────────────────────────────────
   全部视觉值走 :root 变量（ai.md 的硬性要求）。这一段刻意不引入任何新颜色、
   新字体、新圆角 —— 它是 Console 里的一个面板，不是一个独立品牌。       */

.byoc-step-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 2px; }

.byoc-step {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13px; color: var(--text2);
  transition: background 0.15s, color 0.15s;
}
/* ⚠️ **进行中那一步要动**（用户 2026-08-28）。
   九步里最慢的是「Install and call home」—— 真机上装基础环境 + 等 agent
   enroll 要几十秒到几分钟，而在此之前那一行与 pending 行**长得一模一样**
   （底色浅、只多一个 `›`）⇒ 用户分不出「正在跑」和「卡住了」。
   ⚠️ 动画走**行底色的一道高光**，不碰文字本身：`background-clip:text`
   那种写法在不支持时会让文字**整个消失**，而这一格恰恰是用户盯着看的那一格
   —— 一个失败起来会把信息弄没的装饰，不值得。
   ⚠️ 同一条 class 也被 bind 那四步用着（`_srvPickDomain`），白拿。 */
.byoc-step.active {
  color: var(--text);
  background-color: var(--accent-pale);
  background-image: linear-gradient(90deg,
      rgba(255,255,255,0) 0%, var(--bg2) 45%, var(--bg2) 55%,
      rgba(255,255,255,0) 100%);
  background-repeat: no-repeat;
  background-size: 55% 100%;
  animation: byoc-sweep 1.9s ease-in-out infinite;
}
@keyframes byoc-sweep {
  0%   { background-position: -70% 0; }
  100% { background-position: 170% 0; }
}
/* 那个 `›` 跟着一起呼吸 —— 高光扫到头的间隙里，它是唯一还在动的东西。 */
.byoc-step.active .byoc-step-mark { animation: byoc-pulse 1.9s ease-in-out infinite; }
@keyframes byoc-pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
.byoc-step.done   { color: var(--text); }
.byoc-step.failed { background: var(--danger-pale); color: var(--text); }
/* ⚠️ 「域名成了、证书没成」既不是 done 也不是 failed —— 用 done 就是一句
   「一切正常」盖在一个没有证书的域名上（#828 那条），用 failed 则会让用户
   以为域名也没绑上、去点第二次，**而选域名点第二次是再签一张证书**。 */
.byoc-step.warn   { background: var(--warn-pale); color: var(--text); }

/* ⚠️ **这里没有圆圈，而那是这条规则存在的理由**（#804，用户原话：
   「每一步 前面别弄小圆圈吧 我一看以为又要让我选东西」）。
   上一版给每一步画了一个 18px 的空心圆（`border-radius:50%` + 1px 边框）——
   而**每行前面一个一模一样的空心圆，就是这个星球上「单选」的通用形状**。
   这一格里它出现在两个真的要选东西的界面（region / size）之后，
   于是一个纯粹的**进度**列表被读成了第三个选择题。

   判据换成：**只有已经发生的事才画记号，还没发生的什么都不画。**
   槽位仍占 16px 以保持文字对齐 —— 对齐要留，圆圈不能留。 */
.byoc-step-mark {
  width: 16px; flex: 0 0 16px;
  text-align: center; font-size: 12px; line-height: 1;
  font-family: var(--font-mono); color: var(--text2);
}
.byoc-step.done   .byoc-step-mark { color: var(--mx-ok); }
.byoc-step.active .byoc-step-mark { color: var(--accent); }
.byoc-step.failed .byoc-step-mark { color: var(--danger-red); }
.byoc-step.warn   .byoc-step-mark { color: var(--warn); }
.byoc-step-detail { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text2); }

/* signature：账单分界线。它编码的是这个功能最承重的一条性质 ——
   上面全部免费且可重来，下面开始计费且不可逆。所以它是一条真的线，
   带一句真的话，而不是一个进度条上的刻度。 */
.byoc-billing-line {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 2px 6px; font-size: 11px; color: var(--warn);
  font-family: var(--font-mono); letter-spacing: 0.02em;
}
.byoc-billing-line::before,
.byoc-billing-line::after { content: ""; flex: 1; height: 1px; background: var(--warn); opacity: 0.35; }

.byoc-note {
  padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.55;
  background: var(--bg3); border: 1px solid var(--border2); color: var(--text2);
}
.byoc-note.warn   { background: var(--warn-pale);   border-color: transparent; color: var(--text); }
.byoc-note.danger { background: var(--danger-pale); border-color: transparent; color: var(--text); }
.byoc-note code { font-family: var(--font-mono); font-size: 11.5px; }

/* .byoc-card* 已删：机器卡片现在与 agent 状态拼成同一张 .srv-card，
   不再是「我们开的」和「活着的」两块。 */
/* ⚠️ **这一行会把整个面板撑出横向滚动条，而它是两条叠加**（2026-08-24）：
   ① 原先没有 `flex-wrap` ⇒ 事实全挤在一行，而 #807 往这里加了 lan_ip、出网、
      镜像名三个，这一行当初是按「三四个短词」设计的；
   ② **flex 项默认 `min-width: auto`** ⇒ 拒绝缩到 min-content 以下，而镜像名
      `aliyun_3_x64_20G_pro_dengbao_alibase_20250704.vhd` 是一个 48 字符、
      **没有任何断行机会**的 token ⇒ 卡片缩不下去 ⇒ 面板横向溢出。
   ⚠️ `overflow-wrap` **必须是 `anywhere` 不能是 `break-word`**：两者看起来一样，
   而只有 `anywhere` **参与 min-content 计算** —— 用 break-word 的话文字会断，
   **容器仍然被撑宽**，滚动条原样还在。
   ⚠️ 不许改成 `text-overflow: ellipsis`：`image_name` 存在的唯一理由就是
   「拿它去云的镜像列表里搜得到」（#807），省略号会把它变成搜不到的东西。 */
.byoc-kv {
  display: flex; flex-wrap: wrap; gap: 4px 8px; min-width: 0;
  font-size: 12px; color: var(--text2); font-family: var(--font-mono);
}
.byoc-kv > span { min-width: 0; overflow-wrap: anywhere; }
.byoc-kv b { font-weight: 500; color: var(--text); }

.byoc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--bento-gap); }
.byoc-grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .byoc-grid, .byoc-grid.three { grid-template-columns: 1fr; } }

.byoc-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
/* ⚠️ 三个 `!important` 都是在压 `.modal label`（大写 + 1px 字距 + 14px 上边距）。
   那条规则是给 modal 的分节标题写的，而这里是一个普通字段标签 —— 顶着
   「ACCESS KEY ID」这么一行大写字，输入框看起来会比实际更笨重。 */
.byoc-field label {
  font-size: 12px; color: var(--text2);
  text-transform: none !important; letter-spacing: 0 !important;
  margin: 0 !important; font-weight: 500;
}
/* ⚠️ 16px 是刻意的：iOS Safari 在更小的字号上会自动缩放整页（ai.md）。
   所以「太大」只能从 padding / min-height / 宽度上省，不能从字号上省。 */
.byoc-field input {
  font-family: var(--font-mono); font-size: 16px;
  padding: 7px 11px !important; min-height: 36px; max-width: 360px;
  border: 1px solid var(--border2); border-radius: 8px;
  background: var(--bg2); color: var(--text);
}
.byoc-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.byoc-log {
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
  max-height: 180px; overflow-y: auto;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg4); color: var(--text2);
}

@media (prefers-reduced-motion: reduce) {
  .byoc-step { transition: none; }
  /* ⚠️ 关掉动画之后**底色仍然在**（`background-color`），所以「哪一步在跑」
     这个信息一个字都没少 —— 动画是加强，不是唯一的载体。 */
  .byoc-step.active,
  .byoc-step.active .byoc-step-mark { animation: none; }
}

/* 基础环境那一格（MyCloud 卡片）。与 .srv-dot 那个 online 指示是两件事：
   那个说 agent 在不在，这个说这台机器能不能托管一个 app。
   ⚠️ 颜色一律走变量 —— 这一带新增 CSS 里硬编码颜色保持 0 处（#801 起）。 */
.srv-env {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
  margin-top: 8px; padding: 8px 10px;
  border-radius: 8px; background: var(--bg2);
  /* ⚠️ **就是一张普通的小卡片，没有左边那条竖杠**（用户 2026-09-04：
     「别搞左边那个边框|啊 不好看 就里面放个正常小卡片就行了」）。
     ⚠️⚠️ **他 2026-08-27 就说过一次了** —— 那次改的是隔壁的 `.srv-domain`
     （「别搞这个左边绿边框 不好看」），而这一条**与它同形、就在它上面三行**,
     一个字没动。[BUG-056] 那句「教训只被应用到了它当时改的那一处」，
     这次是**同一个文件里隔着三行**。 */
  border: 1px solid var(--border);
}
.srv-env-label { font-size: 12px; font-weight: 600; color: var(--text); }
.srv-env-detail { font-size: 12px; color: var(--text2); }
/* 状态仍然分得出来，只是**换一种说法**：整圈描边上色 + 标签上色，
   而不是左边一条 3px 的杠。⚠️ 常态（ready/unknown）**一点色都不上** ——
   一屏里两种强调等于没有强调，而需要被一眼看到的只有出问题那两态。 */
.srv-env.installing { border-color: var(--accent); }
.srv-env.installing .srv-env-label { color: var(--accent); }
.srv-env.stalled  { border-color: var(--warn); }
.srv-env.stalled .srv-env-label { color: var(--warn); }
/* 「这台机器隔不隔离得了 app」那一格（#871）。与 .installing/.stalled 并列，
   而它答的是另一个问题：那两个说「装完没有」，这个说「装完了、而它拦不住谁」。
   ⚠️ 用 danger 而不是 warn —— 一台没有隔离的机器上，任何一个 app 都读得到
   这台机器的数据库 admin 密码与其它 app 的目录。
   ⚠️ 2026-09-04 起这一格**只画在我们自己的机器上**：BYO 机器刻意不跑沙箱
   （用户定），对着一台我们本来就没打算隔离的机器报「它没隔离」是噪音。 */
.srv-env.unsafe   { border-color: var(--danger-red); }
.srv-env.unsafe .srv-env-label { color: var(--danger-red); }

/* BYO 那条要用户**照着敲**的命令（#880）。与介绍文字长得一样是这一格原来的
   毛病：它是这一屏上唯一一件**要动手做**的事，而它排版上与旁边的散文没有
   任何区别（用户 2026-09-04：*「运行的指令 高亮一下 别跟其他介绍文字一样」*）。
   ⚠️ 底子直接用 `.byoc-log`（attach 那条命令用的就是它）—— **两条要复制的
   命令长一个样**，而不是新造一种外观；这里只加「一行命令不是一段日志」那半。
   ⚠️⚠️ **刻意不加左边那条竖条。** 第一版我写了 `border-left: 3px solid
   var(--accent)`（「这是一条命令」的常见画法）——**而用户在同一天之内已经
   说过两次不喜欢那个东西**（2026-08-27 域名那张卡、2026-09-04 隔离那张卡）。
   底色（`--bg4`）+ 等宽字已经把它与散文分得很开，而 attach 那条命令用的
   就是这一套、他从来没提过。**已经说过两次的偏好，不必等他说第三次。**
   ⚠️ `max-height` 覆盖掉：`.byoc-log` 是给会滚的日志用的（180px + 滚动条），
   而一条命令只有一行，留着滚动条会让它看起来像一段被截断的输出。 */
.byo-cmd {
  max-height: none; overflow: visible;
  color: var(--text);
  margin: 6px 0 0;
}
/* 那个复制按钮自己一行、靠右 —— 与命令块贴着，不与下面那段说明混在一起。 */
.byo-cmd-row { display: flex; justify-content: flex-end; margin: 6px 0 8px; }

/* `How to renew?` —— **只在快到期时才出现的那个折叠**（用户 2026-09-04：
   「renew 还早着呢 你提示这些东西干什么」）。用原生 <details>：键盘可达、
   不需要 JS 状态，而这一屏 30 秒轮询一次、自己写的展开态会被重画丢掉。
   ⚠️ summary 要看起来可点：光标 + 下划线。**不靠颜色单独承载**
   （它住在 .srv-domain.warn 里面，那一格已经是红的）。 */
.byo-renew { margin-top: 2px; }
.byo-renew > summary {
  cursor: pointer; font-size: 12px; color: var(--text2);
  text-decoration: underline dotted; text-underline-offset: 2px;
  list-style: none;                 /* 三角自己画，见下 */
}
.byo-renew > summary::-webkit-details-marker { display: none; }
.byo-renew > summary::before { content: '▸ '; }
.byo-renew[open] > summary::before { content: '▾ '; }
.byo-renew > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.byo-renew-note { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* 域名那一格（A2-2a）。与 .srv-env 同形 —— 它们回答的是同一类问题
   （这台机器**能不能**好好托管一个 app），所以刻意长得一样。
   ⚠️ 颜色一律走变量：这一带新增 CSS 里硬编码颜色保持 0 处（#801 起）。 */
.srv-domain {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
  margin-top: 8px; padding: 8px 10px;
  border-radius: 8px; background: var(--bg2);
  /* ⚠️ **与 `.srv-env` 逐字同形，而这一次是真的同形。** 2026-08-27 那轮把
     左边那条杠改成透明（保住宽度不横跳），2026-09-04 用户要的是「一个正常
     小卡片」⇒ 整圈 1px 描边，两张卡一起换。
     ⚠️ **两张一起换是承重的**：CSS 里原话写着它们「刻意长得一样」，
     只换一张 ⇒ 同一屏上两张回答同类问题的卡从此长得不一样。 */
  border: 1px solid var(--border);
}
.srv-domain.none { border-color: var(--border); }
/* 第五态（A2-3）：续期已经停手了。⚠️ **只有这一格会变色** —— 一行里
   两种强调等于没有强调，而这一行要在一屏卡片里被一眼看到。
   ⚠️ 绿边框去掉之后这一条**更承重了**：它现在是这一格唯一的颜色。 */
.srv-domain.warn { border-color: var(--danger-red); }
.srv-domain.warn .srv-domain-value { color: var(--danger-red); font-weight: 600; }
.srv-domain-label { font-size: 12px; font-weight: 600; color: var(--text); }
.srv-domain-value { font-size: 12px; color: var(--text); }
.srv-domain.none .srv-domain-value { color: var(--text2); }
/* ⚠️ `min-width:0` + `flex:1` —— 没有它，长域名会把这一行撑出横向滚动条,
   而 375pt 是这个项目的窄屏基准。 */
.srv-domain-note { flex: 1 1 100%; min-width: 0; font-size: 12px; color: var(--text2);
                   overflow-wrap: anywhere; }

/* 选择器的每一行。 */
.srv-dom-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 8px; padding: 10px 12px;
  border: 1px solid var(--border2); border-radius: 10px; background: var(--bg2);
}
.srv-dom-row.picked { border-color: var(--mx-ok); }
.srv-dom-main { flex: 1 1 200px; min-width: 0; }
.srv-dom-name { display: block; font-size: 14px; font-weight: 600; color: var(--text);
                overflow-wrap: anywhere; }
.srv-dom-note { display: block; margin-top: 2px; font-size: 12px; color: var(--text2);
                overflow-wrap: anywhere; }
.srv-err { flex: 1 1 100%; margin-top: 6px; font-size: 12px; color: var(--warn);
           overflow-wrap: anywhere; }

/* 「填了就不能改」那条提示。三个变量都在 :root 里（--warn / --warn-pale / --radius）——
   注意不是 --radius-sm，那个不存在，而一个拼错的 var() 不报错，只是安静地没有圆角。 */
.pf-freeze-warn {
  font-size: 12px; line-height: 1.5; color: var(--text2);
  background: var(--warn-pale); border-left: 3px solid var(--warn);
  border-radius: var(--radius); padding: 8px 10px; margin: 0 0 6px;
}

/* TestFlight 卡片**里**那行提示（包名 + 复制图标）。
   ⚠️⚠️ `pointer-events: auto` 是承重的：灰掉的卡片是 `pointer-events: none`，
   不把它要回来，这一行的复制按钮**点不动** —— 而那正是它存在的全部理由。
   视觉值全走变量（ai.md）。 */
.dist-hint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
             margin: 8px 0 0; pointer-events: auto;
             /* ⚠️ 与 `.dist-card-desc` **同一个变量** —— 卡里的每一行要对齐到
                同一条线上（用户 2026-09-13：*「左边没有跟上面的文字对齐」*）。 */
             padding-left: var(--dist-card-indent); }
.dist-bundle { font-family: var(--font-mono); font-size: 12px; color: var(--accent2);
               background: var(--accent2-pale); padding: 2px 6px; border-radius: 4px;
               /* 卡片标题继承了 `.modal label` 那条全大写 + 字距，
                  而一个 bundle id 全大写就不是那个 bundle id 了（#928 同一条）。 */
               text-transform: none; letter-spacing: normal; }
/* 复用聊天气泡那个 `.copy-btn` 的外观，而它默认 `visibility: hidden`
   （靠 `.msg-wrap:hover` 露出来）—— 这里没有 `.msg-wrap`，要显式说出来。 */
.dist-hint .copy-btn { visibility: visible; }
/* 复制成功那一下。⚠️ 用内联 SVG 而不是 `✅` 那个 emoji：
   emoji 在三个系统上长得不一样（而在 macOS 上就是一个大绿方块），
   又跳过了主题 —— 用户 2026-09-13：*「copied 这个绿勾 太难看了」*。
   ⚠️ 绿用 `--mx-ok`：它今天顶着 metrics 的名字，而它是这个主题里**唯一**
   的成功绿 —— 造第二个绿比借这个名字贵。 */
.dist-hint .copy-btn.copied { opacity: 1; color: var(--mx-ok); }
/* `not_created` 那一态：卡选不了，但它装着唯一要他动手的那个包名 ⇒
   **不用整卡 opacity**（那会连包名一起压暗，而 opacity 子元素调不回来），
   只压暗标题与说明。 */
.dist-card-pending .dist-card-title { opacity: .5; }
.dist-card-pending .dist-card-desc  { opacity: .75; }

/* ── session refer：`#` 选中的项目，发送前挂在输入框上方 ───────────────────────
   ⚠️ 形状抄 `.attach-chip`（拖文件进来那个）—— 同一件事：挂着、能去掉、发送时才提交。 */
.ref-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; margin: 0 6px 6px 0;
  background: var(--bg3); color: var(--text1);
  border: 1px solid var(--border); border-radius: var(--radius-chip);
  font-size: 12px; max-width: 100%;
}
.ref-chip .ref-sub { color: var(--text2); font-size: 11px; }
.ref-chip .rm-ref  { cursor: pointer; color: var(--text2); padding: 0 2px; }
.ref-chip .rm-ref:hover { color: var(--text1); }

/* ⚠️ 链条图标走内联 SVG 而不是 `🔗`：emoji **完全跳过主题**，用户两个系统的截图
   并排证明了这件事（macOS 灰色轮廓 / Windows 蓝色）——#937 对 `✅` 立过同一条规矩。
   `stroke: currentColor` ⇒ 颜色跟着上下文走，尺寸也是我们说了算。 */
.ref-ico { vertical-align: -2px; flex-shrink: 0; opacity: .65; }
.ref-chip .ref-ico { opacity: .55; }

/* 开发环境标记（#967，用户定）—— 上一版是页面最顶上一条横幅，而**横幅在正常
   文档流里**：它把整页往下推，于是开发时看到的版面和生产的不是同一个版面，
   而那恰好是开发时最需要判断的东西。用户原话：
   *「因为页面就往下推了 会影响开发时对整体UI是否合理的判断」*。

   ⇒ 换成**背景水印**，而选 `background-image` 不是 `::after` 是有理由的：
     · background **完全不参与布局，也不创建定位上下文** ⇒ 代价真的是零；
     · `::after` 要么占位（在流里），要么要给 `#main` 加 `position: relative`
       去托住它 —— 而那会把 `#main` 变成所有后代 absolute 元素的新锚点，
       是一处**改了没人会立刻发现**的副作用。
   ⚠️ `background-attachment` 用默认的 `scroll`：在一个自己有滚动条的元素上，
      它的意思是「跟着元素、不跟着内容滚」⇒ 水印停在可视区中间，正是要的。

   ⚠️⚠️ 那个 `%23E8923B` 是 `--warn` 的值，而这里**只能写死** ——
      data: URI 里的 SVG 读不到 CSS 自定义属性。
      ⇒ 它由 `test_env_label.py::test_the_watermark_colour_tracks_the_warn_variable`
        逐字钉住：改了 `--warn` 而没改这里，那条测试当场红。
      （ai.md 那条「视觉值不 hardcode」在这里不是被违反，是**被换了一种方式执行**。） */
body.env-dev #messages {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='460' height='120'%3E%3Ctext x='50%25' y='50%25' text-anchor='middle' dominant-baseline='middle' font-family='system-ui,-apple-system,sans-serif' font-size='42' font-weight='800' letter-spacing='5' fill='%23E8923B' fill-opacity='0.12'%3EIN DEV MODE%3C/text%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ── Pay-as-you-go（#1092）── */
.pf-link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 10px 4px; min-height: 44px; font-size: 13px; }
.billing-month { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.billing-body { max-height: 60vh; overflow-y: auto; }
.billing-day { border-bottom: 1px solid var(--border); padding: 6px 0; }
.billing-day summary { display: grid; grid-template-columns: 1.2fr 1fr 1fr 0.8fr; gap: 6px; cursor: pointer; min-height: 44px; align-items: center; font-size: 13px; }
.billing-entry { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); padding: 3px 0 3px 12px; }
.billing-entry .neg, .billing-day .neg { color: var(--text2); }
.billing-entry .pos, .billing-day .pos { color: var(--accent); }
@media (max-width: 420px) { .billing-day summary { grid-template-columns: 1fr 1fr; } }
#low-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 10px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--warn-pale);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
#low-balance-bar .fx-cta { color: var(--accent); font-weight: 700; white-space: nowrap; }
