:root {
  --bg: #f6f6f4; --side: #efefec; --panel: #ffffff; --raise: #ffffff; --bubble: #ececea; --line: #e2e2de;
  --text: #17171a; --muted: #6b6b70; --faint: #9a9aa0; --accent: #0f9d63; --accent-ink: #ffffff;
  --accent-soft: color-mix(in oklab, var(--accent) 14%, transparent); --danger: #c93a3a; --unread: #2f7cf6; --warn: #e8833a;
  --radius: 22px; --shadow: 0 10px 40px rgba(0,0,0,.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c; --side: #121214; --panel: #0e0e10; --raise: #1a1a1d; --bubble: #232326; --line: #26262a;
    --text: #ededee; --muted: #9a9aa1; --faint: #6c6c73; --accent: #12a36c; --shadow: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0c; --side: #121214; --panel: #0e0e10; --raise: #1a1a1d; --bubble: #232326; --line: #26262a;
  --text: #ededee; --muted: #9a9aa1; --faint: #6c6c73; --accent: #12a36c; --shadow: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
.shell { display: grid; grid-template-columns: 320px minmax(0, 1fr) 0; height: 100dvh; }
.shell.panel-open { grid-template-columns: 320px minmax(0, 1fr) 380px; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-top { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.ws-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 8px; border-radius: 12px; font-weight: 600; font-size: 16px; text-align: left; }
.ws-name:hover { background: var(--bubble); }
.ws-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--raise); display: grid; place-items: center; flex: none; }
.icon-btn:hover { border-color: var(--faint); }
.icon-btn svg { width: 18px; height: 18px; }
.search { margin: 0 14px 8px; display: none; }
.search.on { display: block; }
.search input, .field input, .field textarea, .field select { width: 100%; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.search input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }

.list { overflow-y: auto; flex: 1; padding: 4px 8px 12px; }
.team-tile { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; margin: 2px 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--raise); text-align: left; }
.team-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.team-tile .meta { flex: 1; min-width: 0; }
.team-tile b { font-weight: 600; }
.sec { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px; color: var(--muted); font-size: 13px; }
.sec button { background: none; border: 0; color: var(--muted); padding: 2px 6px; border-radius: 8px; font-size: 13px; }
.sec button:hover { color: var(--text); background: var(--bubble); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 14px; text-align: left; }
.row:hover { background: color-mix(in oklab, var(--bubble) 60%, transparent); }
.row.active { background: var(--bubble); }
.row .meta { flex: 1; min-width: 0; }
.row .name, .team-tile .name { display: flex; align-items: baseline; gap: 6px; }
.row .name b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub, .team-tile .sub { display: block; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub.working { color: var(--accent); }
.row .sub.waiting { color: var(--warn); }
.tag { font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; flex: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--unread); flex: none; }
.count { min-width: 20px; height: 20px; border-radius: 10px; background: var(--unread); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; padding: 0 6px; flex: none; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.pill-btn { flex: 1; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--raise); font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pill-btn:hover { border-color: var(--faint); }
.pill-btn svg { width: 17px; height: 17px; }

/* avatars: people get initials, agents get the blob with eyes */
.av { --s: 44px; width: var(--s); height: var(--s); flex: none; position: relative; display: grid; place-items: center; border-radius: 50%; background: var(--c, #555); color: #fff; font-weight: 600; font-size: calc(var(--s) * .4); }
.av.blob { border-radius: 52% 48% 46% 54% / 55% 52% 48% 45%; }
.av.blob::before, .av.blob::after { content: ""; position: absolute; width: calc(var(--s) * .1); height: calc(var(--s) * .24); border-radius: 99px; background: rgba(0,0,0,.72); top: 30%; transform: rotate(-24deg); }
.av.blob::before { left: 34%; } .av.blob::after { left: 54%; top: 25%; }
.av .on { position: absolute; right: -1px; bottom: -1px; width: calc(var(--s) * .28); height: calc(var(--s) * .28); min-width: 10px; min-height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--side); }
.av .badge { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--warn); border: 2px solid var(--raise); display: grid; place-items: center; }
.av.team { border-radius: 14px; background: var(--accent); }
.av.team svg { width: 55%; height: 55%; color: var(--accent-ink); }

/* chat */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-head { position: absolute; top: 12px; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; z-index: 2; }
.chat-head .who { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 26px; border: 1px solid var(--line); background: color-mix(in oklab, var(--raise) 88%, transparent); backdrop-filter: blur(12px); font-weight: 500; }
.chat-head .left, .chat-head .right { position: absolute; top: 0; pointer-events: auto; display: flex; gap: 8px; }
.chat-head .left { left: 16px; } .chat-head .right { right: 16px; }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 76px max(20px, calc((100% - 860px) / 2)) 12px; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; color: var(--muted); font-size: 13px; margin: 18px 0 8px; }
.newline { display: flex; align-items: center; gap: 12px; color: var(--unread); font-size: 12px; font-weight: 600; letter-spacing: .04em; margin: 14px 0; }
.newline::before, .newline::after { content: ""; flex: 1; height: 1px; background: color-mix(in oklab, var(--unread) 40%, transparent); }
.m { display: flex; gap: 10px; align-items: flex-end; max-width: 80%; }
.m.mine { align-self: flex-end; flex-direction: row-reverse; }
.m .av { --s: 30px; }
.m .spacer { width: 30px; flex: none; }
.m .stack { display: flex; flex-direction: column; min-width: 0; }
.m .by { font-size: 12.5px; color: var(--muted); margin: 8px 0 3px 14px; }
.bubble { background: var(--bubble); padding: 10px 16px; border-radius: var(--radius); overflow-wrap: anywhere; }
.m.mine .bubble { background: var(--accent); color: var(--accent-ink); }
.m.mine .bubble a { color: inherit; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.bubble pre { background: rgba(0,0,0,.25); padding: 10px 12px; border-radius: 12px; overflow-x: auto; font-size: 13px; margin: 6px 0; }
.bubble code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.bubble :not(pre) > code { background: rgba(127,127,127,.18); padding: 1px 5px; border-radius: 6px; }
.bubble h3, .bubble h4 { margin: 8px 0 4px; font-size: 15px; }
.bubble table { border-collapse: collapse; font-size: 13.5px; margin: 6px 0; display: block; overflow-x: auto; }
.bubble td, .bubble th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.mention { color: var(--accent); font-weight: 600; }
.m.mine .mention { color: inherit; text-decoration: underline; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(127,127,127,.14); text-decoration: none; color: inherit; margin-top: 6px; }
.file svg { width: 20px; height: 20px; flex: none; }
.file small { color: inherit; opacity: .7; display: block; }
.file img { max-width: 280px; max-height: 240px; border-radius: 10px; display: block; }
.time { font-size: 11.5px; color: var(--faint); margin: 2px 14px 6px; }
.m.mine .time { text-align: right; }
.typing { color: var(--muted); font-size: 13.5px; padding: 4px max(20px, calc((100% - 860px) / 2)) 4px; min-height: 26px; }
.typing i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: 3px; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 420px; padding: 20px; }
.empty .av { margin: 0 auto 14px; --s: 72px; }
.empty h2 { color: var(--text); font-size: 20px; margin: 0 0 6px; }

.composer { padding: 8px max(20px, calc((100% - 860px) / 2)) max(16px, env(safe-area-inset-bottom)); position: relative; }
.composer form { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); background: var(--raise); border-radius: 28px; padding: 7px; }
.composer form:focus-within { border-color: var(--faint); }
.composer textarea { flex: 1; border: 0; background: none; outline: none; resize: none; padding: 9px 6px; max-height: 200px; min-height: 40px; line-height: 1.45; }
.composer .icon-btn { width: 40px; height: 40px; }
.send { background: var(--text) !important; color: var(--bg); border-color: transparent !important; }
.send:disabled { opacity: .35; cursor: default; }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px 12px; padding: 6px 10px; border-radius: 12px; background: var(--bubble); font-size: 13px; }
.attach-chip button { border: 0; background: none; color: var(--muted); }
.suggest { position: absolute; bottom: calc(100% - 4px); left: max(20px, calc((100% - 860px) / 2)); background: var(--raise); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; min-width: 260px; z-index: 5; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 10px; text-align: left; }
.suggest button.sel, .suggest button:hover { background: var(--bubble); }
.suggest .av { --s: 26px; }
.suggest small { color: var(--muted); }

/* right panel */
.panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; display: none; min-width: 0; }
.panel-open .panel { display: block; }
.panel-top { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 14px 0; }
.profile { text-align: center; padding: 6px 20px 8px; }
.profile .av { --s: 84px; margin: 0 auto 12px; }
.profile h2 { margin: 0; font-size: 21px; font-weight: 600; }
.profile p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.tabs { display: flex; justify-content: center; gap: 4px; margin: 14px 0 10px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 16px; color: var(--muted); font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--bubble); color: var(--text); }
.pane { padding: 6px 20px 28px; }
.card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: var(--raise); margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.on::before { background: #22c55e; }
.lib-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit; }
.lib-item:hover { background: var(--bubble); }
.lib-item .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--bubble); display: grid; place-items: center; flex: none; }
.lib-item .ico svg { width: 17px; height: 17px; }
.lib-item small { display: block; color: var(--muted); font-size: 12.5px; }
.lib-item .meta { min-width: 0; } .lib-item b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn { height: 40px; border-radius: 20px; border: 1px solid var(--line); background: var(--raise); padding: 0 16px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.code { position: relative; background: var(--bubble); border-radius: 12px; padding: 10px 12px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; margin: 6px 0 10px; }
.code button { position: absolute; top: 6px; right: 6px; }
.hint { color: var(--muted); font-size: 13px; }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; }
.modal h2 { margin: 0 0 4px; font-size: 20px; }
.modal > p { margin: 0 0 16px; color: var(--muted); }
.seg { display: flex; gap: 4px; background: var(--bubble); padding: 4px; border-radius: 16px; margin-bottom: 16px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 12px; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--raise); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 5px; }
.field small { color: var(--muted); display: block; margin-top: 4px; font-size: 12.5px; }
.field textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.err { color: var(--danger); font-size: 14px; margin: 6px 0; min-height: 1em; }
.grants { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.grants td { padding: 6px 4px; border-top: 1px solid var(--line); }
.grants select { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { width: 38px; height: 38px; border-radius: 10px; background: #111; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.conn-logo.k { background: #232426; }
.conn-head .meta { flex: 1; min-width: 0; }

/* sign in */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.signin .modal { text-align: center; }
.signin .av { margin: 0 auto 14px; --s: 64px; }
.signin form { display: flex; gap: 8px; margin-top: 16px; }
.signin input { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--line); border-radius: 20px; padding: 0 16px; height: 44px; outline: none; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 20px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; font-size: 14px; }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* phone and tablet */
@media (max-width: 1180px) {
  .shell.panel-open { grid-template-columns: 300px minmax(0, 1fr) 0; }
  .panel-open .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); z-index: 10; box-shadow: var(--shadow); }
}
@media (max-width: 820px) {
  .shell, .shell.panel-open { grid-template-columns: 100%; }
  .shell .chat { display: none; }
  .shell.in-chat .side { display: none; }
  .shell.in-chat .chat { display: flex; }
  .back { display: grid; }
  .msgs { padding: 70px 12px 10px; }
  .m { max-width: 92%; }
  .composer, .typing { padding-left: 10px; padding-right: 10px; }
  .chat-head .left { left: 10px; } .chat-head .right { right: 10px; }
  .chat-head .who { max-width: calc(100% - 120px); }
  .chat-head .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* work: Klaviyo newsletters and flows */
.work { display: none; min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.work-mode .work, .item-open .work { display: block; }
.work-mode .chat { display: none; }
.shell.work-mode, .shell.work-mode.panel-open { grid-template-columns: 320px minmax(0, 1fr); }
.shell.item-open, .shell.item-open.panel-open { grid-template-columns: 320px minmax(0, 1fr) minmax(360px, 440px); }
.item-open .chat { border-left: 1px solid var(--line); background: var(--panel); }
.item-open .panel { display: none; }
.item-open .msgs, .item-open .composer, .item-open .typing { padding-left: 16px; padding-right: 16px; }
.item-open .m { max-width: 92%; }
.view-work { display: none; }
.work-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: color-mix(in oklab, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.work-head h1 { font-size: 19px; margin: 0; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-head .back { display: none; }
.work-body { padding: 18px 24px 40px; }
.work-ic { background: var(--bubble) !important; color: var(--text); border-radius: 12px !important; }
.work-ic svg { width: 52%; height: 52%; }
.work-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg.small { margin: 0; padding: 3px; border-radius: 13px; }
.seg.small button { padding: 5px 12px; font-size: 13.5px; border-radius: 10px; flex: none; }
.wq { flex: 1; min-width: 180px; max-width: 320px; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; outline: none; }
.wq:focus { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.nl { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); background: var(--raise); border-radius: 18px; overflow: hidden; }
.nl:hover { border-color: var(--faint); }
.thumb { position: relative; display: block; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; border-bottom: 1px solid var(--line); }
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; color: #555; font-weight: 600; text-align: center; font-size: 14px; }
.cmt { position: absolute; z-index: 2; top: 8px; right: 8px; background: var(--unread); color: #fff; font-size: 12px; font-weight: 600; border-radius: 10px; padding: 1px 8px; }
.cmt::before { content: "💬 "; }
.nl-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.nl-body b { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.nl-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.nl-subj { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stats b { color: var(--text); font-weight: 600; }
.stats.muted { color: var(--faint); }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 8px; background: var(--bubble); color: var(--muted); text-transform: capitalize; }
.chip.s-sent, .chip.s-live { background: color-mix(in oklab, #22c55e 18%, transparent); color: #16a34a; }
.chip.s-scheduled, .chip.s-sending, .chip.s-manual { background: color-mix(in oklab, var(--unread) 18%, transparent); color: var(--unread); }
.flows { display: flex; flex-direction: column; gap: 8px; }
.fl { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); background: var(--raise); border-radius: 16px; }
.fl:hover { border-color: var(--faint); }
.fl .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fl .meta b { font-weight: 600; }
.fl-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--muted); }
.fl-stats .stats { justify-content: flex-end; }
.item-top { margin-bottom: 16px; }
.kv.subj { grid-template-columns: 70px 1fr; margin: 10px 0 6px; }
iframe.email { width: 100%; height: 1400px; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: block; }
.modal-email { height: 70dvh !important; margin-top: 12px; }
.modal:has(.modal-email) { width: min(760px, 100%); }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.step { margin-left: calc(var(--d) * 28px); position: relative; }
.branch { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--accent); margin: 2px 0 4px; }
.step-other { display: inline-block; font-size: 13.5px; color: var(--muted); padding: 4px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.step-mail { display: flex; gap: 12px; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--line); background: var(--raise); border-radius: 16px; }
.step-mail:hover { border-color: var(--faint); }
.step-mail .mini { width: 84px; height: 64px; border-radius: 10px; background: #fff; overflow: hidden; flex: none; border: 1px solid var(--line); }
.step-mail .mini img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.step-mail .meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* proposals: an agent's suggested change, decided by a person */
.proposal { border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--line)); background: var(--raise); border-radius: 18px; padding: 12px 14px; min-width: 260px; }
.proposal.rejected { opacity: .65; border-color: var(--line); }
.p-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.p-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 8px; }
.p-row { display: grid; grid-template-columns: 74px 1fr; gap: 8px; font-size: 14px; padding: 6px 0; border-top: 1px solid var(--line); }
.p-row > span { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.p-row p { margin: 0 0 4px; }
.p-row.new div { font-weight: 500; }
.p-why { color: var(--muted); font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 6px; }
.p-why p { margin: 0 0 4px; }
.p-done { font-size: 13px; color: var(--muted); margin-top: 8px; }
.proposal.approved .p-done { color: #16a34a; font-weight: 600; }

@media (max-width: 1180px) {
  .shell.item-open, .shell.item-open.panel-open { grid-template-columns: 300px minmax(0, 1fr) 360px; }
}
@media (max-width: 820px) {
  .shell.work-mode, .shell.item-open, .shell.item-open.panel-open, .shell.work-mode.panel-open { grid-template-columns: 100%; }
  .work-mode .work, .item-open .work { display: none; }
  .work-mode.in-chat .work { display: block; }
  .item-open.in-chat .chat { display: flex; }
  .item-open.show-work .work { display: block; }
  .item-open.show-work .chat { display: none; }
  .work-head { padding: 12px; } .work-head .back { display: grid; }
  .work-body { padding: 14px 12px 30px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .view-work { display: inline-flex; }
  .fl { flex-wrap: wrap; } .fl-stats { align-items: flex-start; width: 100%; }
  .step { margin-left: calc(var(--d) * 14px); }
}
a.btn { color: inherit; text-decoration: none; }

/* boards: Monday-style task table, one per person */
.grp { margin-bottom: 22px; }
.grp-h { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0 8px; font-weight: 600; font-size: 16px; color: var(--sc); }
.grp-h .hint { font-weight: 500; font-size: 13px; }
.t-exp { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; background: none; color: var(--muted); border-radius: 6px; transition: transform .15s; flex: none; }
.t-exp.on { transform: rotate(90deg); }
.t-exp:hover { background: var(--bubble); }
.tbl { border: 1px solid var(--line); border-left: 4px solid var(--sc); border-radius: 12px; overflow: hidden; background: var(--raise); }
.t-head, .t-row { display: grid; grid-template-columns: minmax(220px, 1fr) 130px 140px 140px 36px; align-items: stretch; }
.t-head { font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.t-head span { padding: 8px 12px; text-align: center; } .t-head span:first-child { text-align: left; }
.t-row { border-bottom: 1px solid var(--line); min-height: 42px; }
.t-row > * { border-right: 1px solid var(--line); }
.t-row.sel { background: var(--accent-soft); }
.t-row.sub { background: color-mix(in oklab, var(--bubble) 35%, var(--raise)); }
.t-row.sub .t-name { padding-left: 40px; }
.t-name { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; min-width: 0; }
.t-input { flex: 1; min-width: 0; border: 1px solid transparent; background: none; padding: 5px 6px; border-radius: 8px; outline: none; }
.t-input:hover { border-color: var(--line); } .t-input:focus { border-color: var(--accent); background: var(--bg); }
.t-subcount { font-size: 11.5px; color: var(--muted); background: var(--bubble); border-radius: 8px; padding: 1px 6px; flex: none; }
.t-notes { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; color: var(--faint); padding: 4px 6px; border-radius: 8px; flex: none; }
.t-notes:hover { color: var(--text); background: var(--bubble); }
.t-notes.has { color: var(--unread); } .t-notes b { font-size: 12px; }
.t-own { border: 0; background: none; display: grid; place-items: center; padding: 0 6px; }
.t-own:hover { background: var(--bubble); }
.owners { display: flex; } .owners .av { margin-left: -6px; border: 2px solid var(--raise); font-size: 10px; } .owners .av:first-child { margin-left: 0; }
.owners .more { font-size: 11.5px; color: var(--muted); margin-left: 4px; align-self: center; }
.empty-owner { color: var(--faint); }
.t-status { border: 0; color: #fff; font-weight: 600; font-size: 13px; padding: 0 8px; }
.t-status:hover { filter: brightness(1.08); }
.t-due { border: 0; background: none; text-align: center; padding: 0 8px; color: var(--muted); font-size: 13px; min-width: 0; }
.t-del { border: 0 !important; background: none; color: var(--faint); opacity: 0; display: grid; place-items: center; font-size: 12px; }
.t-row:hover .t-del, .t-del:focus-visible { opacity: 1; } .t-del:hover { color: var(--danger); }
.subs { border-bottom: 1px solid var(--line); }
.t-add { border-bottom: 1px solid var(--line); }
.t-add:last-child { border-bottom: 0; }
.t-add input { width: 100%; border: 0; background: none; padding: 11px 14px; outline: none; color: var(--text); }
.t-add input::placeholder { color: var(--faint); }
.t-add.sub input { padding-left: 48px; }
.t-add input:focus { background: var(--bg); }
.pop { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 190px; max-height: 60dvh; overflow-y: auto; }
.pop-status { border: 0; color: #fff; font-weight: 600; padding: 8px 12px; border-radius: 8px; }
.pop-own { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.pop-own:hover { background: var(--bubble); }
@media (max-width: 820px) {
  .tbl { overflow-x: auto; }
  .t-head, .t-row { grid-template-columns: minmax(180px, 1fr) 84px 116px 0 0; }
  .t-due, .t-del, .t-head span:nth-child(4) { display: none; }
}
.av.pic { background: var(--bubble); overflow: hidden; }
.av.pic img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.av.pic .on { z-index: 1; }
.pop-own > span:not(.av) { flex: 1; }
.pop-own .av { flex: none; }
.me-pic { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.pic-btn { cursor: pointer; }
.t-due.late { color: var(--danger); font-weight: 600; }
.t-due:hover { background: var(--bubble); }
.cal-pop { width: 264px; max-width: calc(100vw - 20px); padding: 10px; }
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-h button, .cal button, .cal-f button { border: 0; background: none; border-radius: 8px; }
.cal-h button { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }
.cal-h button:hover, .cal button:hover, .cal-f button:hover { background: var(--bubble); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow { font-size: 11.5px; color: var(--faint); padding: 4px 0; }
.cal button { height: 32px; font-size: 13.5px; }
.cal button.out { color: var(--faint); }
.cal button.today { color: var(--accent); font-weight: 700; }
.cal button.sel { background: var(--accent); color: var(--accent-ink); }
.cal-f { display: flex; justify-content: space-between; margin-top: 6px; }
.cal-f button { color: var(--accent); padding: 6px 10px; font-size: 13.5px; }
.pop-edit { border: 0; background: none; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--line); margin-top: 2px; text-align: left; font-size: 13.5px; }
.pop-edit:hover { color: var(--text); }
.color-in { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); cursor: pointer; }
.color-in.sm { width: 26px; height: 22px; border-radius: 6px; margin-left: 4px; }
.sl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sl-name { flex: 1; min-width: 0; border: 0; border-radius: 10px; padding: 8px 12px; color: #fff; font-weight: 600; outline: none; }
.sl-name:focus { box-shadow: 0 0 0 2px var(--text); }
.sl-done { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sl-row button { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.sl-row button:hover:not(:disabled) { background: var(--bubble); color: var(--text); }
.sl-row button:disabled { opacity: .3; }
/* the board sizes to its own column (narrower when a task's notes are open), never past it */
.work { container-type: inline-size; overflow-x: hidden; }
.tbl { overflow-x: auto; }
@container (max-width: 820px) {
  .t-head, .t-row { grid-template-columns: minmax(170px, 1fr) 92px 118px 82px 30px; }
  .t-status { font-size: 12.5px; }
}
@container (max-width: 560px) {
  .t-head, .t-row { grid-template-columns: minmax(150px, 1fr) 70px 104px 0 0; }
  .t-due, .t-del, .t-head span:nth-child(4) { display: none; }
}
.grid { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.field input.color-in { width: 56px; height: 38px; padding: 3px; }
.modal.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }
.pic-hint { font-size: 12.5px; align-self: center; }
/* discussion column closed on an item: the work takes the full width */
.shell.item-open.discuss-closed { grid-template-columns: 320px minmax(0, 1fr); }
.item-open.discuss-closed .chat { display: none; }
.dtog { margin-left: auto; }
.dslot { display: contents; }
@media (max-width: 1180px) { .shell.item-open.discuss-closed { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 820px) {
  .dtog, .desk-only { display: none !important; }
  .shell.item-open.discuss-closed { grid-template-columns: 100%; }
  .item-open.discuss-closed.in-chat .chat { display: flex; }
}
.item-open:not(.discuss-closed) .dtog { display: none; }
.shell { overflow: hidden; }
.board-ic { background: var(--bc) !important; color: #fff !important; }
.work-head .board-ic { flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.sw.on { border-color: var(--text); }
.pop-item { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 12px; border-radius: 9px; text-align: left; }
.pop-item:hover { background: var(--bubble); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-own { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 16px; border: 1px solid var(--line); background: var(--raise); font-size: 13.5px; }
.chip-own.on { border-color: var(--accent); background: var(--accent-soft); }
#toast.clickable { pointer-events: auto; }
.toast-btn { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; margin-left: 8px; }
.bubble blockquote { margin: 6px 0 2px; padding: 4px 0 4px 12px; border-left: 3px solid currentColor; opacity: .85; }
.grp-h { display: flex; align-items: center; gap: 4px; padding: 4px 0 8px; }
.grp-name { border: 1px solid transparent; background: none; color: var(--sc); font-weight: 600; font-size: 16px; padding: 2px 8px; border-radius: 8px; }
.grp-name:hover { border-color: var(--line); background: var(--raise); }
.gpop { width: 300px; max-width: calc(100vw - 20px); padding: 12px; gap: 10px; }
.gedit #gn { width: 100%; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--raise); outline: none; font-weight: 600; margin-bottom: 10px; }
.gedit .sw { width: 24px; height: 24px; }
.gedit .btns { align-items: center; }
.add-grp { margin: 2px 0 30px; }
