/* Octo console — the OGS look: plain surfaces, hairlines, line icons, no colored blocks. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #ffffff; --surface: #ffffff; --fill: rgba(0, 0, 0, 0.045); --fill-2: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #86868b; --line: #d2d2d7; --sep: rgba(0, 0, 0, 0.09);
  --accent: #0071e3; --accent-2: #0077ed; --accent-soft: rgba(0, 113, 227, 0.1); --link: #0066cc;
  --danger: #e30000; --ok: #1f9d4a; --warn: #b25000;
  --focus: 0 0 0 3px rgba(0, 113, 227, 0.22);
  --bubble-in: #e9e9eb;
  --radius: 12px;
  /* App standard: one 64px bar; the avatar (drawn by the OGS SDK) owns its right 64px. */
  --bar: 64px;
  --header-height: calc(var(--bar) + env(safe-area-inset-top, 0px));
  --tabs-h: 46px;
  --page: 880px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --fill: rgba(255, 255, 255, 0.09); --fill-2: rgba(255, 255, 255, 0.15);
    --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #86868b; --line: #424245; --sep: rgba(255, 255, 255, 0.1);
    --accent: #0a84ff; --accent-2: #409cff; --accent-soft: rgba(10, 132, 255, 0.18); --link: #2997ff;
    --danger: #ff453a; --ok: #30d158; --warn: #ff9f0a; --focus: 0 0 0 3px rgba(10, 132, 255, 0.38);
    --bubble-in: #262628;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --fill: rgba(255, 255, 255, 0.09); --fill-2: rgba(255, 255, 255, 0.15);
  --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #86868b; --line: #424245; --sep: rgba(255, 255, 255, 0.1);
  --accent: #0a84ff; --accent-2: #409cff; --accent-soft: rgba(10, 132, 255, 0.18); --link: #2997ff;
  --danger: #ff453a; --ok: #30d158; --warn: #ff9f0a; --focus: 0 0 0 3px rgba(10, 132, 255, 0.38);
  --bubble-in: #262628;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + var(--tabs-h)); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); letter-spacing: -0.012em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
p { margin: 0; text-wrap: pretty; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button, a, summary, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
code, pre, .mono { font-family: var(--mono); letter-spacing: 0; }
/* iOS zooms into a focused input under 16px. */
@media (pointer: coarse), (max-width: 699px) {
  input, textarea, select { font-size: 16px !important; }
}
main { overflow-x: clip; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30; height: var(--header-height); padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--sep);
}
.bar-in {
  height: 100%; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 0 calc(var(--bar) + env(safe-area-inset-right, 0px)) 0 var(--gutter-l);
}
.brand { flex: none; display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 18px; letter-spacing: -0.02em; border-radius: 8px; padding: 4px 2px; }
.brand:hover { text-decoration: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; color: var(--text-3); }
.crumbs .cur { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 14px; }
@media (max-width: 420px) { body.in-octo .brand span { display: none; } }

/* ---------- Page ---------- */
.page { max-width: var(--page); margin: 0 auto; padding: 28px var(--gutter-r) 72px var(--gutter-l); }
.page-head { margin-bottom: 8px; }
.page-head h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; }
.page-head p { margin-top: 6px; color: var(--text-2); }
.page-head.head-row { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.page-head.head-row .grow { flex: 1 1 220px; min-width: 0; }
.page-head.head-row > .btn { margin-top: 2px; }
/* The Octo list's footer: the platform page, out of the way. */
.list-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--sep); }
.foot-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-2); border-radius: 6px; }
.foot-link:hover { color: var(--text); text-decoration: none; }
.list-foot .hint { color: var(--text-3); }
.muted { color: var(--text-2); }
.lead { color: var(--text-2); font-size: 14px; margin: 4px 0 14px; }
.sec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 34px 0 12px; }
.sec-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.sec-head .count { font-size: 13px; color: var(--text-3); }
.sec-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sec-head + .fieldset { margin-bottom: 14px; }
.group-title { font-size: 13px; color: var(--text-2); margin: 26px 2px 8px; font-weight: 500; }
.hint { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.hint.error, .error { color: var(--danger); }
.hint.warn { color: var(--warn); }
.hint.ok { color: var(--ok); }
.empty { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 36px 20px; color: var(--text-2); font-size: 14px; }
.empty .empty-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--sep); color: var(--text-3); margin-bottom: 8px; }
.skeleton { height: 48px; border-radius: 12px; background: var(--fill); margin: 10px 0; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 18px;
  border: 0; border-radius: 980px; cursor: pointer; font-size: 15px; background: var(--accent); color: #fff; white-space: nowrap;
  transition: background-color .2s, opacity .2s, transform .1s, box-shadow .2s;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: .4; cursor: default; transform: none; }
.btn.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.secondary:hover { box-shadow: inset 0 0 0 1px var(--text-3); background: transparent; }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--danger); }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 13.5px; }
.btn.link { background: none; color: var(--link); padding: 0 2px; min-height: 0; box-shadow: none; border-radius: 4px; }
.btn.link:hover { text-decoration: underline; }
.btn svg { flex: none; }
.icon-btn {
  width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
@media (hover: none) {
  .btn:hover { background: var(--accent); }
  .btn.secondary:hover, .btn.danger:hover, .btn.link:hover { background: transparent; }
  .icon-btn:hover, .row.clickable:hover, .row-link:hover { background: transparent; }
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 18px; padding: 0 8px; border-radius: 980px;
  border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; font-weight: 500; letter-spacing: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.badge.accent { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.badge.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.badge.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.badge.danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.accent { background: var(--accent); }

/* ---------- Groups and rows (hairline outlines) ---------- */
.group { border: 1px solid var(--sep); border-radius: 16px; overflow: hidden; }
.group + .group { margin-top: 12px; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px 8px 16px; min-width: 0; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--sep); }
button.row { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: inherit; }
.row.clickable { cursor: pointer; transition: background-color .15s; }
.row.clickable:hover { background: var(--fill); }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; align-self: stretch; padding: 0; border-radius: 10px; }
.row-link:hover { text-decoration: none; }
.row .ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--sep); border-radius: 50%; }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.row .chev { color: var(--text-3); flex: none; display: grid; }
.more { display: flex; justify-content: center; padding: 14px 0 0; }

/* ---------- App cards ---------- */
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 700px) { .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.app-card {
  display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--sep); border-radius: 18px;
  transition: border-color .2s;
}
.app-card:hover { border-color: var(--line); }
.app-open {
  flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 16px 14px; margin: 0;
  border: 0; border-radius: 18px 18px 0 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.app-open:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent); }
.app-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-mono {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--sep); background: linear-gradient(180deg, var(--surface), var(--fill));
  color: var(--text); font-size: 18px; font-weight: 500; line-height: 1; letter-spacing: 0;
}
.app-names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-name { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-id { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-top .badge { flex: none; align-self: flex-start; margin-top: 2px; }
.app-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.5; color: var(--text-2);
}
/* Side by side, cards line up: the description always takes its two lines. */
@media (min-width: 700px) { .app-desc { min-height: 3em; } }
.app-desc.none { color: var(--text-3); }
.app-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.app-meta .m { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.app-meta .m > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-meta .m svg { flex: none; color: var(--text-3); }
.app-meta .m.mono { font-size: 12px; }
.app-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--sep); }
.app-key { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--text-2); }
.app-key svg { flex: none; color: var(--text-3); }
.app-key > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: none) { .app-card:hover { border-color: var(--sep); } }

/* A context panel (public/inspect.js) mounts here. */
.ctx-host { min-width: 0; }
.ctx-host .empty .btn { margin-top: 10px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.fieldset { border: 1px solid var(--sep); border-radius: 16px; padding: 16px; display: grid; gap: 14px; min-width: 0; margin: 0; }
.fieldset > legend { font-size: 13px; font-weight: 600; color: var(--text); padding: 0 6px; margin-left: -6px; }
.fld { display: grid; gap: 6px; min-width: 0; align-content: start; }
.inp.narrow { width: auto; min-width: 140px; max-width: 100%; justify-self: start; }
.fld > .lbl { font-size: 13px; color: var(--text-2); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 599px) { .grid2, .grid4 { grid-template-columns: minmax(0, 1fr); } .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } }
.inp {
  width: 100%; min-width: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 15px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.inp:focus { border-color: var(--accent); box-shadow: var(--focus); }
.inp::placeholder { color: var(--text-3); }
.inp[disabled] { opacity: .5; }
.inp.bad { border-color: var(--danger); }
textarea.inp { min-height: 88px; resize: vertical; line-height: 1.45; }
textarea.inp.code, input.inp.code { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
select.inp {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; min-width: 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.radios { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 12px);
}
.save-bar .state { font-size: 13px; color: var(--text-2); }
.seg { justify-self: start; display: inline-flex; padding: 2px; border-radius: 10px; border: 1px solid var(--sep); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--fill-2); color: var(--text); font-weight: 500; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-3); margin-bottom: 12px; }
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: 9px 0; font-size: 15px; color: var(--text); }
.search input::-webkit-search-cancel-button { display: none; }

details.fold { border: 1px solid var(--sep); border-radius: 16px; }
details.fold > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; border-radius: 16px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3); transform: rotate(45deg); transition: transform .2s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > .fold-body { padding: 0 16px 16px; display: grid; gap: 14px; }

/* ---------- Code and secrets ---------- */
.code-block { position: relative; border: 1px solid var(--sep); border-radius: 12px; min-width: 0; }
.code-block pre { margin: 0; padding: 12px 44px 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; white-space: pre; }
.code-block .icon-btn { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; background: var(--surface); }
.code-title { font-size: 13px; font-weight: 600; margin: 4px 0 6px; }
.secret { display: flex; align-items: center; gap: 8px; border: 1px solid var(--sep); border-radius: 12px; padding: 8px 8px 8px 14px; min-width: 0; }
.secret code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.notice { border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; }
.notice-t { font-weight: 600; font-size: 14px; }

/* ---------- Octo view ---------- */
.octo-top { max-width: var(--page); margin: 0 auto; padding: 22px var(--gutter-r) 12px var(--gutter-l); display: flex; align-items: center; gap: 12px; }
.octo-top .grow { flex: 1; min-width: 0; }
.octo-top h1 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.octo-top .sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--sep); border-radius: 980px; padding: 3px 10px; white-space: nowrap; flex: none; }
.tabs {
  position: sticky; top: var(--header-height); z-index: 20; border-bottom: 1px solid var(--sep);
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tabs-in { max-width: var(--page); margin: 0 auto; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 0 calc(var(--gutter-r) - 10px) 0 calc(var(--gutter-l) - 10px); }
.tabs-in::-webkit-scrollbar { display: none; }
.tab {
  flex: none; height: var(--tabs-h); display: inline-flex; align-items: center; padding: 0 10px; margin-bottom: -1px;
  color: var(--text-2); font-size: 15px; border-bottom: 2px solid transparent; border-radius: 0;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.tab-body { padding-top: 18px; }
.tab-body > :first-child > .sec-head:first-child { margin-top: 6px; }
/* The composer is the end of the chat page: nothing below it. */
.tab-body.chat-body { padding-bottom: 0; }

/* ---------- Chat ---------- */
.chat-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 0 14px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--sep); }
.chat-status .active { min-width: 0; flex: 1 1 220px; display: flex; align-items: center; gap: 8px; }
.chat-status .active span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-status .btn { margin-left: auto; }
.chat-log { display: flex; flex-direction: column; gap: 14px; padding: 20px 0 8px; min-height: 42vh; }
.chat-msgs { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
/* iMessage: the person on the right, Octo (panel_send) on the left in a gray bubble. Whole messages only. */
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(620px, 86%); min-width: 0; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .bubble { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 15px; max-width: 100%; padding: 8px 14px; }
.msg.me .bubble { background: var(--fill); border-radius: 18px 18px 6px 18px; }
.msg.octo .bubble, .typing-msg .bubble { background: var(--bubble-in); border-radius: 18px 18px 18px 6px; }
.msg .who { font-size: 11.5px; color: var(--text-2); margin: 0 12px 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .when { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 11px; color: var(--text-3); margin: 4px 6px 0; }
.msg .when .to { min-width: 0; overflow-wrap: anywhere; }
.typing-msg { align-self: flex-start; display: flex; }
.bubble.typing { display: inline-flex; align-items: center; gap: 5px; padding: 13px 15px; min-height: 38px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: typing 1.3s ease-in-out infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .16s; }
.bubble.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes typing { 0%, 55%, 100% { opacity: .35; transform: none; } 25% { opacity: 1; transform: translateY(-2.5px); } }
.older { display: flex; justify-content: center; padding-top: 14px; }
.composer { position: sticky; bottom: 0; z-index: 5; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 14px); }
.composer-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); padding: 5px 5px 5px 16px; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.composer-box textarea { flex: 1; min-width: 0; border: 0; outline: none; background: none; resize: none; padding: 7px 0; max-height: 40vh; font-size: 15px; line-height: 1.45; box-shadow: none; }
.send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; transition: opacity .2s; }
.send:disabled { opacity: .3; cursor: default; }
.composer details { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.composer summary { cursor: pointer; width: max-content; padding: 2px 4px; border-radius: 6px; list-style: none; }
.composer summary::-webkit-details-marker { display: none; }
.composer summary::before { content: "+ "; }
.composer details[open] summary::before { content: "− "; }
.adv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 4px 0; }
.adv-row .inp { width: 96px; min-height: 32px; padding: 4px 10px; }
.composer-note { margin: 6px 4px 0; }

/* ---------- Lists of records (tasks, memory, log, ledger) ---------- */
.records { display: grid; }
.rec { padding: 14px 2px; border-bottom: 1px solid var(--sep); display: grid; gap: 6px; min-width: 0; }
.rec:first-child { border-top: 1px solid var(--sep); }
.rec-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.rec-top .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.rec-title { font-weight: 600; overflow-wrap: anywhere; }
.rec-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.rec-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.rec-foot { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.rec-top .sender { min-width: 0; overflow-wrap: anywhere; }
.rec-ok.hint { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.rec-ok svg { flex: none; color: var(--ok); }
/* text_only: what the model wrote that reached nobody. */
.rec-text.said { padding: 2px 0 2px 10px; border-left: 2px solid var(--line); font-size: 13.5px; }
.rec code.call { display: block; font-size: 12.5px; padding: 6px 10px; border-left: 2px solid var(--line); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.rec .url { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.rec details summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); width: max-content; }
.rec details pre { margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--sep); border-radius: 10px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.summary { border: 1px solid var(--sep); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; margin-bottom: 14px; }
.summary .rec-text { max-height: 280px; overflow: auto; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .sel { width: auto; max-width: 100%; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
.toolbar .end { margin-left: auto; display: flex; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--sep); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Bulk create ---------- */
.results { max-height: 320px; overflow: auto; border: 1px solid var(--sep); border-radius: 12px; }
.results .r { display: flex; gap: 10px; padding: 7px 12px; font-size: 13px; border-top: 1px solid var(--sep); min-width: 0; }
.results .r:first-child { border-top: 0; }
.results .r .n { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; }

/* ---------- Sign-in and errors ---------- */
.center { max-width: 420px; margin: 12vh auto 0; padding: 0 var(--gutter-r) 0 var(--gutter-l); text-align: center; display: grid; gap: 12px; justify-items: center; }
.center .mark { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--sep); display: grid; place-items: center; color: var(--text); }
.center h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.center .others { display: grid; gap: 6px; margin-top: 8px; font-size: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 100; max-width: calc(100vw - 32px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: rgba(29, 29, 31, .92); color: #fff;
  padding: 10px 18px; border-radius: 18px; font-size: 14px; transition: opacity .25s, transform .3s cubic-bezier(.3,.7,.2,1);
  backdrop-filter: blur(20px); overflow-wrap: anywhere; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* Above the chat composer and the save bars. */
body.in-octo .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  /* Still, never gone: the typing dots stay (static). */
  .bubble.typing i { animation-name: none; opacity: .6; }
}
