/* Chat. DataLink's own tokens only (tokens.css): white panels, hairlines, navy ink, royal blue for the one thing to press. Light only. No emoji, line icons. */
.chat { display: grid; grid-template-columns: 290px minmax(0, 1fr); background: var(--panel); border-top: 1px solid var(--line); overflow: hidden; min-height: 420px; }
.chat.has-thread { grid-template-columns: 290px minmax(0, 1fr) 360px; }
.chat button, .chat input, .chat textarea, .chat select { font: inherit; color: inherit; }
.chat :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

/* side */
.c-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #FBFBFC; }
.c-side-h { padding: 18px 18px 8px; }
.c-side-h .lead { margin: 0 0 2px; font-size: 13px; }
.c-side-h h2 { font: 300 22px var(--font-display); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 12px; }
.c-find { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 12px; background: #fff; height: 38px; }
.c-find input { border: 0; outline: 0; flex: 1; min-width: 0; font-size: 14px; background: none; }
.c-find svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.c-list { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.c-sec { display: flex; align-items: center; justify-content: space-between; padding: 14px 10px 4px; font: 500 11px var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.c-sec button { border: 0; background: none; color: var(--blue); font-size: 12px; letter-spacing: 0; text-transform: none; cursor: pointer; padding: 4px 6px; min-height: 28px; }
.ci { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 6px 10px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.ci:hover { background: rgba(14, 17, 22, .04); }
.ci.on { background: var(--blue-soft); color: var(--blue); font-weight: 550; }
.ci .g { width: 18px; text-align: center; color: var(--faint); font-size: 12px; flex: none; }
.ci .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci .u { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.ci.unread .n { color: var(--ink); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot.on { background: var(--ok); }
.c-side-f { padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* main */
.c-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.c-head { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-height: 64px; }
.c-head .t { flex: 1; min-width: 0; }
.c-head h3 { font: 300 20px var(--font-display); letter-spacing: .08em; text-transform: uppercase; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-head .s { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-back { display: none; border: 0; background: none; width: 40px; height: 40px; cursor: pointer; color: var(--blue); flex: none; }
.c-msgs { flex: 1; overflow-y: auto; padding: 8px 20px 12px; min-height: 0; }
.cday { text-align: center; margin: 16px 0 6px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cm { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 6px 4px; border-radius: 12px; position: relative; }
.cm:hover { background: #F8F9FB; }
.cm.cont { padding-top: 0; padding-bottom: 0; }
.cm.cont .av { visibility: hidden; height: 0; }
.cm.hit { background: var(--blue-soft); }
.av { width: 38px; height: 38px; border-radius: 50%; background: var(--sky-soft); color: var(--navy); display: flex; align-items: center; justify-content: center; font: 500 14px var(--font-ui); flex: none; }
.av.sys { background: var(--navy); color: #fff; }
.cm .by { font-size: 14px; font-weight: 600; color: var(--ink); margin-right: 8px; }
.cm .at { font-size: 11.5px; color: var(--faint); }
.cm .ed { font-size: 11.5px; color: var(--faint); margin-left: 6px; }
.cm .tx { font-size: 14.5px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; user-select: none; }
.cm .tx a:not(.chip) { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.cm .tx .at-u { color: var(--blue); font-weight: 550; }
.cm.sysm .tx { color: var(--ink-2); }
.cm.gone .tx { color: var(--faint); font-style: italic; }
.cm .acts { display: none; gap: 2px; margin-top: 2px; }
.cm:hover .acts, .cm:focus-within .acts { display: flex; }
.cm .acts button, .rep-link { border: 0; background: none; color: var(--blue); font-size: 12.5px; cursor: pointer; padding: 6px 8px; min-height: 30px; border-radius: 8px; }
.cm .acts button:hover, .rep-link:hover { background: var(--blue-soft); }
.rep-link { display: inline-block; margin-top: 2px; }
.cfile { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; color: var(--navy); font-size: 13.5px; text-decoration: none; }
.cfile:hover { border-color: var(--navy); }
.cimg { display: block; max-width: min(360px, 100%); max-height: 260px; border-radius: 12px; margin-top: 4px; border: 1px solid var(--line); }
.ccall { display: flex; align-items: center; gap: 12px; margin-top: 4px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 14px; background: #fff; }
.ccall .x { flex: 1; font-size: 14px; }

/* command answers: shown to the asker only */
.ccard { margin: 8px 20px 0; padding: 14px 16px; border: 1px solid var(--line-2); border-left: 3px solid var(--blue); border-radius: 12px; background: #fff; font-size: 14px; position: relative; }
.ccard.bad { border-left-color: var(--watch); background: var(--watch-bg); }
.ccard h4 { font: 500 12px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.ccard p { margin: 2px 0; }
.ccard .links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ccard .only { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.ccard .xx { position: absolute; right: 8px; top: 6px; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; width: 32px; height: 32px; }

/* composer */
.c-comp { padding: 10px 20px 10px; border-top: 1px solid var(--line); }
.c-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line-2); border-radius: 18px; padding: 6px 8px 6px 14px; background: #fff; }
.c-box:focus-within { border-color: var(--blue); }
.c-box textarea { flex: 1; border: 0; outline: 0; resize: none; max-height: 140px; min-height: 36px; line-height: 1.45; font-size: 14.5px; padding: 8px 0; background: none; }
.c-box .ib { border: 0; background: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--navy); display: flex; align-items: center; justify-content: center; flex: none; }
.c-box .ib:hover { background: var(--sky-soft); }
.c-box .send { background: var(--blue); color: #fff; }
.c-box .send:hover { background: #150FDB; }
.c-box svg, .c-head svg { width: 20px; height: 20px; }
.c-note { font-size: 11.5px; color: var(--faint); margin: 6px 4px 0; }
.c-cmds { position: absolute; left: 20px; right: 20px; bottom: 96px; background: #fff; border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 5; max-height: 260px; overflow: auto; }
.c-cmds button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; min-height: 44px; }
.c-cmds button:hover { background: var(--blue-soft); }
.c-cmds b { font-weight: 600; color: var(--navy); }
.c-cmds span { display: block; font-size: 12px; color: var(--muted); }

/* thread panel */
.c-thread { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #FBFBFC; }
.c-thread[hidden] { display: none; }

/* states */
.c-empty { margin: auto; max-width: 420px; text-align: center; padding: 40px 20px; color: var(--muted); }
.c-empty h3 { font: 300 24px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); margin: 0 0 8px; }
.c-lock { margin: auto; max-width: 380px; text-align: center; padding: 30px 20px; }
.c-lock input { width: 100%; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; margin: 10px 0; font-size: 15px; }
.cres { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.cres:hover { background: #F8F9FB; }
.cres .m { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cres mark { background: #FFF2B8; color: inherit; border-radius: 3px; }
.c-admin { padding: 16px 20px; overflow: auto; flex: 1; }
.c-admin table { width: 100%; border-collapse: collapse; font-size: 13px; }
.c-admin th { text-align: left; font: 500 11px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line-2); }
.c-admin td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.c-admin .filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.c-admin .filters input, .c-admin .filters select { height: 36px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; background: #fff; }
.c-admin .earlier { color: var(--muted); font-size: 12px; }
.c-admin .del { color: var(--bad); }

/* the small thread dock on a home page (tail, broker, owner, ...) */
.cdock { margin: 22px 0; }
.cdock .cd-msgs { max-height: 340px; overflow: auto; margin: 0 -4px; }
.cdock .c-box { margin-top: 10px; }
.cdock .cd-empty { color: var(--muted); font: 300 16px var(--font-display); padding: 8px 2px; }

.cbadge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 600; text-align: center; vertical-align: 1px; }

/* phone: one pane at a time, big targets */
@media (max-width: 860px) {
  .chat, .chat.has-thread { grid-template-columns: 1fr; }
  .chat .c-side { display: flex; }
  .chat .c-main, .chat .c-thread { display: none; }
  .chat.show-main .c-side { display: none; }
  .chat.show-main .c-main { display: flex; }
  .chat.show-main.has-thread .c-main { display: none; }
  .chat.show-main.has-thread .c-thread { display: flex; border-left: 0; }
  .c-back { display: flex; align-items: center; justify-content: center; }
  .c-head { padding: 8px 10px; }
  .c-msgs { padding: 4px 10px 10px; }
  .c-comp { padding: 8px 10px 8px; }
  .cm .acts { display: flex; }
  .cm .acts button, .rep-link { min-height: 40px; padding: 8px 12px; }
  .ci { min-height: 48px; }
  .c-box .ib { width: 44px; height: 44px; }
  .c-cmds { left: 10px; right: 10px; }
  .ccard { margin: 8px 10px 0; }
}
@media (hover: none) { .cm .acts { display: flex; } }

/* the paperclip helper sits above the composer instead of on top of the send button while the Chat tab is open */
body:has(#chat) #clippy { bottom: 132px; }
body:has(#chat) #cl-tab { bottom: 140px; }
.cfile .muted { white-space: nowrap; }

.av { position: relative; overflow: hidden; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cm .av.sys img { display: none; }
