/* fonts live next to the page: a private chat asks no outside server for anything (Noto Sans Thai, Inter and JetBrains Mono Latin, SIL Open Font License) */
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 300 700; font-stretch: 100%; font-display: swap; src: url(/fonts/noto-sans-thai.woff2) format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Arc brand book 01 (Glass Edition, owner 1 Dec 69): Quiet Futurism. White, black and silver surfaces; other colours only
   where a state needs them. Frosted glass and soft light, one primary button per decision. Light and dark follow the Mac. */
:root {
  --canvas: #F2F3F5;
  --page: radial-gradient(1500px 1000px at 112% 128%, transparent 57%, rgba(255,255,255,.85) 60%, transparent 64.5%),
          radial-gradient(1200px 820px at -18% -30%, transparent 55%, rgba(255,255,255,.7) 58.5%, transparent 63%),
          radial-gradient(900px 700px at 80% 0%, rgba(191,195,200,.35), transparent 70%),
          linear-gradient(160deg, #f6f7f8 0%, #eceef1 52%, #e3e5e9 100%);
  --card: rgba(255,255,255,.68); --card-solid: #ffffff; --side-solid: #f6f7f8;
  --stroke: rgba(255,255,255,.72); --blur: saturate(160%) blur(24px);
  --chip: rgba(255,255,255,.72); --well: rgba(20,20,20,.05); --well-2: rgba(20,20,20,.07);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -16px rgba(0,0,0,.12);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.05), 0 18px 40px -18px rgba(0,0,0,.2);
  --text: #141414; --text-2: #3a3a3c; --muted: #66686d; --faint: #c4c6ca; --silver: #BFC3C8;
  --line: rgba(20,20,20,.08);
  --hover: rgba(255,255,255,.62);
  --accent: #141414; --accent-2: #303030; --accent-soft: rgba(20,20,20,.07); --accent-text: #fff;
  --mine: #141414; --ring: rgba(20,20,20,.26); --overlay: rgba(20,20,20,.18);
  --toast-bg: #141414; --toast-text: #fff;
  --ok: #2f8f5b; --warn: #b7791f; --bad: #c53b3b;
  /* small coloured words need 4.5:1 on white and on the wells: the lighter tones stay for dots and rings */
  --bad-text: #a52a2a; --warn-text: #8a5600; --run: #141414; --idle: #c4c6ca;
  --bad-soft: #fbecec; --warn-soft: #fbf3e4;
  --r: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dark: 1; } }
:root[data-theme="dark"] { --dark: 1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --canvas: #141414;
  --page: radial-gradient(1500px 1000px at 112% 128%, transparent 57%, rgba(255,255,255,.07) 60%, transparent 64.5%),
          radial-gradient(1200px 820px at -18% -30%, transparent 55%, rgba(255,255,255,.05) 58.5%, transparent 63%),
          radial-gradient(900px 700px at 80% 0%, rgba(191,195,200,.10), transparent 70%),
          linear-gradient(160deg, #1d1d1f 0%, #151516 55%, #0f0f10 100%);
  --card: rgba(48,48,48,.62); --card-solid: #303030; --side-solid: #1c1c1e;
  --stroke: rgba(255,255,255,.16);
  --chip: rgba(255,255,255,.08); --well: rgba(255,255,255,.07); --well-2: rgba(255,255,255,.11);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 36px -16px rgba(0,0,0,.55);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.35), 0 18px 44px -18px rgba(0,0,0,.6);
  --text: #ffffff; --text-2: #d9dadd; --muted: #a4a6ab; --faint: #5a5c61;
  --line: rgba(255,255,255,.1); --hover: rgba(255,255,255,.07);
  --accent: #ffffff; --accent-2: #e4e5e7; --accent-soft: rgba(255,255,255,.12); --accent-text: #141414;
  --mine: #424245; --ring: rgba(255,255,255,.34); --overlay: rgba(0,0,0,.45);
  --toast-bg: #f2f3f5; --toast-text: #141414;
  --ok: #5cc28a; --warn: #e0a64a; --bad: #ef6b6b;
  --bad-text: #ff8f8f; --warn-text: #f2bd66; --run: #ffffff; --idle: #5a5c61;
  --bad-soft: rgba(239,107,107,.14); --warn-soft: rgba(224,166,74,.14);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --canvas: #141414;
  --page: radial-gradient(1500px 1000px at 112% 128%, transparent 57%, rgba(255,255,255,.07) 60%, transparent 64.5%),
          radial-gradient(1200px 820px at -18% -30%, transparent 55%, rgba(255,255,255,.05) 58.5%, transparent 63%),
          radial-gradient(900px 700px at 80% 0%, rgba(191,195,200,.10), transparent 70%),
          linear-gradient(160deg, #1d1d1f 0%, #151516 55%, #0f0f10 100%);
  --card: rgba(48,48,48,.62); --card-solid: #303030; --side-solid: #1c1c1e;
  --stroke: rgba(255,255,255,.16);
  --chip: rgba(255,255,255,.08); --well: rgba(255,255,255,.07); --well-2: rgba(255,255,255,.11);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 36px -16px rgba(0,0,0,.55);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.35), 0 18px 44px -18px rgba(0,0,0,.6);
  --text: #ffffff; --text-2: #d9dadd; --muted: #a4a6ab; --faint: #5a5c61;
  --line: rgba(255,255,255,.1); --hover: rgba(255,255,255,.07);
  --accent: #ffffff; --accent-2: #e4e5e7; --accent-soft: rgba(255,255,255,.12); --accent-text: #141414;
  --mine: #424245; --ring: rgba(255,255,255,.34); --overlay: rgba(0,0,0,.45);
  --toast-bg: #f2f3f5; --toast-text: #141414;
  --ok: #5cc28a; --warn: #e0a64a; --bad: #ef6b6b;
  --bad-text: #ff8f8f; --warn-text: #f2bd66; --run: #ffffff; --idle: #5a5c61;
  --bad-soft: rgba(239,107,107,.14); --warn-soft: rgba(224,166,74,.14);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--page); background-attachment: fixed; color: var(--text);
  font: 400 15px/1.6 "Inter", "Noto Sans Thai", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 17px; }
.brand.big { font-size: 28px; font-weight: 400; gap: 14px; }
.mark { width: 28px; height: 28px; border-radius: 8px; flex: none; background: url(/brand/mark.svg) center/cover no-repeat; box-shadow: 0 4px 10px -4px rgba(0,0,0,.35); }
.brand.big .mark { width: 44px; height: 44px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card .brand { justify-content: center; }
.login-card p { margin: 10px 0 32px; }
.login-card form { background: var(--card); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); text-align: left; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.login-card input { width: 100%; padding: 13px 18px; border: 0; border-radius: 999px; background: var(--well); margin-bottom: 14px; outline: 0; }
.err { color: var(--bad-text); font-size: 13px; margin: 10px 0 0 !important; }

/* buttons */
.btn { border: 0; background: var(--well); padding: 9px 16px; border-radius: 999px; font-weight: 500; font-size: 14px; color: var(--text); }
.btn:hover { background: var(--well-2); }
.btn.primary, .btn.solid { background: var(--accent); color: var(--accent-text); }
.btn.primary { width: 100%; padding: 13px; }
.btn.solid:hover, .btn.primary:hover { background: var(--accent-2); }
.btn.small { padding: 7px 16px; font-size: 13.5px; }
.btn.danger { color: var(--bad-text); }
.link { border: 0; background: none; padding: 4px 0; font-size: 13.5px; font-weight: 500; color: var(--accent); }
.link:hover { color: var(--accent-2); }
.icon-btn, .round-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card); color: var(--text); box-shadow: var(--shadow); flex: none; }
.icon-btn:hover, .round-btn:hover { box-shadow: var(--shadow-lift); }
.round-btn { width: 48px; height: 48px; cursor: pointer; }

/* layout: sidebar sits on the wash, conversation is open space, detail is a floating card */
.app { display: grid; grid-template-columns: 272px minmax(0,1fr) auto; height: 100dvh; }
.side { display: flex; flex-direction: column; padding: 22px 16px 16px; gap: 4px; overflow-y: auto; min-height: 0; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 14px; }
.search-trigger { display: flex; align-items: center; gap: 10px; border: 0; background: var(--card); border-radius: 999px; padding: 11px 16px; color: var(--muted); font-size: 14px; text-align: left; box-shadow: var(--shadow); margin-bottom: 10px; }
.search-trigger svg { color: var(--text); }
.search-trigger span { flex: 1; }
kbd { font: 400 11px "Inter"; color: var(--muted); }
.nav, .group { display: flex; flex-direction: column; gap: 2px; }
.group-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 10px 6px; font-size: 15px; font-weight: 500; color: var(--text); }
.nav-item, .room-item, .agent-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; padding: 9px 12px; border-radius: 16px; text-align: left; color: var(--text-2); font-size: 14.5px; }
.nav-item:hover, .room-item:hover, .agent-item:hover { background: var(--hover); }
.nav-item.on, .room-item.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.room-item .hash { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--chip); color: var(--accent); font-size: 14px; flex: none; }
.room-item.on .hash { background: var(--accent-soft); }
.nav-item svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--chip); color: var(--accent); }
.nav-item.on svg { background: var(--accent-soft); }
.room-item span.n, .nav-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-item.unread span.n { color: var(--text); font-weight: 500; }
.count { font: 500 11px "Inter"; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.count.at { background: var(--accent); color: var(--accent-text); }
.count:empty { display: none; }
.agent-item .meta { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.agent-item .nm { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.agent-item .nm span:first-child { color: var(--text); }
.agent-item .st { font-size: 12.5px; color: var(--muted); }
.me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); font-size: 14px; }
.me .who { flex: 1; line-height: 1.35; }
.me .who small { display: block; color: var(--muted); font-size: 12px; }
.me .icon-btn { width: 32px; height: 32px; box-shadow: none; background: var(--well); }

/* avatars: soft circles */
.av { --c: #9a96a0; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 13%, var(--card-solid)); color: color-mix(in srgb, var(--c) 85%, #000); font: 500 13px "Inter"; }
.av.sm { width: 26px; height: 26px; font-size: 11px; }
.av.agent { background: var(--card); color: var(--text-2); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.av.system { --c: #6b6d72; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.dot.idle { background: var(--ok); }
.dot.working { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.dot.down { background: var(--bad); }
.dot.paused { background: var(--warn); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(0,0,0,.35); } 60% { box-shadow: 0 0 0 6px transparent; } }

/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.feed, .jobs-view { min-height: 0; }
.bar { display: flex; align-items: center; gap: 14px; padding: 22px 32px 46px; margin-bottom: -32px; position: relative; z-index: 2; pointer-events: none; background: none; }
.bar > * { pointer-events: auto; }
.bar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar h1 { font-size: 26px; font-weight: 500; margin: 0; white-space: nowrap; letter-spacing: -.01em; }
.bar-title .muted { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--warn-text); background: var(--card-solid); padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.conn:not(.off) { display: none; }
.conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.conn.off i { background: var(--warn); }
.only-m { display: none; }

.feed { flex: 1; overflow-y: auto; padding: 40px 32px 16px; display: flex; flex-direction: column; gap: 14px; }
.feed > * { width: 100%; max-width: var(--col); margin-left: auto; margin-right: auto; }
.feed > :first-child { margin-top: auto; }
.day { text-align: center; margin: 10px auto 2px; }
.day span { display: inline-block; font-size: 11.5px; color: var(--accent); background: var(--chip); padding: 3px 12px; border-radius: 999px; }

.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .body { min-width: 0; max-width: 78%; }
.msg .head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px 4px; font-size: 13px; }
.msg .head b { font-weight: 500; }
.msg .head time { font-size: 11.5px; color: var(--muted); }
.bubble { background: var(--card); border-radius: 6px 22px 22px 22px; padding: 12px 16px; box-shadow: var(--shadow); }
.msg.cont { margin-top: -8px; }
.msg.cont .av { visibility: hidden; height: 0; }
.msg.cont .bubble { border-radius: 22px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; color: var(--text); }
.msg .text .at { color: var(--accent); font-weight: 500; }
.msg.mine { justify-content: flex-end; }
.msg.mine .bubble { background: var(--mine); border-radius: 22px 6px 22px 22px; box-shadow: none; }
.msg.mine .text, .msg.mine .text .at { color: #fff; }
.msg.mine .text .at { font-weight: 600; }
.msg.mine .bubble time { display: block; text-align: right; font-size: 11px; color: rgba(255,255,255,.7); margin-top: 2px; }
.msg.mine .replies { display: block; margin-left: auto; text-align: right; }
.msg.sys .bubble { background: var(--chip); box-shadow: none; }
.msg.sys .text { color: var(--text-2); font-size: 14px; }
.msg.pending { opacity: .55; }
.msg.failed .bubble { background: var(--card-solid); } .msg.failed .text { color: var(--bad-text); }
.replies { margin: 6px 4px 0; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--accent); font-size: 13px; font-weight: 500; padding: 0; }
.replies .stack { display: inline-flex; } .replies .stack:empty { display: none; }
.replies .stack .av { margin-right: -6px; width: 20px; height: 20px; font-size: 9px; }
.file { margin-top: 6px; display: inline-flex; align-items: center; gap: 8px; background: var(--card); border-radius: 16px; padding: 10px 14px; font-size: 13.5px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.file img { max-width: 280px; max-height: 220px; border-radius: 14px; display: block; }
.file.img { padding: 4px; }

/* job card: a white card in the agent column */
.msg.jobmsg { padding-left: 44px; }
.msg.jobmsg .body { max-width: none; width: 100%; }
.panel .msg.jobmsg { padding-left: 0; }
.job { --s: var(--muted); background: var(--card); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.job.s-running { --s: var(--accent); } .job.s-done { --s: var(--muted); } .job.s-failed, .job.s-rejected { --s: var(--bad); }
.job.s-waiting_approval, .job.s-paused_quota { --s: var(--warn); }
.job-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.job-head b { font-weight: 500; }
.job-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--st, var(--s)); background: color-mix(in srgb, var(--s) 10%, var(--card-solid)); padding: 3px 10px; border-radius: 999px; }
.job-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--s); }
.job.s-running .job-state i { animation: pulse 1.6s ease-in-out infinite; }
.job-title { margin-top: 12px; font-size: 17px; font-weight: 400; line-height: 1.5; color: var(--text); }
.job-track { height: 4px; border-radius: 4px; background: var(--well); margin-top: 14px; overflow: hidden; }
.job-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--silver), var(--accent)); border-radius: 4px; transition: width .6s ease; }
.job-line { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.job-line:empty { display: none; }
.job-line b { font-weight: 500; }
.job-line .live { color: var(--accent); } .job-line .lost { color: var(--bad-text); }
.job-err { margin-top: 8px; font-size: 13px; color: var(--bad-text); }
.result { white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: var(--text-2); margin-top: 8px; }
.job .result { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.job-head .link { margin-left: auto; padding: 0; font-size: 13px; }
.job-actions:empty { display: none; }

.pill { --s: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--st, var(--s)); background: color-mix(in srgb, var(--s) 10%, var(--card-solid)); padding: 3px 10px; border-radius: 999px; white-space: nowrap; justify-self: end; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--s); }
.pill.running { --s: var(--accent); } .pill.done { --s: var(--muted); } .pill.failed, .pill.rejected { --s: var(--bad); }
.pill.waiting_approval, .pill.paused_quota { --s: var(--warn); }

/* composer: round plus button and a white pill */
.composer { padding: 8px 32px 24px; position: relative; }
.composer-row, .composer > .composer-box { display: flex; gap: 12px; align-items: flex-end; max-width: var(--col); margin: 0 auto; }
.composer-box { flex: 1; display: flex; align-items: flex-end; gap: 6px; background: var(--card); border-radius: 26px; padding: 6px 6px 6px 20px; box-shadow: var(--shadow); min-height: 48px; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 7px 0; max-height: 180px; line-height: 1.5; }
.composer textarea::placeholder { color: var(--muted); }
.send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px -6px rgba(0,0,0,.7); }
.composer.slim { padding: 12px 18px 18px; }
.composer.slim .composer-box { box-shadow: none; background: var(--well); }
.mention-pop { position: absolute; bottom: calc(100% - 6px); left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lift); padding: 8px; z-index: 5; }
.mention-pop button { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 14px; text-align: left; font-size: 14.5px; }
.mention-pop button.on, .mention-pop button:hover { background: var(--well-2); }
.mention-pop small { color: var(--muted); display: block; font-size: 12px; }
.attach-chip { display: block; width: fit-content; margin: 0 auto 8px; font-size: 13px; background: var(--card); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow); }

/* detail panel: floating white card */
.panel { width: 400px; margin: 16px 16px 16px 0; background: var(--card); border-radius: 26px; box-shadow: var(--shadow-lift); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 24px; }
.panel-head h2 { font-size: 18px; margin: 0; font-weight: 500; }
.panel-head .icon-btn { width: 40px; height: 40px; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 24px 24px; }
.panel .job { box-shadow: none; padding: 0; }
.panel .bubble { box-shadow: none; background: var(--well); }
.panel .msg.mine .bubble { background: var(--mine); }
.panel .msg .body { max-width: 88%; }
.timeline { list-style: none; padding: 0; margin: 24px 0 0; }
.timeline li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 0 0 14px 22px; font-size: 14.5px; color: var(--text-2); }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--card-solid); box-shadow: 0 0 0 2px var(--faint); }
.timeline li::after { content: ""; position: absolute; left: 6px; top: 20px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.error::before, .timeline li.lost::before { box-shadow: 0 0 0 2px var(--bad); }
.timeline li:last-child::before { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.timeline li.recovered { color: var(--text); }
.timeline time { flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; font-size: 14px; margin: 20px 0 0; padding: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* jobs board */
.jobs-view { flex: 1; overflow-y: auto; padding: 8px 32px 28px; }
.jobs-view > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: var(--chip); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; color: var(--text-2); }
.tabs button.on { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.jrow { display: grid; grid-template-columns: minmax(0,1fr) 120px 110px; gap: 14px; align-items: center; padding: 16px 20px; background: var(--card); border: 0; border-radius: 18px; box-shadow: var(--shadow); width: 100%; text-align: left; font-size: 14.5px; color: var(--text); margin-bottom: 10px; }
.jrow:hover { box-shadow: var(--shadow-lift); }
.jrow .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jrow .a { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.empty { text-align: center; color: var(--muted); padding: 56px 0; font-size: 14.5px; line-height: 1.8; }

/* search sheet + toast */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.14); backdrop-filter: blur(6px); display: grid; place-items: start center; padding: 12vh 16px 16px; z-index: 20; }
.sheet-card { width: 100%; max-width: 560px; background: var(--card); border-radius: 26px; box-shadow: var(--shadow-lift); overflow: hidden; }
.sheet-card input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 22px; outline: 0; background: transparent; font-size: 16px; }
#searchResults { max-height: 55vh; overflow-y: auto; padding: 8px; }
.hit { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 12px 14px; border-radius: 16px; font-size: 14px; }
.hit:hover { background: var(--well-2); }
.hit small { color: var(--muted); display: block; font-size: 12px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }

/* phone */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 86%; max-width: 330px; z-index: 15; transform: translateX(-104%); transition: transform .24s ease; background: var(--side-solid); border-radius: 0 28px 28px 0; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.18); }
  .only-m { display: inline-grid; }
  .panel { position: fixed; inset: 0; width: auto; margin: 0; border-radius: 0; z-index: 16; background: var(--card); box-shadow: none; }
  .bar { padding: 14px 16px 40px; }
  .bar h1 { font-size: 22px; }
  .bar-title .muted { display: none; }
  .conn { padding: 6px; }
  .feed, .jobs-view { padding-left: 16px; padding-right: 16px; }
  .composer { padding: 6px 16px calc(14px + env(safe-area-inset-bottom)); }
  .jrow { grid-template-columns: minmax(0,1fr) auto; }
  .jrow .a { display: none; }
}
@media (max-width: 600px) {
  .msg .body { max-width: 84%; }
  .msg.jobmsg { padding-left: 0; }
  .msg.jobmsg .body { max-width: 100%; }
  .job { padding: 16px 16px 14px; }
  .job-title { font-size: 16px; }
  .job-actions .btn { min-height: 40px; }
  .round-btn { width: 46px; height: 46px; }
  .composer textarea, .panel textarea, .sheet-card input { font-size: 16px; }
}
.panel .result { margin-top: 20px; padding: 14px 16px; background: var(--well); border-radius: 16px; }
.tabs button span { color: var(--muted); margin-left: 4px; }
.tabs button.on span { color: var(--accent); opacity: .7; }
.panel .job-title { font-size: 18px; }
.panel .kv { font-size: 15px; gap: 12px; margin-top: 22px; }
.panel-head .icon-btn { background: var(--card-solid); box-shadow: var(--shadow); }
.timeline li { align-items: baseline; }
.timeline li span { min-width: 0; }
.panel .job-head { font-size: 15px; gap: 10px; }
.panel .job-head .av { width: 32px; height: 32px; font-size: 12px; }
.panel .job-state { font-size: 12.5px; padding: 4px 11px; }
.panel-head .icon-btn { width: 40px; height: 40px; }
@media (max-width: 900px) { .panel-head { padding-top: 18px; } }

/* accounts and agents */
.pill.ok { --s: var(--ok); }
#setupView > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; margin-bottom: 12px; }
.sec-head + .acc-list, .sec-head + .agent-grid { margin-bottom: 30px; }
.sec-head h3 { font-size: 17px; font-weight: 500; margin: 0; }
.acc-list { display: grid; gap: 12px; }
.acc { background: var(--card); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.acc-top { display: flex; align-items: center; gap: 14px; }
.acc-ic, .ak-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.acc-ic svg, .ak-ic svg { width: 20px; height: 20px; }
.acc-meta, .ak-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.acc-meta b, .ak-meta b { font-weight: 500; font-size: 15.5px; }
.acc-meta small, .ak-meta small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; flex-wrap: wrap; }
.acc-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.agent-card { display: grid; grid-template-columns: 42px 1fr; gap: 6px 14px; align-items: center; text-align: left; border: 0; background: var(--card); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); color: var(--text); }
.agent-card:hover { box-shadow: var(--shadow-lift); }
.ak-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ak-tags span { font-size: 12px; color: var(--text-2); background: var(--well); padding: 3px 10px; border-radius: 999px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.7; margin-top: 8px; }
.form label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
.form input, .form select, .form textarea { width: 100%; border: 0; background: var(--well); border-radius: 14px; padding: 11px 14px; outline: 0; font-size: 15px; }
.form textarea { resize: vertical; line-height: 1.6; }
.form input:focus, .form select:focus, .form textarea:focus { box-shadow: 0 0 0 2px var(--accent-soft); background: var(--card-solid); }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 0; background: var(--well); border-radius: 16px; padding: 12px 14px; color: var(--text); }
.kind svg { color: var(--accent); margin-bottom: 4px; }
.kind b { font-weight: 500; font-size: 14px; }
.kind small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.kind.on { background: var(--card-solid); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.seg { display: inline-flex; background: var(--well); border-radius: 999px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font-size: 13.5px; color: var(--text-2); }
.seg button.on { background: var(--card-solid); color: var(--accent); box-shadow: var(--shadow); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.room-item .av.sm { width: 30px; height: 30px; font-size: 12px; }
@media (max-width: 600px) { .kinds { grid-template-columns: 1fr; } .agent-grid { grid-template-columns: 1fr; } }
code { font: 13px "JetBrains Mono", ui-monospace, monospace; background: var(--well); padding: 1px 6px; border-radius: 6px; }
.msg.mine code { background: rgba(255,255,255,.2); }
.msg .text b, .result b { font-weight: 600; }

/* round 3: critics' fixes */
.app { height: var(--vh, 100dvh); }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.msg .text, .result, .job-title { overflow-wrap: anywhere; }
.feed, .panel-body, .side { overscroll-behavior: contain; }
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
.main { position: relative; }
.new-chip { min-height: 44px; position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 3; border: 0; background: var(--accent); color: var(--accent-text); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow-lift); }
.at-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); font: 600 16px "Inter"; flex: none; margin-left: -12px; }
.composer-box { padding-left: 16px; }
.result.draft { color: var(--text); border-left: 2px solid var(--accent-soft); padding-left: 12px; }
.agent-item .st.warn { color: var(--warn-text); }
.jrow.hot { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--warn) 45%, transparent), var(--shadow); }
details.tech, details.more { margin-top: 18px; }
details.tech summary, details.more summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; padding: 8px 0; }
details.tech summary::-webkit-details-marker, details.more summary::-webkit-details-marker { display: none; }
details.tech .kv { margin-top: 6px; font-size: 13.5px; }

/* direct chat greeting */
.hello { margin: auto; text-align: center; padding: 24px 0 8px; display: flex; flex-direction: column; align-items: center; }
.hello .av { width: 56px; height: 56px; font-size: 20px; }
.hello h2 { font-size: 24px; font-weight: 500; margin: 14px 0 4px; }
.hello p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; }
.idea { border: 0; background: var(--card); box-shadow: var(--shadow); padding: 10px 16px; border-radius: 999px; font-size: 14px; color: var(--text); }
.idea:hover { color: var(--accent); }

/* agents and accounts page */
#setupView > * { max-width: var(--col); }
#setupView { padding-left: 32px; padding-right: 32px; }
.acc.off .acc-ic { background: var(--well); color: var(--muted); }
.agent-card { align-content: start; min-height: 150px; }
.ak-tags span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ak-about { grid-column: 1 / -1; font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 6px; }
.kind { min-height: 104px; }
.kind small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kind-demo { margin-top: 10px; font-size: 13px; color: var(--muted); }
.kind-demo.on { color: var(--accent); }
.form select { appearance: none; -webkit-appearance: none; font-weight: 400; background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%239a96a0' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") right 14px center/16px no-repeat; padding-right: 40px; }
.form .seg { display: flex; width: fit-content; }

/* phone: real touch sizes, no iPhone zoom, notch aware */
@media (max-width: 900px) {
  .icon-btn, .panel-head .icon-btn, .me .icon-btn { width: 44px; height: 44px; }
  .btn, .btn.small, .seg button, .tabs button, .job-actions .btn, .idea { min-height: 44px; }
  .send { width: 40px; height: 40px; }
  .at-btn { width: 40px; height: 40px; }
  .job-head .link { padding: 12px 8px; margin: -12px -8px -12px auto; }
  .bar { padding-top: calc(14px + env(safe-area-inset-top)); }
  .panel-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .panel-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .form input, .form select, .form textarea, .login-card input { font-size: 16px; }
  #setupView { padding-left: 16px; padding-right: 16px; }
  .acc-btns { width: 100%; }
  .acc-btns .btn { flex: 1 1 40%; }
  .form-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--card-solid) 30%); padding: 18px 0 calc(8px + env(safe-area-inset-bottom)); margin-top: 8px; }
  .new-chip { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) { .kinds { grid-template-columns: 1fr 1fr; } .kind { min-height: 96px; padding: 10px 12px; } }
@media (max-width: 359px) { .kinds { grid-template-columns: 1fr; } }
.acc-list { grid-template-columns: minmax(0, 1fr); }
.acc-list > *, .agent-grid > * { min-width: 0; }
#setupView { min-width: 0; }
@media (max-width: 900px) {
  .form-actions { background: var(--card-solid); box-shadow: 0 -12px 16px -8px var(--card-solid); }
  .agent-card { min-height: 0; }
}

/* round 4: critics' second pass */
.feed { -webkit-mask-image: linear-gradient(transparent 0, #000 40px); mask-image: linear-gradient(transparent 0, #000 40px); }
.bar h1 { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.job-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel .job-title { display: block; }
.at-btn { margin-left: -8px; }
details.tech summary, details.more summary { padding: 12px 0; color: var(--accent); font-size: 13.5px; }
details.tech summary::before, details.more summary::before { content: ""; }
.acts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.panel .acts { margin-top: 10px; gap: 8px; }
.agent-card { min-height: 0; padding-bottom: 18px; }
.agent-grid { align-items: stretch; }
.kind-demo { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--accent); font-size: 13.5px; padding: 10px 0; }
.kind-demo svg { width: 16px; height: 16px; }
.kind-demo.on { font-weight: 600; }
.btn.danger { background: transparent; }
.link.small { font-size: 13px; }
.group-head .link { padding: 6px 0; }
.hint { font-size: 12.5px; color: var(--muted); margin: -6px 0 14px !important; }
.login-card #inviteRow input { letter-spacing: .12em; text-transform: uppercase; }
.form-actions .btn.solid { flex: 1; }
.form-actions { border-top: 1px solid var(--line); padding-top: 16px; }
body.panel-open .new-chip { display: none; }
.panel-body { scroll-padding-bottom: 96px; }
.sched, .person { display: flex; align-items: center; gap: 14px; }
.sched { background: var(--card); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.sched.off { opacity: .6; }
.sched-time { font: 500 22px "Inter"; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 64px; }
.sched-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.sched-meta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-meta small { color: var(--muted); font-size: 12.5px; }
.empty-row { color: var(--muted); font-size: 14px; }
.invite-code { font: 600 30px "JetBrains Mono", monospace; letter-spacing: .18em; text-align: center; background: var(--well); border-radius: 18px; padding: 22px; margin: 16px 0; color: var(--accent); }
.seg.days button { min-width: 40px; padding: 7px 10px; }
details.gone { margin: -6px 0 24px; }
#setupView .sec-head { min-height: 44px; }
@media (max-width: 900px) {
  .form-actions .btn.solid { min-height: 48px; }
  .acc-btns .btn.danger { flex: 0 0 auto; }
  .sched-time { font-size: 19px; min-width: 56px; }
}
.seg.days button.on { background: var(--accent); color: var(--accent-text); box-shadow: none; }

/* round 5 */
.feed { -webkit-mask-image: linear-gradient(transparent 0, #000 24px); mask-image: linear-gradient(transparent 0, #000 24px); }
.job .result { white-space: pre-line; -webkit-line-clamp: 3; }
.form select { font-weight: 400; color: var(--text); }
.panel-body { padding-bottom: 96px; }
.smart-btn { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; padding: 0 6px; height: 36px; border-radius: 999px; flex: none; }
.smart-btn.on { background: var(--accent-soft); color: var(--accent); padding: 0 10px; }
.smart-tag { display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.25); vertical-align: middle; }
.msg:not(.mine) .smart-tag { background: var(--accent-soft); color: var(--accent); }
.older { margin: 0 auto 8px; border: 0; background: var(--chip); color: var(--accent); padding: 8px 16px; border-radius: 999px; font-size: 13px; max-width: max-content !important; }
.room-agent { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--chip); color: var(--text-2); padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); }
.room-agent span:only-child { padding-left: 6px; }
.rerun { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 4px; font-size: 13px; }
.pick-list { display: grid; gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; border: 0; background: var(--well); border-radius: 16px; padding: 12px 14px; text-align: left; min-height: 56px; }
.pick small { display: block; color: var(--muted); font-size: 12.5px; }
.pick.on { background: var(--card-solid); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.seg.every { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.seg.days { display: grid !important; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; margin-top: 8px; }
.seg.days[hidden] { display: none !important; }
.seg.days button { min-width: 0; padding: 0; height: 40px; }
@media (max-width: 900px) {
  .seg.days button, .seg.every button { min-height: 44px; }
  .room-agent span:not(:only-child) { display: none; }
}
.msg.mine .bubble .meta { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 2px; }
.msg.mine .bubble .meta time { margin: 0; }
.smart-btn { background: var(--well); color: var(--text-2); padding: 0 10px; margin-left: 4px; }
.composer textarea { min-width: 0; }
.composer-box { min-width: 0; }
.hint-line { width: 100%; color: var(--muted); font-size: 12.5px; }
.hit-head { font-size: 12px; color: var(--muted); padding: 10px 14px 4px; }
.use-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; font-size: 14px; padding: 6px 0; }
.smart-btn { white-space: nowrap; }
/* inside the Mac app: room for the window buttons, and the window drags from the top strip */
.in-app .side { padding-top: 44px; }
.in-app .bar { padding-top: 30px; }
.in-app .login { padding-top: 40px; }

/* brown gradient accents */
.msg.mine .bubble, .panel .msg.mine .bubble { background: var(--grad); }
.btn.primary, .btn.solid, .send, .count.at, .new-chip { background: var(--grad); }
.btn.solid:hover, .btn.primary:hover { background: var(--grad); filter: brightness(1.08); }
.seg.days button.on { background: var(--grad); }

/* Lark style chat (29 Nov 69): hover bar, reactions, quoted reply, pins, reads, typing, private rooms */
.msg .hold { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine .hold { align-items: flex-end; }
.hover-bar { position: absolute; top: 2px; left: calc(100% + 8px); display: flex; gap: 2px; padding: 3px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow-lift); opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .14s, transform .14s; z-index: 3; }
.msg.mine .hover-bar { left: auto; right: calc(100% + 8px); }
.msg .body { position: relative; }
.msg:hover .hover-bar, .hover-bar:focus-within { opacity: 1; transform: none; pointer-events: auto; }
.hover-bar button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.hover-bar button:hover { background: var(--accent-soft); color: var(--accent); }
.hover-bar svg { width: 17px; height: 17px; }
.msg.editing .hover-bar, .menu-open .hover-bar { display: none; }

.quote { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-width: 180px; max-width: 100%; border: 0; text-align: left; margin: 0 0 8px; padding: 6px 12px; border-radius: 12px; background: var(--canvas); box-shadow: inset 3px 0 0 var(--ring); font-size: 13px; color: var(--text-2); }
.quote b { font-weight: 500; font-size: 12.5px; color: var(--accent); }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .quote { background: rgba(255,255,255,.16); box-shadow: inset 3px 0 0 rgba(255,255,255,.55); color: rgba(255,255,255,.88); }
.msg.mine .quote b { color: #fff; }
.panel .quote { background: var(--card-solid); }

.reacts { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 2px 0; }
.msg.mine .reacts { justify-content: flex-end; }
.react { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 8px; border: 0; border-radius: 999px; background: var(--chip); box-shadow: 0 0 0 1px var(--line); font-size: 12.5px; color: var(--text-2); }
.react .e { font-size: 15px; line-height: 1; }
.react:hover { background: var(--card-solid); }
.react.on { background: var(--accent-soft); box-shadow: 0 0 0 1.5px var(--ring); color: var(--accent); font-weight: 500; }
.react.add { width: 28px; padding: 0; justify-content: center; color: var(--muted); opacity: 0; transition: opacity .14s; }
.react.add svg { width: 16px; height: 16px; }
.msg:hover .react.add { opacity: 1; }
.panel .react { background: var(--well); }

.pin-mark { display: inline-grid; place-items: center; color: var(--accent); }
.pin-mark svg { width: 13px; height: 13px; }
.msg.mine .bubble .meta .pin-mark { color: rgba(255,255,255,.85); }
.msg:not(.mine) .bubble .meta { display: flex; justify-content: flex-end; margin-top: 2px; }
.msg:not(.mine) .bubble .meta time { font-size: 11px; color: var(--muted); }

.bubble.gone { background: transparent !important; box-shadow: 0 0 0 1px var(--line) !important; color: var(--muted); font-size: 13.5px; padding: 8px 14px; }
.msg.mine .bubble.gone { color: var(--muted); }
.msg.gone .hold, .msg.gone .hover-bar { display: none; }

.reads { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin: 6px 4px 0; font-size: 11.5px; color: var(--muted); }
.reads .stack { display: inline-flex; }
.reads .stack .av { width: 18px; height: 18px; font-size: 8.5px; margin-left: -5px; box-shadow: 0 0 0 2px var(--canvas); }

.msg.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--ring), var(--shadow); } 100% { box-shadow: var(--shadow); } }

/* inline edit */
.msg.editing .bubble { background: var(--card) !important; box-shadow: 0 0 0 1.5px var(--ring), var(--shadow) !important; min-width: min(420px, 70vw); }
.edit-box { width: 100%; border: 0; outline: 0; resize: none; background: transparent; line-height: 1.6; padding: 0; color: var(--text); max-height: 240px; }
.edit-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* message menu */
.msg-menu { position: fixed; z-index: 30; width: 296px; background: var(--card); border-radius: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 24px 60px -20px rgba(0,0,0,.35); padding: 8px; }
.msg-menu .quick { display: flex; align-items: center; gap: 2px; padding: 2px; }
.msg-menu .quick button, .msg-menu .all button { width: 32px; height: 34px; border: 0; border-radius: 12px; background: transparent; font-size: 19px; line-height: 1; display: grid; place-items: center; padding: 0; }
.msg-menu .quick button:hover, .msg-menu .all button:hover { background: var(--well-2); }
.msg-menu .quick button.on { background: var(--accent-soft); }
.msg-menu .quick .more-e { color: var(--muted); margin-left: auto; }
.msg-menu .all { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 200px; overflow-y: auto; padding: 6px 2px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.msg-menu .all[hidden] { display: none; }
.msg-menu .items { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; display: grid; }
.msg-menu .items button { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; padding: 9px 12px; border-radius: 12px; text-align: left; font-size: 14px; color: var(--text); }
.msg-menu .items button:hover { background: var(--well-2); }
.msg-menu .items svg { width: 17px; height: 17px; color: var(--text-2); }
.msg-menu .items .bad, .msg-menu .items .bad svg { color: var(--bad-text); }

/* composer extras */
.emoji-btn { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.emoji-btn:hover { color: var(--accent); background: var(--well-2); }
.emoji-btn svg { width: 20px; height: 20px; }
.emoji-pop { position: absolute; bottom: calc(100% - 4px); right: max(32px, calc(50% - 380px)); width: 312px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 240px; overflow-y: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lift); padding: 8px; z-index: 6; }
.emoji-pop button { border: 0; background: transparent; height: 34px; border-radius: 10px; font-size: 19px; padding: 0; }
.emoji-pop button:hover { background: var(--well-2); }
.reply-bar, .typing { max-width: var(--col); margin: 0 auto 8px; }
.reply-bar { display: flex; align-items: center; gap: 10px; background: var(--chip); border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: inset 3px 0 0 var(--ring), var(--shadow); }
.rb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.rb-text b { font-weight: 500; color: var(--accent); font-size: 12.5px; }
.rb-text span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.x:hover { background: var(--well); color: var(--text); }
.typing { display: flex; align-items: center; gap: 8px; padding-left: 18px; font-size: 12.5px; color: var(--muted); }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ring); animation: tdot 1.2s infinite ease-in-out; }
.typing .dots i:nth-child(2) { animation-delay: .15s; } .typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.attach-chip { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border-radius: 18px; max-width: min(420px, 100%); }
.attach-chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; display: block; }
.attach-chip .fi { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.attach-chip .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 4px; }
.attach-chip.busy { padding: 8px 16px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.drop { position: absolute; inset: 12px; z-index: 20; border-radius: 28px; background: color-mix(in srgb, var(--canvas) 88%, transparent); box-shadow: inset 0 0 0 2px var(--ring); display: grid; place-items: center; pointer-events: none; backdrop-filter: blur(4px); }
.drop div { font-size: 17px; color: var(--accent); background: #fff; padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow); }
.main { position: relative; }

/* header buttons */
.bar .icon-btn { position: relative; }
.dotc { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: 600 10px/16px "Inter"; }
.room-item .hash.lock svg { width: 14px; height: 14px; }
.hash.lock { color: var(--accent); }

/* pins panel */
.pin-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pin-row:last-child { border-bottom: 0; }
.pin-open { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 0; }
.pin-open .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pin-open .who b { font-weight: 500; }
.pin-open .who time { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.pin-open .t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; font-size: 14px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.pin-open .t .at { color: var(--accent); font-weight: 500; }
.pin-row .link { margin-top: 6px; color: var(--muted); }
.pins-empty { padding-top: 40px; }
.big-ic { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin: 0 auto 14px; }
.big-ic svg { width: 24px; height: 24px; }

/* room forms */
.room-form { display: grid; gap: 8px; }
.room-form label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.room-form input { width: 100%; padding: 12px 16px; border: 0; border-radius: 16px; background: var(--well); outline: 0; }
.room-form input:focus { box-shadow: 0 0 0 1.5px var(--ring); background: var(--card-solid); }
.room-form input:disabled { color: var(--text-2); background: var(--well); }
.room-form .btn.small { justify-self: start; margin-top: 6px; }
.room-form .btn.primary { margin-top: 18px; }
.vis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vis button { display: flex; align-items: center; gap: 10px; border: 0; background: var(--well); border-radius: 16px; padding: 10px 12px; font-size: 14px; text-align: left; min-height: 52px; }
.vis button .hash { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--card-solid); color: var(--accent); flex: none; }
.vis button .hash svg { width: 14px; height: 14px; }
.vis button.on { background: var(--card-solid); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.pick .tick { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--faint); flex: none; }
.pick.on .tick { background: var(--accent); box-shadow: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 10.5 2.5 2.5L14 7.5'/%3E%3C/svg%3E"); background-size: 18px; background-position: center; background-repeat: no-repeat; }
.pick > span:not(.av):not(.hash) { flex: 1; min-width: 0; }
.pick > .hash { flex: none; }
.room-kind { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; padding: 12px 14px; background: var(--well); border-radius: 16px; }
.room-kind .hash { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--card-solid); color: var(--accent); flex: none; }
.room-kind .hash svg { width: 16px; height: 16px; }
.room-kind b { font-weight: 500; display: block; font-size: 14px; }
.room-kind small { color: var(--muted); font-size: 12.5px; }
.sec-mini { font-size: 12.5px; color: var(--muted); margin: 20px 0 6px; }
.people-list { display: grid; }
.person { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.person .nm { flex: 1; min-width: 0; font-size: 14.5px; }
.person .nm small { display: block; color: var(--muted); font-size: 12px; }
.link.danger { color: var(--bad-text); }
.small-p { font-size: 12.5px; margin: 10px 0 0; }

@media (max-width: 900px) {
  .hover-bar { display: none; }
  .react.add { opacity: 1; }
  .emoji-pop { right: 16px; left: 16px; width: auto; }
  .msg .hold { -webkit-touch-callout: none; }
}
@media (max-width: 699px) {
  .msg-menu { left: 8px !important; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); top: auto !important; width: auto; border-radius: 26px; padding: 10px; animation: sheet .2s ease; }
  .msg-menu .quick { justify-content: space-between; }
  .msg-menu .quick button { width: 38px; height: 42px; font-size: 22px; }
  .msg-menu .items button { padding: 13px 14px; font-size: 15px; }
  .menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.22); z-index: 29; }
}
@keyframes sheet { from { transform: translateY(16px); opacity: 0; } }
.composer .typing { position: absolute; left: 0; right: 0; bottom: calc(100% - 6px); margin: 0 auto; width: min(var(--col), calc(100% - 64px)); pointer-events: none; padding-left: 18px; }
@media (max-width: 900px) { .composer .typing { width: calc(100% - 32px); } }
.composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer textarea:placeholder-shown { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 600px) {
  .emoji-btn { display: none; }
  .bar { gap: 8px; }
}

/* Drafts the owner copies and sends himself (assistant follow-ups) */
.draftbox { display: block; margin: 8px 0; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--text) 5%, transparent); white-space: normal; }
.draftbox .draft-text { display: block; white-space: pre-wrap; color: var(--text); line-height: 1.65; }
.draftbox .btn { margin-top: 10px; }

/* round 6 (critics 1 to 10, 29 Nov 69) */
/* sidebar: the list scrolls, the me card stays pinned at the bottom */
.side { overflow: hidden; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.me { margin-top: 8px; flex: none; }
.side-empty { font-size: 13px; color: var(--muted); padding: 2px 12px 8px; margin: 0; }
.group-head { padding: 16px 4px 6px 12px; }
.add-btn { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--chip); color: var(--accent); display: grid; place-items: center; flex: none; }
.add-btn:hover { background: var(--card-solid); box-shadow: var(--shadow); }
.add-btn svg { width: 16px; height: 16px; }
.nav-item .count + .count { margin-left: -6px; }

/* one left edge per view: the title starts where the content starts */
.view-chat .bar, .view-jobs .bar, .view-setup .bar { padding-left: max(32px, calc((100% - var(--col)) / 2)); padding-right: max(32px, calc((100% - var(--col)) / 2)); }

/* buttons: one height, one primary, one danger */
.btn { min-height: 36px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.25; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.primary { min-height: 48px; padding: 0 16px; }
.btn.danger { background: var(--bad-soft); color: var(--bad-text); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.btn.danger-solid { background: var(--bad); color: var(--accent-text); }
.btn.danger-solid:hover { background: var(--bad-text); }
.link { min-height: 36px; display: inline-flex; align-items: center; }
.link.danger { color: var(--bad-text); }
.chev { width: 14px; height: 14px; flex: none; opacity: .75; }

/* header chips */
.approve-chip { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--warn-soft); color: var(--warn-text); padding: 0 14px; min-height: 36px; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); white-space: nowrap; flex: none; }
.approve-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.approve-chip:hover { box-shadow: var(--shadow-lift); }
.room-agent { min-height: 36px; flex: none; }
.room-agent:hover { background: var(--card-solid); box-shadow: var(--shadow-lift); }
.room-agent .chev { margin-left: -2px; }

/* composer: level picker with a chevron, tools sit inline on a computer */
.composer-box .tools { display: contents; }
.smart-btn { display: inline-flex; align-items: center; gap: 4px; }
.smart-btn:hover { background: var(--well-2); }
.smart-pop { position: absolute; bottom: calc(100% - 4px); left: max(96px, calc(50% - 300px)); width: 300px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lift); padding: 8px; z-index: 6; }
.smart-pop .pop-head { font-size: 12.5px; color: var(--muted); padding: 6px 12px 4px; }
.smart-pop button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: transparent; padding: 8px 12px; border-radius: 14px; text-align: left; min-height: 48px; font-size: 14.5px; }
.smart-pop button small { display: block; color: var(--muted); font-size: 12.5px; }
.smart-pop button:hover, .smart-pop button.on { background: var(--well-2); }
.smart-pop svg { color: var(--accent); }
.mention-pop { max-height: min(320px, calc(var(--vh, 100dvh) * .4)); overflow-y: auto; }
.composer.slim { padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); }
.composer.slim textarea { max-height: 120px; }

/* feed: unread divider, mentions of me, new replies */
.unread-line { display: flex; align-items: center; gap: 12px; color: var(--bad-text); font-size: 12px; font-weight: 500; margin: 4px auto; }
.unread-line::before, .unread-line::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--bad-text) 30%, transparent); }
.msg.tome .bubble { box-shadow: inset 3px 0 0 var(--ring), var(--shadow); }
.msg .text .at.atme { background: var(--accent-soft); border-radius: 6px; padding: 0 3px; }
.replies.new { color: var(--bad-text); }
.new-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad-text); }
.reacts { margin-top: -2px; }
.msg.mine .text a { color: #fff; text-decoration: underline; }
.thread-split span { background: var(--well); }
.thread-hint { text-align: center; font-size: 13px; margin: 8px 0 0; }
.older:hover { background: var(--card-solid); }
.older.newer { margin: 8px auto 0; }

/* empty states with an icon */
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px; line-height: 1.6; }
.empty b { color: var(--text-2); font-size: 16px; font-weight: 500; }
.empty .big-ic { margin: 0 0 10px; }
.feed > .empty { margin: auto; max-width: 380px; }

/* job card: why it waits, friendly errors, readable timeline */
.job-why { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--warn-soft); font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; color: var(--text-2); }
.job-why b { font-weight: 500; color: var(--warn-text); font-size: 12.5px; }
.job-why .muted { font-size: 12.5px; }
.job-actions { gap: 10px; }
.job-actions [data-act="reject"] { margin-left: 6px; }
.job-err { margin-top: 10px; color: var(--bad-text); background: var(--bad-soft); padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.wait-note { font-size: 13px; }
.tl-failed li:last-child::before { background: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.raw { font: 12px "JetBrains Mono", ui-monospace, monospace; overflow-wrap: anywhere; color: var(--text-2); }
.tech-log { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 12.5px; }
.tech-log li { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.tech-log time { color: var(--muted); font-variant-numeric: tabular-nums; }
details.tech { border-top: 1px solid var(--line); margin-top: 22px; }
.panel .rerun { padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--line); }
.agent-top { display: flex; gap: 12px; align-items: center; }
.agent-top .muted { font-size: 13px; }
.state-line { display: inline-flex; gap: 6px; align-items: center; }
.lead { margin-top: 0; }

/* jobs list: who asked, when, and approve right in the row */
.jrow { grid-template-columns: minmax(0,1fr) 130px 110px; cursor: pointer; }
.jrow .p { display: flex; flex-direction: column; min-width: 0; white-space: normal; overflow: visible; }
.jrow .pt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jrow .p small { display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.jrow .p small .why { color: var(--warn-text); flex-basis: 100%; }
.jrow-acts { grid-column: 1 / -1; display: flex; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.jrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mini-row { grid-template-columns: minmax(0,1fr) auto; padding: 12px 14px; box-shadow: 0 0 0 1px var(--line); margin-bottom: 8px; }
.mini-row .p { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* search: room filter and dates on every hit */
.search-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.search-row input { flex: 1; min-width: 0; border-bottom: 0 !important; }
.search-row input::-webkit-search-cancel-button { display: none; }
.search-row select { border: 0; appearance: none; -webkit-appearance: none; background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2366686d' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") right 10px center/14px no-repeat; padding: 0 30px 0 14px; height: 40px; border-radius: 999px; margin-right: 12px; max-width: 42%; font-size: 13.5px; color: var(--text-2); }
.hit small { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.hit small .rm { color: var(--accent); font-weight: 500; }
.hit .snip { display: block; color: var(--text); overflow-wrap: anywhere; }
.hit-note { padding: 14px; color: var(--muted); font-size: 13.5px; margin: 0; }

/* the yes or no sheet */
.sheet.confirm { place-items: center; padding: 16px; z-index: 40; }
.ask-card { padding: 22px; max-width: 420px; }
.ask-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 500; }
.ask-card p { margin: 0 0 16px; color: var(--text-2); font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.ask-card input { width: 100%; border: 0; background: var(--well); border-radius: 14px; padding: 12px 14px; outline: 0; font-size: 16px; margin-bottom: 16px; }
.ask-acts { display: flex; justify-content: flex-end; gap: 10px; }

/* setup page rhythm */
.sec + .sec { margin-top: 36px; }
.sec-head + .acc-list, .sec-head + .agent-grid { margin-bottom: 0; }
.agent-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.acc.people-list { padding-top: 6px; padding-bottom: 6px; }
.people-list .person { padding: 10px 0; }
.people-list .person + .person { border-top: 1px solid var(--line); }
details.gone { margin: 14px 0 0; }
.note { margin-top: 36px; }
.use-note { margin: 0 0 8px; }

/* hover states */
.tabs button:hover { background: var(--card-solid); }
.kind:hover { background: var(--card-solid); }
.seg button:hover { color: var(--text); }
.pick:hover, .vis button:hover { background: var(--well-2); }
.pick.on:hover, .vis button.on:hover { background: var(--card-solid); }
.agent-item:hover .st { color: var(--text-2); }

@media (hover: none) { kbd { display: none; } }
@media (max-width: 900px) {
  kbd { display: none; }
  .view-chat .bar, .view-jobs .bar, .view-setup .bar { padding-left: 16px; padding-right: 16px; }
  .side { display: flex; }
  .smart-pop { left: 16px; right: 16px; width: auto; }
  .jrow { grid-template-columns: minmax(0,1fr) auto; }
  /* every tap target at least 44 px */
  .link, .link.small { min-height: 44px; }
  .add-btn { width: 44px; height: 44px; }
  .nav-item, .room-item, .agent-item { min-height: 48px; }
  .react { position: relative; height: 32px; }
  .react::after { content: ""; position: absolute; inset: -6px -2px; }
  .react.add { width: 36px; }
  .reacts { gap: 8px; }
  .replies { min-height: 44px; padding: 0 4px; }
  .form select, .form input { min-height: 44px; }
  .x { width: 44px; height: 44px; }
  .job-head .job-more { min-height: 44px; padding: 0 10px; margin: -10px -10px -10px auto; }
  .room-agent, .approve-chip, .older, .tabs button, .btn, .btn.small { min-height: 44px; }
  .msg-menu .quick button { width: 44px; height: 44px; }
  .msg-menu .items button { min-height: 48px; }
  .hit { min-height: 56px; }
  .search-row select { height: 44px; }
  .pin-row .link { min-height: 44px; }
  .composer.slim { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
  /* the agent form's bottom bar: solid, and the form leaves room for it */
  .panel-body:has(.form-actions) { padding-bottom: 0; }
  .form-actions { position: sticky; bottom: 0; z-index: 2; background: var(--card-solid); margin: 18px -24px 0; padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); box-shadow: none; }
}
@media (max-width: 600px) {
  /* the text box gets the full width: @ and the level picker move to a small row on focus */
  .composer-box { flex-wrap: wrap; padding: 4px 4px 4px 16px; min-height: 52px; column-gap: 4px; row-gap: 0; }
  .composer-box .tools { display: none; order: -1; flex-basis: 100%; gap: 6px; padding: 4px 0 0; }
  .composer-box:focus-within .tools, .composer.has-text .tools { display: flex; }
  .composer-box .tools .at-btn, .composer-box .tools .smart-btn { position: relative; height: 40px; margin: 0; }
  .composer-box .tools .at-btn { width: 44px; border-radius: 999px; }
  .composer-box .tools .smart-btn { padding: 0 12px; font-size: 13px; }
  .composer-box .tools button::after { content: ""; position: absolute; inset: -4px 0; }
  .composer textarea { flex: 1 1 0; min-width: 0; max-height: 96px; padding: 10px 0; }
  .composer .send { width: 44px; height: 44px; }
  .reply-bar { padding: 2px 2px 2px 12px; margin-bottom: 6px; border-radius: 16px; }
  .attach-chip { margin-bottom: 6px; }
  .attach-chip img, .attach-chip .fi { width: 36px; height: 36px; }
  .approve-chip { padding: 0 12px; font-size: 12.5px; }
  .room-agent.unset { display: none; }
  .room-agent { padding: 4px 10px 4px 4px; }
  .sheet.confirm { place-items: end center; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .ask-acts .btn { flex: 1; min-height: 48px; }
  .search-row select { max-width: 38%; margin-right: 8px; }
  .sheet { padding-top: calc(12px + env(safe-area-inset-top)); }
}
#panelTitle:focus { outline: none; }

/* round 7 (critics round 2, 30 Nov 69) */
/* sidebar: the agent list fades out above the me card instead of a hard cut */
.side-scroll { padding-bottom: 20px; -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
.room-item.muted { opacity: .62; }
.room-item.muted.on { opacity: 1; }
.room-item { -webkit-touch-callout: none; }
.draft-tag { font-size: 11.5px; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; flex: none; }
/* reply count: avatars overlap each other, never the number */
.replies .stack .av { margin-right: 0; box-shadow: 0 0 0 2px var(--canvas); }
.replies .stack .av + .av { margin-left: -6px; }
.replies { gap: 6px; }
/* reaction chips sit close under the bubble */
.reacts { margin-top: 4px; gap: 4px; }
/* unread line uses the accent, red stays for errors */
.unread-line { color: var(--accent); }
.unread-line::before, .unread-line::after { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.replies.new { color: var(--accent); }
.new-dot { background: var(--accent); }
/* forwarded messages */
.fwd { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.fwd svg { width: 14px; height: 14px; }
.msg.mine .fwd { color: rgba(255,255,255,.8); }
.fwd-preview { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--well); box-shadow: inset 3px 0 0 var(--ring); margin-bottom: 16px; font-size: 13.5px; }
.fwd-preview b { font-weight: 500; color: var(--accent); font-size: 12.5px; }
.fwd-preview span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* mute and leave */
.room-acts { display: grid; gap: 8px; margin-top: 18px; }
.room-acts .pick svg { color: var(--accent); flex: none; }
.room-acts .pick.bad, .room-acts .pick.bad svg { color: var(--bad-text); }
.room-menu { width: 240px; }
/* search filters */
.search-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.search-filters select, .date-f input { border: 0; appearance: none; -webkit-appearance: none; background-color: var(--well); height: 36px; border-radius: 999px; font-size: 13.5px; color: var(--text-2); }
.search-filters select { background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2366686d' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E") right 10px center/14px no-repeat; padding: 0 30px 0 14px; max-width: 180px; }
.date-f { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.date-f input { padding: 0 10px; width: auto; border-bottom: 0 !important; font-family: inherit; }
.search-more { display: block; margin: 8px auto; }
.search-row .icon-btn { box-shadow: none; background: var(--well); margin-right: 10px; }
/* image lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(10,10,10,.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.lightbox img { max-width: 100%; max-height: calc(100% - 64px); object-fit: contain; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.lb-bar { display: flex; gap: 10px; }
.lb-bar .btn { background: rgba(255,255,255,.92); text-decoration: none; }
.file.img { cursor: zoom-in; }
/* setup: agents fill the row, archived ones open from the section head, backup row */
.agent-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.sec-acts { display: inline-flex; align-items: center; gap: 18px; }
.link.quiet { color: var(--muted); }
.link.quiet:hover { color: var(--text-2); }
.gone-grid .agent-card { opacity: .7; }
.backup-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sched-meta small { display: flex; flex-wrap: wrap; gap: 0 12px; }
.seg.days button { font-size: 12.5px; }
/* jobs list: the agent shows inside the row when the agent column is hidden */
.jrow .p small .ag-m { display: none; }
/* login card fits a 360 px phone */
.login-card form { width: 100%; }
@media (max-width: 900px) {
  .jrow .p small .ag-m { display: inline; color: var(--text-2); }
  .search-filters select, .date-f input { height: 44px; }
}
@media (max-width: 600px) {
  .composer-box .tools .at-btn, .composer-box .tools .smart-btn { height: 44px; }
  .composer-box .tools button::after { display: none; }
  .composer.keep-tools .tools { display: flex; }
  .search-filters { padding: 8px 12px; gap: 6px; }
  .search-filters select { flex: 1 1 40%; max-width: none; }
  .date-f { flex: 1 1 40%; min-width: 0; }
  .date-f input { width: 100%; padding: 0 8px; font-size: 13px; }
  .date-f input { flex: 1; min-width: 0; }
  .login-card form { padding: 20px 18px; }
  .backup-row .btn { width: 100%; }
  .seg.days button { font-size: 11.5px; }
}
.new-dot { margin-left: 2px; }
.room-menu .items { border-top: 0; margin-top: 0; padding-top: 0; }
#searchSheet .sheet-card { max-width: 700px; }
@media (min-width: 601px) { .date-f input { width: 138px; padding: 0 8px; } .search-filters { flex-wrap: nowrap; } .search-filters select { max-width: 150px; } }

/* round 4: phone layers, focus, toasts, Thai dates, lists, setup sessions */
@media (max-width: 900px) {
  /* the app is a fixed box that follows the visual viewport, so the page never scrolls behind the keyboard */
  html, body { overflow: hidden; overscroll-behavior: none; }
  .app { position: fixed; top: 0; left: 0; right: 0; height: var(--vh, 100dvh); transform: translateY(var(--vt, 0px)); overflow: hidden; }
}
/* every place people type shows where the keyboard is */
.login-card input:focus-visible, .ask-card input:focus-visible, .room-form input:focus-visible,
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible,
.search-filters select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form input:focus, .form select:focus, .form textarea:focus, .room-form input:focus { box-shadow: none; background: var(--card-solid); }
.composer-box:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.composer textarea:focus-visible, .edit-box:focus-visible { outline: 0; }
.msg.editing .bubble:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
/* search box reads as a field: a soft fill and a magnifier, a ring while typing */
.sheet-card #searchInput { margin: 12px 14px; padding: 12px 16px 12px 44px; border: 0 !important; border-radius: 999px; font-size: 16px;
  background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2366686d' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='9' cy='9' r='5.5'/%3E%3Cpath d='m13.5 13.5 3 3'/%3E%3C/svg%3E") 16px center/18px no-repeat; }
.sheet-card #searchInput:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; background-color: var(--accent-text); }
.sheet-card #searchInput::placeholder { color: var(--muted); }
/* a static card in room info must not look like the buttons above it */
.room-kind { background: transparent; padding: 4px 2px; }
.room-kind .hash { background: var(--well); }
/* toasts: readable, can be closed */
.toast { display: flex; align-items: center; gap: 10px; border-radius: 18px; padding: 8px 8px 8px 18px; line-height: 1.45; width: max-content; max-width: min(560px, calc(100% - 32px)); }
.toast-t { flex: 1; min-width: 0; }
.toast-x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; }
.toast-x svg { width: 14px; height: 14px; stroke-width: 2; }
.toast-x:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* markdown lists inside a bubble and in answers */
.md-list { margin: 4px 0; padding-left: 22px; white-space: normal; }
.md-list li { margin: 2px 0; }
.msg.mine .md-list li::marker { color: rgba(255,255,255,.8); }
/* @ menu: sits above the box, scrolls, and fades at the bottom while more is below */
.mention-pop { bottom: calc(100% + 4px); }
.mention-hint { position: sticky; bottom: -8px; display: block; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 2px; background: var(--card); }
.unread-line { transition: opacity .45s ease; }
.unread-line.fade { opacity: 0; }
/* Thai date picker in search */
.search-filters { position: relative; }
button.date-f { border: 0; background: var(--well); height: 36px; border-radius: 999px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
button.date-f b { font-weight: 500; color: var(--text-2); }
button.date-f.set { background: var(--accent-soft); }
button.date-f.set b { color: var(--accent); }
.cal-pop { flex: 1 1 100%; max-width: 340px; margin-left: auto; background: var(--card-solid); border-radius: 20px; box-shadow: inset 0 0 0 1px var(--line); padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-weight: 600; font-size: 14.5px; }
.cal-head .icon-btn { box-shadow: none; background: var(--well); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid .wd { text-align: center; font-size: 11.5px; color: var(--muted); padding: 4px 0; }
.cal-grid button { border: 0; background: transparent; height: 36px; border-radius: 12px; font-size: 13.5px; color: var(--text); }
.cal-grid button:hover { background: var(--well-2); }
.cal-grid button.today { box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.cal-grid button.on { background: var(--accent); color: var(--accent-text); }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; }
/* lightbox previous and next */
.lb-step { width: 40px; padding: 0 !important; display: inline-grid; place-items: center; }
.lb-step:disabled { opacity: .4; }
/* setup: sessions and backup state */
.sess .acc-ic { flex: none; }
.sess .pill { margin-left: 8px; vertical-align: 1px; }
.bad-line { color: var(--bad-text) !important; display: block; margin-top: 4px; line-height: 1.5; }
@media (max-width: 900px) {
  button.date-f { height: 44px; }
  .cal-grid button { height: 40px; }
}
@media (max-width: 600px) {
  button.date-f { flex: 1 1 40%; min-width: 0; justify-content: center; }
  .cal-pop { max-width: none; }
  .sheet-card #searchInput { margin: 10px 8px 10px 12px; }
  .toast { left: 16px; right: 16px; transform: none; width: auto; max-width: none; }
}
@media (min-width: 601px) { .search-filters { flex-wrap: wrap; } }

/* round 5 (critics round 4, 30 Nov 69) */
/* links in messages: open outside, long addresses wrap instead of pushing the bubble wide */
.msg-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; word-break: break-word; }
.msg.mine .text .msg-link { color: #fff; text-decoration-color: rgba(255,255,255,.7); }
.result .msg-link, .draftbox .msg-link { overflow-wrap: anywhere; }
/* code and drafts in my own dark bubble stay readable */
.msg.mine .draftbox { background: rgba(255,255,255,.14); }
.msg.mine .draftbox .draft-text { color: #fff; }
.msg.mine .draftbox .btn { background: rgba(255,255,255,.9); color: var(--text); }
.msg.mine code { color: #fff; }
/* a failed message keeps my colours, white text with a red outline */
.msg.mine.failed .bubble { background: var(--grad); outline: 2px solid var(--bad); outline-offset: 2px; }
.msg.mine.failed .text { color: #fff; }
/* the message menu never runs off the screen: it scrolls inside */
.msg-menu { overflow-y: auto; overscroll-behavior: contain; }
/* member view of room info: plain text */
.room-plain { display: grid; gap: 4px; padding: 4px 2px 8px; }
.room-plain b { font-size: 17px; font-weight: 600; }
.room-plain span { color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.archived-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--warn) 10%, var(--card-solid)); color: var(--text-2); font-size: 13.5px; }
.side-more { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; padding: 8px 12px; border-radius: 14px; color: var(--muted); font-size: 13.5px; text-align: left; }
.side-more:hover { background: var(--hover); }
.side-more .chev { width: 14px; height: 14px; }
.side-more[aria-expanded="true"] .chev { transform: rotate(180deg); }
.shelf .room-item { opacity: .75; }
.pill.paused_budget, .job.s-paused_budget { --s: var(--warn); }
.pill.expired, .job.s-expired { --s: var(--muted); }
.path-line { font-family: "JetBrains Mono", monospace; font-size: 12px !important; }
/* keyboard: one stop per message, a skip link to the message box */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--card); color: var(--accent); padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-lift); font-weight: 500; transform: translateY(-160%); }
.skip-link:focus { transform: none; outline: 2px solid var(--accent); outline-offset: 2px; }
.msg[tabindex]:focus { outline: none; }
.msg[tabindex]:focus-visible .bubble, .msg[tabindex]:focus-visible .job { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg[tabindex]:focus-visible .hover-bar { opacity: 1; transform: none; pointer-events: auto; }
/* the sidebar: the me card never covers the agent list on a short screen */
.side-scroll { -webkit-mask-image: none; mask-image: none; padding-bottom: 8px; }
.side .me { position: relative; }
@media (max-height: 860px) { .group-head { padding-top: 12px; } .nav-item, .room-item, .agent-item { padding-top: 7px; padding-bottom: 7px; } }
/* phones: every field 16 px so iOS does not zoom the page on tap */
@media (pointer: coarse), (max-width: 700px) {
  input, select, textarea, .form input, .form select, .form textarea, .room-form input, .search-filters select { font-size: 16px; }
  .search-filters select { padding-left: 12px; padding-right: 28px; }
}
/* phones: long text in the box scrolls under its own top edge, not under the @ and level buttons */
@media (max-width: 600px) {
  .composer textarea { padding: 0; margin: 10px 0; }
  .composer.tall:not(.keep-tools) .composer-box .tools { display: none; }
}
/* less movement for people who ask for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.backup-row + .backup-row { margin-top: 10px; }

/* one content width for chat, jobs and setup, so the page title does not jump when switching views */
:root { --col: 820px; }
/* long addresses break after a slash or a dot (the page puts a soft break there), never inside a word */
.msg-link { word-break: normal; overflow-wrap: anywhere; }
/* the words searched for, inside a result line */
.hit .snip mark { background: color-mix(in srgb, var(--accent) 22%, var(--card-solid)); color: inherit; border-radius: 4px; padding: 0 2px; }
.thread-older { display: block; margin: 0 auto 12px; }
/* a phone: the offline pill is only its dot, so the room name keeps its space */
@media (max-width: 420px) {
  .conn.off { padding: 0; width: 44px; height: 44px; justify-content: center; flex: none; }
  .conn.off span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .conn.off i { width: 10px; height: 10px; }
}
/* a phone on its side: a room without its own agent shows no empty chevron chip, the same as upright */
@media (max-width: 900px) { .room-agent.unset { display: none; } }

/* markdown blocks in a message: quote, heading, italic, strike */
.md-quote { display: block; margin: 4px 0; padding: 2px 0 2px 12px; border-left: 3px solid color-mix(in srgb, var(--text) 22%, transparent); color: var(--text-2); }
.msg.mine .md-quote { border-left-color: rgba(255,255,255,.55); color: inherit; }
.md-h { display: block; margin: 6px 0 2px; font-weight: 600; line-height: 1.4; }
.md-h1 { font-size: 1.18em; }
.md-h2 { font-size: 1.08em; }
.md-h3 { font-size: 1em; }
.msg .text s, .result s { opacity: .75; }
.link-host { display: inline-block; margin-left: 2px; padding: 0 6px; border-radius: 6px; font-size: 11.5px; line-height: 18px; vertical-align: 1px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-2); }
.msg.mine .link-host { background: rgba(255,255,255,.22); color: #fff; }

/* state words in pills and job cards use the darker text tones */
.job.s-failed, .job.s-rejected, .pill.failed, .pill.rejected { --st: var(--bad-text); }
.job.s-waiting_approval, .job.s-paused_quota, .job.s-paused_budget, .pill.waiting_approval, .pill.paused_quota, .pill.paused_budget { --st: var(--warn-text); }

/* round 6: thin quiet scrollbars (Chrome, Edge and Firefox; Mac overlay bars already hide themselves) */
.feed, .panel-body, .side-scroll { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
.feed::-webkit-scrollbar, .panel-body::-webkit-scrollbar, .side-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.feed::-webkit-scrollbar-track, .panel-body::-webkit-scrollbar-track, .side-scroll::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb, .panel-body::-webkit-scrollbar-thumb, .side-scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 18%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.feed::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--text) 30%, transparent); }
/* with the thread panel open the header fade alone is enough: a second fade on the feed left a grey smear of a cut bubble */
body.panel-open .feed { -webkit-mask-image: none; mask-image: none; }

/* login: show passcode button sits inside the field */
.login-card .pw-wrap, .ask-card .pw-wrap { position: relative; }
.login-card .pw-wrap input, .ask-card .pw-wrap input { padding-right: 76px; width: 100%; box-sizing: border-box; }
.ask-card .pw-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 44px; min-width: 60px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.ask-card .pw-show:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ask-card .pw-wrap { margin-bottom: 16px; }
.ask-card .pw-wrap input { margin-bottom: 0; }
.login-card .pw-show { position: absolute; right: 6px; top: 4px; min-height: 40px; min-width: 60px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.login-card .pw-show:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* message menu on a short screen: a fade and a hint while Edit and Delete are still below */
.msg-menu.more-below::after { content: 'เลื่อนลงดูเพิ่ม'; position: sticky; bottom: -10px; display: block; margin: -46px -10px -10px; padding: 30px 0 8px; text-align: center; font-size: 12.5px; color: var(--text-2); background: linear-gradient(to bottom, transparent, var(--card) 62%); pointer-events: none; border-radius: 0 0 22px 22px; }
/* a very long message folds after about 30 lines */
.msg .text.fold { max-height: calc(1.6em * 30); overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 4.8em), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 4.8em), transparent); }
.msg .unfold { display: inline-flex; align-items: center; min-height: 40px; margin-top: 4px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 500; }
.msg.mine .unfold { background: rgba(255,255,255,.18); color: #fff; }
/* messages out of view skip layout until they come near (a room of long Thai answers stays fast) */
/* No content-visibility on messages: placeholder heights put room switches and jumps on the wrong message. */
/* sessions on a phone: the device name gets the whole line, the sign out button sits under it on the right */
@media (max-width: 560px) {
  .sess { flex-wrap: wrap; row-gap: 8px; }
  .sess .sched-meta { flex: 1 1 calc(100% - 70px); }
  .sess .sched-meta b { white-space: normal; }
  .sess .btn { margin-left: auto; }
}

/* round 9: phone search filters fold into one row */
.filter-toggle { display: none; }
@media (max-width: 600px) {
  .filter-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
  .filter-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .filter-toggle.on { color: var(--accent); font-weight: 500; }
  .filter-toggle[aria-expanded="true"] { border-bottom: 0; }
  .filter-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .search-filters:not(.open) { display: none; }
}
/* names and message words never turn around a whole line (a hidden direction mark from someone else) */
.msg .text, .msg .head b, .room-item .n, .file, .attach-chip .n, .hit, .link-host { unicode-bidi: isolate; }
.len-hint { position: absolute; right: 14px; bottom: calc(100% + 4px); font-size: 12px; color: var(--text-2); background: var(--card); padding: 2px 8px; border-radius: 999px; box-shadow: var(--shadow); pointer-events: none; }
.len-hint.over { color: var(--bad-text); font-weight: 500; }
.composer-box { position: relative; }
.job.s-cancelled, .pill.cancelled { --s: var(--muted); }

/* ===================== Arc brand book 01: glass layout (owner 1 Dec 69) ===================== */
:root { --card-in: rgba(255,255,255,.80); --line-2: rgba(20,20,20,.14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --card-in: rgba(70,70,74,.55); --line-2: rgba(255,255,255,.2); } }
:root[data-theme="dark"] { --card-in: rgba(70,70,74,.55); --line-2: rgba(255,255,255,.2); }
body { font-family: "Inter", "Noto Sans Thai", system-ui, sans-serif; line-height: 1.6; }
:lang(th) body, body { -webkit-text-size-adjust: 100%; }
.glass, .side, .main, .panel { background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: inset 0 0 0 1px var(--stroke), var(--shadow); }
@media (prefers-reduced-transparency: reduce) {
  .glass, .side, .main, .panel, .card, .login-card { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--card-solid) !important; }
}

/* desktop frame: sidebar 224 px and the workspace, both frosted panels on the light wash */
.app { grid-template-columns: 232px minmax(0,1fr) auto; gap: 14px; padding: 14px; }
.side { border-radius: 22px; padding: 18px 12px 12px; gap: 2px; }
.main { border-radius: 22px; position: relative; --card: var(--card-in); }
.panel { margin: 0; border-radius: 22px; --card: var(--card-in); }
.side-top { padding: 0 6px 14px; }
.brand { font-weight: 600; font-size: 18px; letter-spacing: -.01em; gap: 10px; }
.nav { gap: 1px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.nav-item { padding: 8px 10px; border-radius: 12px; gap: 10px; font-size: 14.5px; color: var(--text); min-height: 40px; }
.nav-item svg { width: 18px; height: 18px; padding: 0; border-radius: 0; background: none !important; color: var(--text-2); stroke-width: 1.6; }
.nav-item.on { background: var(--chip); box-shadow: inset 0 0 0 1px var(--line-2); }
.nav-item kbd { margin-left: auto; font: 500 11px "Inter"; color: var(--muted); }
.owner-only { display: none !important; }
body.owner .owner-only { display: flex !important; }
.group-head { font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 14px 10px 4px; }
.room-item { padding: 7px 10px; border-radius: 12px; font-size: 14.5px; color: var(--text); min-height: 38px; }
.room-item .hash { width: 26px; height: 26px; background: var(--well); color: var(--text-2); font-size: 13px; }
.room-item.on { background: var(--chip); box-shadow: inset 0 0 0 1px var(--line-2); }
.room-item.on .hash { background: var(--accent); color: var(--accent-text); }
.me { background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); border-radius: 16px; }
.count { background: var(--well-2); color: var(--text); }
.count.at { background: var(--accent); color: var(--accent-text); }

/* header inside the workspace */
.bar { padding: 22px 28px 40px; }
.bar h1 { font-size: 26px; font-weight: 500; letter-spacing: -.01em; line-height: 1.35; }
.bar-title .muted { font-size: 13.5px; }
.feed { padding: 36px 28px 16px; }
.jobs-view { padding: 6px 28px 28px; }
.composer { padding: 6px 24px 18px; }
.composer-box { background: var(--card-solid); box-shadow: inset 0 0 0 1px var(--line-2); }
.send { background: var(--accent); color: var(--accent-text); }

/* messages: own words in carbon, others on clean white, the room stays calm */
.bubble { background: var(--card-solid); box-shadow: inset 0 0 0 1px var(--line); border-radius: 6px 20px 20px 20px; }
.msg.mine .bubble { background: var(--mine); box-shadow: none; border-radius: 20px 6px 20px 20px; }
.msg.cont .bubble { border-radius: 20px; }
.msg.sys .bubble { background: var(--chip); box-shadow: inset 0 0 0 1px var(--line); }
.day span { background: var(--chip); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.msg .text .at { color: var(--text); font-weight: 600; }
.av { background: var(--well); color: var(--text-2); }
.av.agent { background: var(--card-solid); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

/* task card and state words: a symbol with every state, colour only for trouble */
.job { background: var(--card-solid); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 18px; }
.pill { --s: var(--text-2); background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); padding: 3px 11px 3px 9px; font-size: 12.5px; }
.pill::before { content: "◷"; width: auto; height: auto; border-radius: 0; background: none; color: var(--s); font: 600 12px/1 "Inter", system-ui, sans-serif; }
.pill.queued::before { content: "◉"; } .pill.running::before { content: "◷"; }
.pill.waiting_approval::before { content: "◇"; } .pill.done::before { content: "✓"; }
.pill.failed::before, .pill.expired::before { content: "!"; } .pill.cancelled::before, .pill.rejected::before { content: "○"; }
.pill.paused_quota::before, .pill.paused_budget::before { content: "Ⅱ"; font-size: 10px; }
.pill.ok::before { content: "✓"; }
.pill.failed { color: var(--bad-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 45%, transparent); }
.pill.waiting_approval { box-shadow: inset 0 0 0 1px var(--text); }
.job-track i { background: var(--accent); }
.btn { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); }
.btn:hover { background: var(--well); }
.btn.primary, .btn.solid { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.btn.solid:hover, .btn.primary:hover { background: var(--accent-2); }
.btn.danger { box-shadow: none; }
.tabs button { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-2); }
.tabs button.on { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.tabs button span { opacity: .7; }
.approve-chip { background: var(--accent); color: var(--accent-text); }
.approve-chip i { background: var(--accent-text); }

/* cards on the home, agents and approvals pages */
.card { display: block; background: var(--card-solid); border: 0; border-radius: 18px; padding: 18px 20px; box-shadow: inset 0 0 0 1px var(--line), var(--shadow); text-align: left; color: var(--text); }
.card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 500; }
.jobs-view.home-view > *, #agentsView > *, .approvals-view > *, #roomsView > * { max-width: 1040px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 4px; min-height: 104px; cursor: pointer; }
.stat span { font-size: 13.5px; color: var(--text-2); }
.stat b { font: 300 44px/1.05 "Inter", sans-serif; letter-spacing: -.02em; }
.stat:hover { box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-lift); }
.home-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 14px; align-items: start; }
.care-list { display: flex; flex-direction: column; }
.care-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 0; background: none; padding: 12px 4px; text-align: left; border-bottom: 1px solid var(--line); color: var(--text); min-height: 52px; border-radius: 0; }
.care-row:last-child { border-bottom: 0; }
.care-row:hover { background: var(--well); border-radius: 12px; }
.care-row.on { background: var(--well-2); border-radius: 12px; }
.care-row .t { display: flex; flex-direction: column; min-width: 0; font-size: 15px; }
.care-row .t small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { margin-top: 12px; display: flex; gap: 8px; }
.empty-line { margin: 8px 0; font-size: 14px; }
.brief { position: relative; }
.brief .when { position: absolute; top: 20px; right: 20px; font-size: 12.5px; color: var(--muted); }
.brief-lines p { margin: 0 0 4px; font-size: 14px; color: var(--text-2); line-height: 1.6; }
.agent-board { display: flex; flex-direction: column; gap: 10px; }
.agent-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto auto; align-items: center; gap: 14px; }
.agent-row .num { font: 300 20px "Inter"; color: var(--muted); }
.agent-row .t { display: flex; flex-direction: column; min-width: 0; }
.agent-row .t b { font-weight: 500; font-size: 16px; }
.agent-row .t small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row .st { font-size: 12.5px; color: var(--text-2); }
.agent-row .acts { display: flex; gap: 8px; }
.center { text-align: center; margin-top: 14px; }
.approve-grid { display: grid; grid-template-columns: minmax(0,.9fr) minmax(0,1.3fr); gap: 14px; align-items: start; }
.ad-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.facts { margin: 12px 0 0; display: flex; flex-direction: column; }
.facts div { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13.5px; }
.facts dd { margin: 0; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.ad-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.ad-acts .btn { padding: 11px 22px; font-size: 14.5px; min-height: 44px; }
.ad-acts .link { margin-left: auto; }
.link { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.room-card { margin-bottom: 12px; }
#schedulesView .sec { max-width: 760px; }

/* sign in: a private entrance, the same dark glass scene in light and dark */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: stretch; place-items: stretch; padding: 28px clamp(20px, 5vw, 56px); color: #fff; color-scheme: dark;
  background: radial-gradient(1400px 900px at 118% 135%, transparent 56%, rgba(255,255,255,.16) 59%, transparent 63.5%),
              radial-gradient(1100px 760px at -20% -40%, transparent 54%, rgba(255,255,255,.12) 57.5%, transparent 62%),
              linear-gradient(150deg, #6e6f73 0%, #4b4c50 38%, #2b2b2e 72%, #1c1c1e 100%); background-attachment: fixed; }
.login-top { display: flex; align-items: center; justify-content: space-between; }
.login .brand { color: #fff; }
.login .tag { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.32); color: rgba(255,255,255,.9); }
.login-grid { flex: 1; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,400px); gap: 48px; align-items: center; max-width: 1080px; width: 100%; margin: 0 auto; padding: 32px 0; }
.login-hero h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 300; line-height: 1.32; margin: 0 0 18px; letter-spacing: -.01em; }
.login-hero p { font-size: 16px; line-height: 1.7; color: rgba(255,255,255,.82); margin: 0; }
.login-card { max-width: none; text-align: left; background: rgba(40,40,44,.42); -webkit-backdrop-filter: saturate(150%) blur(24px); backdrop-filter: saturate(150%) blur(24px);
  border-radius: 22px; padding: 26px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.26), 0 24px 60px -24px rgba(0,0,0,.5); }
.login-card h2 { font-size: 20px; font-weight: 500; margin: 0 0 18px; }
.login-card form { background: none; padding: 0; box-shadow: none; }
.login-card label { color: rgba(255,255,255,.75); }
.login-card input { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); border-radius: 14px; }
.login-card input::placeholder { color: rgba(255,255,255,.5); }
.login-card .pw-show { color: rgba(255,255,255,.8); }
.login-card .hint { color: rgba(255,255,255,.7); }
.login-card .btn.primary { background: #fff; color: #141414; border-radius: 999px; min-height: 48px; margin-top: 6px; }
.login-card .btn.primary:hover { background: #e9eaec; }
.login-card .err { color: #ffb4b4 !important; }
.login :focus-visible { outline-color: #fff; }

/* phone: one hand, 20 px edges, a tab bar at the bottom */
.tabbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0,1fr); padding: 0; gap: 0; }
  .tabbar button { white-space: nowrap; }
  .bar h1 { font-size: 24px; }
  .main { border-radius: 0; box-shadow: none; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .side { border-radius: 0 22px 22px 0; background: var(--side-solid); }
  .bar { padding: 14px 20px 36px; }
  .feed, .jobs-view { padding-left: 20px; padding-right: 20px; }
  .jobs-view { padding-bottom: 96px; }
  .tabbar { display: flex; position: absolute; left: 20px; right: 20px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 6; justify-content: space-around; gap: 4px; padding: 6px;
    border-radius: 999px; background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: inset 0 0 0 1px var(--stroke), var(--shadow-lift); }
  .tabbar button { position: relative; flex: 1; border: 0; background: none; min-height: 44px; border-radius: 999px; font-size: 14px; color: var(--text-2); }
  .tabbar button.on { background: var(--accent); color: var(--accent-text); font-weight: 500; }
  .tabbar .dotc { top: 4px; right: 18%; }
  .view-chat .tabbar { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
  .stat { min-height: 84px; padding: 12px 14px; }
  .stat b { font-size: 32px; }
  .stat span { font-size: 12.5px; }
  .home-grid, .approve-grid { grid-template-columns: minmax(0,1fr); }
  .agent-row { grid-template-columns: 28px minmax(0,1fr); }
  .agent-row .st { grid-column: 2; }
  .agent-row .acts { grid-column: 1 / -1; }
  .agent-row .acts .btn { flex: 1; min-height: 44px; }
  .ad-acts .btn { flex: 1; }
  .ad-acts .link { margin: 4px auto 0; }
  .facts div { grid-template-columns: minmax(0,1fr); gap: 2px; }
  .login { padding: 20px; }
  .login-grid { grid-template-columns: minmax(0,1fr); gap: 28px; align-content: space-between; padding: 28px 0 8px; }
  .login-hero h1 { font-size: 34px; }
  .login-card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.view-home #approvalChip, .view-approvals #approvalChip { display: none !important; }
.jrow { background: var(--card-solid); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.jrow.hot { box-shadow: inset 0 0 0 1.5px var(--text), var(--shadow); }
.jrow .p small .why { color: var(--text-2); }
.job-why { background: var(--well); box-shadow: inset 3px 0 0 var(--text); }
.job-why b { color: var(--text); }
/* state labels: monochrome with a symbol; only trouble keeps a colour */
.pill.waiting_approval, .pill.paused_quota, .pill.paused_budget, .pill.running, .pill.queued, .pill.done, .pill.expired, .pill.cancelled, .pill.rejected,
.job.s-waiting_approval, .job.s-paused_quota, .job.s-paused_budget, .job.s-running, .job.s-queued, .job.s-done, .job.s-expired, .job.s-cancelled, .job.s-rejected { --s: var(--text); --st: var(--text); }
.pill.failed, .job.s-failed { --s: var(--bad-text); --st: var(--bad-text); }
.job-state { background: transparent; color: var(--st, var(--text)); box-shadow: inset 0 0 0 1px var(--line-2); padding: 3px 11px 3px 9px; font-size: 12.5px; }
.job-state i { display: none; }
.job-state::before { content: "◷"; font: 600 12px/1 "Inter", system-ui, sans-serif; }
.job.s-queued .job-state::before { content: "◉"; } .job.s-waiting_approval .job-state::before { content: "◇"; }
.job.s-done .job-state::before { content: "✓"; } .job.s-failed .job-state::before, .job.s-expired .job-state::before { content: "!"; }
.job.s-cancelled .job-state::before, .job.s-rejected .job-state::before { content: "○"; }
.job.s-paused_quota .job-state::before, .job.s-paused_budget .job-state::before { content: "Ⅱ"; font-size: 10px; }
.job.s-waiting_approval .job-state { box-shadow: inset 0 0 0 1px var(--text); }
.job.s-failed .job-state { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 45%, transparent); }
.toast { background: var(--toast-bg); color: var(--toast-text); }
.toast a, .toast button:not(.toast-x) { color: var(--toast-text); }
.toast-x { background: color-mix(in srgb, var(--toast-text) 14%, transparent); color: var(--toast-text); }
.toast-x:focus-visible { outline-color: var(--toast-text); }
.tabbar .dotc:empty { min-width: 8px; width: 8px; height: 8px; padding: 0; top: 10px; right: 26%; }
/* review round 1: more silver light behind real glass in light mode, larger mark, clearer states */
:root:not([data-theme="dark"]) body { background:
  radial-gradient(1500px 1000px at 112% 128%, transparent 56%, rgba(255,255,255,.95) 59.5%, transparent 64%),
  radial-gradient(1300px 900px at -15% -35%, transparent 54%, rgba(255,255,255,.85) 57.5%, transparent 62.5%),
  radial-gradient(1000px 700px at 75% 10%, rgba(255,255,255,.55), transparent 70%),
  linear-gradient(135deg, #F2F3F5 0%, #DCDFE3 48%, #C4C8CD 100%) fixed; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background: var(--page) fixed; } }
:root:not([data-theme="dark"]) { --card: rgba(255,255,255,.52); --card-in: rgba(255,255,255,.46); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --card: rgba(48,48,48,.62); --card-in: rgba(70,70,74,.55); } }
.card, .jrow, .job { background: color-mix(in srgb, var(--card-solid) 80%, transparent); }
.side .brand { font-size: 20px; }
.side .mark { width: 34px; height: 34px; border-radius: 9px; }
.pill, .job-state { min-height: 26px; font-weight: 500; }
.pill::before, .job-state::before { color: var(--text); }
.pill.failed::before, .job.s-failed .job-state::before { color: var(--bad-text); }
.agent-row { grid-template-columns: 36px minmax(0,1fr) 96px auto; }
.agent-row .st { white-space: nowrap; }
.agent-row .st::before { content: "◉ "; }
.agent-row .acts .link { padding: 0 6px; }
@media (max-width: 600px) {
  #roomAgentBtn, #pinsBtn { display: none !important; }
  .approve-chip { padding: 0 12px; font-size: 13px; }
}
/* Google sign in */
.google-box { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.google-btn { min-height: 44px; display: flex; justify-content: center; }
.google-box .hint { margin: 0; text-align: center; font-size: 13px; }
.google-box .link { align-self: center; color: rgba(255,255,255,.85); text-decoration-color: rgba(255,255,255,.4); min-height: 44px; }
.google-box + form:not([hidden]) { margin-top: 14px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.16); }
.ask-card .google-btn { margin: 6px 0 4px; }
.or-line { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
