/* The inbox's tools (docs/inbox.md): photos, the business numbers, Online and a visitor's journey, search and
   Compose, the contact panel, phone swipes. Pine, square corners, hairline rules (app.css tokens). */
:root { --needs: #c2610c; --online: #2f9e44; }

/* photos: theirs or their initials, the channel on the corner */
.av { position: relative; flex: none; width: 40px; height: 40px; }
.av > img, .av > span { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; background: var(--p200); color: var(--p900); font: 600 15px/1 var(--f-head); letter-spacing: .02em; }
.av > span .i { width: 20px; height: 20px; color: var(--p700); }
.av-ch { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--rule); color: var(--n700); }
.av-ch .i { width: 11px; height: 11px; }
.av-head { width: 38px; height: 38px; }
.av-big { width: 72px; height: 72px; }
.av-big > span { font-size: 26px; }

/* the list's rows with their photo */
.ib-list { position: relative; }
.ib-row .av { grid-row: 1 / span 3; align-self: start; }
.ib-row.on .av > span { background: var(--card); }
.ib-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--online); align-self: center; justify-self: end; }
.ib-dot.is-chat { width: auto; height: auto; border-radius: 0; background: var(--p200); color: var(--p900); font: 500 11px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; }
.ib-dot.is-chat::after { content: "Chatting"; }
.ib-visit .ib-line .mono { font-size: 12px; color: var(--n700); margin-left: 4px; }

/* the business numbers: needs you, unread, online */
.ib-biz a b.n-needs, .n-needs { color: var(--needs); }
.ib-biz a b.n-online, .n-online { color: var(--online); }
.ib-biz a[aria-current] b.n-needs { color: #f3b37a; }
.ib-biz a[aria-current] b.n-online { color: #8fdc9f; }

/* search and New message */
.ib-find { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--rule); }
.ib-find form { flex: 1; min-width: 0; position: relative; margin: 0; }
.ib-find form .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--n700); pointer-events: none; }
.ib-find input[type=search] { width: 100%; height: 38px; padding: 0 10px 0 36px; font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid transparent; border-radius: 0; -webkit-appearance: none; appearance: none; }
.ib-find input[type=search]:focus { border-color: var(--p600); background: #fff; outline: none; }
.ib-new { flex: none; width: 38px; height: 38px; display: grid; place-items: center; background: var(--p700); border: 0; color: #fff; cursor: pointer; }
.ib-new:hover { background: var(--p800); }

/* notes in a thread: New thread on ... */
.msg-note { color: var(--p800); }
.msg-note .i { color: var(--p700); }

/* New thread beside Send, and under a conversation that can't be answered */
.ib-thread-new { padding: 11px 12px; }
.ib-noreply { display: flex; align-items: center; gap: 12px; }
.ib-noreply .ib-thread-new { margin-left: auto; }

/* a visitor's journey */
.ib-journey { gap: 0; padding-top: 8px; }
.vj-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.vj-page { display: flex; flex-direction: column; min-width: 0; }
.vj-page b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vj-page .mono { font-size: 12px; color: var(--n700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vj-row .sub { white-space: nowrap; }
.vj-gap { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; font-size: 12px; color: var(--n700); text-transform: uppercase; letter-spacing: .06em; }
.vj-gap::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.vj-credit { margin: 0; padding: 8px 20px; font-size: 11px; background: var(--card); border-top: 1px solid var(--rule); }
.vj-credit a { color: var(--n700); }

/* the contact panel: a third column on a wide screen, over the thread when narrower */
.ibc { display: none; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; overflow-y: auto; padding: 20px; background: var(--card); border-left: 1px solid var(--rule); scrollbar-width: none; }
.ibc::-webkit-scrollbar { display: none; }
.ibc-x { display: none; align-self: flex-end; background: none; border: 0; padding: 4px; color: var(--ink); cursor: pointer; }
.ibc-who { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ibc-who h2 { margin: 0; overflow-wrap: anywhere; }
.ibc-ways { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ibc-ways li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; }
.ibc-ways li .i { color: var(--n700); }
.ibc-ways a, .ibc-ways span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); text-decoration: none; }
.ibc-ways a:hover { color: var(--p700); text-decoration: underline; }
.ibc-edit-btn { align-self: flex-start; padding: 8px 14px; font-size: 15px; }
.ibc h3 { font: 600 15px var(--f-head); text-transform: uppercase; letter-spacing: .06em; color: var(--n700); margin: 8px 0 0; display: flex; align-items: baseline; gap: 8px; }
.ibc h3 .sub { text-transform: none; letter-spacing: 0; font: 400 13px var(--f-body); }
.ibc-list { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.ibc-list > a, .ibc-list > span { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: 14px; min-width: 0; }
.ibc-list > a:hover { color: var(--p700); }
.ibc-list .i { color: var(--n700); }
.ibc-list > * > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibc-list time { flex: none; color: var(--n700); font-size: 13px; }
@media (min-width: 1201px) {
  .ib.has-card { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) 300px; }
  .ib.has-card .ibc { display: flex; }
  .ib.has-card .ib-card-btn { display: none; }
}
@media (max-width: 1200px) {
  .ib.card-open .ibc { display: flex; position: fixed; z-index: 20; top: 56px; right: 0; bottom: 0; width: min(360px, 100%); box-shadow: -12px 0 32px rgba(18,61,47,.16); }
  .ib.card-open .ibc-x { display: inline-flex; }
}

/* dialogs: Edit, Same person?, Compose (closed only by their buttons, inbox-tools.js) */
dialog.ib-dlg { border: 1px solid var(--rule); padding: 22px; max-width: 460px; width: calc(100% - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; color: var(--ink); }
dialog.ib-dlg::backdrop { background: rgba(18,61,47,.35); }
dialog.ib-dlg form { margin: 0; }
dialog.ib-dlg h2 { margin: 0 0 16px; }
dialog.ib-dlg .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
dialog.ib-dlg .foot .ibc-del { margin-right: auto; color: var(--err); }
dialog.ib-dlg select, .ibc-pair input { width: 100%; height: 44px; padding: 0 10px; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--n300); border-radius: 0; }
.ibc-pair { display: flex; gap: 8px; }
.ibc-pair > :first-child { flex: 1; min-width: 0; }
.ibc-pair .btn-secondary { padding: 9px 14px; font-size: 15px; }
.ibc-addr { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.ibc-addr span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ibc-addr .btn-secondary { padding: 6px 10px; font-size: 14px; }
.ibc-find, .ib-to { position: relative; }

/* the matches as you type, under To and Merge into */
.ib-found { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rule); box-shadow: 0 8px 24px rgba(18,61,47,.12); max-height: 260px; overflow-y: auto; }
.ib-found[hidden] { display: none; }
.ib-found button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; background: none; border: 0; border-bottom: 1px solid var(--rule); text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.ib-found button:hover, .ib-found button:focus-visible { background: var(--p100); }
.ib-found b { font-weight: 500; }

/* Compose: laid out like an email, From, To and Subject as lines, then the message */
dialog.ib-mail { max-width: 620px; }
.ib-field { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--rule); min-height: 46px; }
.ib-field > label { flex: none; width: 64px; font-size: 14px; color: var(--n700); }
dialog .ib-field > input, dialog .ib-field > select { flex: 1; min-width: 0; height: 44px; border: 0 !important; padding: 0; background: transparent; }
.ib-field > input:focus, .ib-field > select:focus { outline: none; }
.ib-field[hidden] { display: none; }
dialog.ib-mail textarea { margin-top: 14px; min-height: 180px; }

/* a row swiped on a phone: Junk shows on the left, Archive on the right */
.ib-swipe { position: absolute; left: 0; right: 0; display: flex; justify-content: space-between; z-index: 0; }
.ib-swipe button { width: 88px; border: 0; color: #fff; font: 600 15px var(--f-head); visibility: hidden; }
.ib-swipe .sw-junk { background: var(--err); }
.ib-swipe .sw-archive { background: var(--p700); margin-left: auto; }
.ib-swipe.to-junk { background: var(--err); }
.ib-swipe.to-archive { background: var(--p700); }
.ib-swipe.to-junk .sw-junk, .ib-swipe.to-archive .sw-archive { visibility: visible; }
.ib-list .ib-row { position: relative; z-index: 1; background: var(--card); }
.ib-list .ib-row:hover { background: var(--p100); }
.ib-list .ib-row.on { background: var(--p200); }

@media (max-width: 760px) {
  .ib-find { padding: 8px 16px; }
  .ib-head .av-head { width: 34px; height: 34px; }
  .ib-head .av-head > span { font-size: 13px; }
  .ib-thread-new { padding: 10px; }
  .ib.card-open .ibc { top: 0; width: 100%; }
  dialog.ib-mail { max-width: none; width: 100%; height: 100dvh; max-height: none; margin: 0; border: 0; }
  dialog.ib-mail textarea { min-height: 40vh; }
}

/* Inbox / Online / Latest (Switchboard's seg): counts beside each; Latest is a phone's (a wider screen has the overview
   on the right always, so Inbox stays picked) */
.ib-views { display: flex; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--rule); }
.ib-views a { display: inline-flex; align-items: center; gap: 5px; padding: 12px 0 10px; color: var(--n700); text-decoration: none; font: 600 17px var(--f-head); border-bottom: 2px solid transparent; white-space: nowrap; }
.ib-views a[aria-current] { color: var(--ink); border-bottom-color: var(--p700); }
.ib-views b { font: 600 14px var(--f-head); color: var(--p700); }
.ib-views b.n-online { color: var(--online); }
@media (min-width: 761px) {
  .ib-views .ib-v-latest { display: none; }
  .ib.v-latest .ib-views .ib-v-inbox { color: var(--ink); border-bottom-color: var(--p700); }
}
/* the filters under the search, More at their right */
.ib-tabs { border-top: 0; }
.ib-tabs a { font-size: 15px; padding: 9px 0 8px; }
.ib-more { margin-left: auto; }
.ib-more summary { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; padding: 9px 0 8px; }
.ib-more > div { left: auto; right: -8px; }

/* a row: name, Needs you's dot, the business's mark, then when; For approval before the line */
.ib-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ib-top .ib-who { min-width: 0; }
.ib-needs { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--needs); }
.ib-mark { flex: none; width: 16px; height: 16px; display: grid; place-items: center; background: var(--p100); color: var(--p800); font: 600 11px/1 var(--f-head); }
.ib-line em { font-style: normal; font-weight: 500; color: var(--needs); }
.ib-list .ib-row.leaving { transition: height .18s ease, padding .18s ease; padding-top: 0; padding-bottom: 0; overflow: hidden; border-bottom-width: 0; }
@media (prefers-reduced-motion: reduce) { .ib-list .ib-row.leaving { transition: none; } }

/* the overview (Switchboard's .over): the range, the numbers, who's waiting, Replies, Latest */
.ib-over { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; scrollbar-width: none; }
.ib-over::-webkit-scrollbar { display: none; }
.ib-over h3 { margin: 26px 0 8px; font: 600 15px/1 var(--f-head); text-transform: uppercase; letter-spacing: .06em; color: var(--n700); }
.ib-over .ib-none { padding: 40px 0; }
.ov-h { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ov-range { display: inline-flex; border: 1px solid var(--rule); background: var(--card); }
.ov-range a { padding: 6px 12px; color: var(--n700); text-decoration: none; font: 500 14px var(--f-body); white-space: nowrap; }
.ov-range a + a { border-left: 1px solid var(--rule); }
.ov-range a[aria-current] { background: var(--p900); color: #fff; }
.ov-site { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--p700); text-decoration: none; white-space: nowrap; }
.ov-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--rule); }
.ov-strip > * { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 16px; font: 400 12.5px var(--f-body); color: var(--n700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; text-align: left; background: none; border: 0; border-radius: 0; }
.ov-strip > * + * { border-left: 1px solid var(--rule); }
.ov-strip b { font: 600 30px/1 var(--f-head); color: var(--ink); font-variant-numeric: tabular-nums; }
.ov-strip .hot b { color: var(--needs); }
.ov-strip > a:hover, .ov-strip > button:not(:disabled):hover { background: var(--p100); }
.ov-strip > button { cursor: pointer; }
.ov-strip > button:disabled { cursor: default; }
@media (max-width: 560px) {
  .ov-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ov-strip > :nth-child(4) { border-left: 0; }
  .ov-strip > :nth-child(n+4) { border-top: 1px solid var(--rule); }
}
.ov-feed { background: var(--card); border: 1px solid var(--rule); }
.ov-feed[hidden] { display: none; }
.ov-wait { margin-top: 10px; }
.ov-row { display: grid; grid-template-columns: 14px minmax(0, 150px) minmax(0, 1fr) minmax(0, 130px) 44px; align-items: center; gap: 12px; min-height: 38px; padding: 0 14px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; font-size: 14px; }
.ov-row:last-child { border-bottom: 0; }
.ov-row:hover { background: var(--p100); }
.ov-row > .i { width: 14px; height: 14px; color: var(--n700); }
.ov-row.is-in > .i { color: var(--p700); }
.ov-row b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--n700); }
.ov-tag { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--p800); }
.ov-row time { font-size: 12.5px; color: var(--n700); text-align: right; white-space: nowrap; }
.ov-row:not(:has(.ov-tag)) { grid-template-columns: 14px minmax(0, 150px) minmax(0, 1fr) 44px; }
.ov-wait .ov-row { grid-template-columns: 14px minmax(0, 150px) minmax(0, 1fr) minmax(0, 130px); }
.ov-wait .ov-row:not(:has(.ov-tag)) { grid-template-columns: 14px minmax(0, 150px) minmax(0, 1fr); }
@media (max-width: 899px) {
  .ov-row, .ov-row:not(:has(.ov-tag)) { grid-template-columns: 14px minmax(0, 120px) minmax(0, 1fr) 44px; }
  .ov-wait .ov-row, .ov-wait .ov-row:not(:has(.ov-tag)) { grid-template-columns: 14px minmax(0, 120px) minmax(0, 1fr); }
  .ov-tag { display: none; }
}

/* the Replies card: the Bot name, then Off / Ask first / Auto per channel with the bot's name there */
.ov-modes { background: var(--card); border: 1px solid var(--rule); }
.ov-modes form { margin: 0; }
.ov-mode { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 6px 8px 6px 14px; min-height: 44px; }
.ov-modes form + form .ov-mode:first-child, .ov-mode + .ov-mode { border-top: 1px solid var(--rule); }
.ov-nm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-nm .i { color: var(--n700); }
.ov-box { padding-left: 38px; }
.ov-box .ov-nm { font-weight: 400; color: var(--n700); }
.ov-seg { display: inline-flex; flex: none; border: 1px solid var(--rule); }
.ov-seg label { padding: 5px 10px; font-size: 13.5px; color: var(--n700); cursor: pointer; white-space: nowrap; }
.ov-seg label + label { border-left: 1px solid var(--rule); }
.ov-seg label.on { background: var(--p900); color: #fff; }
.ov-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ov-mode input[name^="names"], .ov-mode input[name=persona] { flex: none; width: 150px; max-width: 34%; height: 32px; padding: 0 10px; border: 1px solid var(--n300); border-radius: 0; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
.ov-mode input[name=persona] { max-width: 50%; }
.is-saving { opacity: .55; transition: opacity .15s; }

/* on a phone: Latest puts the overview in the list's place, the views staying above it */
@media (max-width: 760px) {
  .ib.v-latest:not(.has-chat) { grid-template-rows: auto minmax(0, 1fr); }
  .ib.v-latest:not(.has-chat) .ib-side { min-height: 0; }
  .ib.v-latest:not(.has-chat) .ib-side > :not(.ib-biz):not(.ib-views):not(.ph-live) { display: none; }
  .ib.v-latest:not(.has-chat) .ib-thread { display: flex; }
  .ib.v-latest .ib-over { padding: 12px 16px; }
  .ib-views { gap: 16px; }
  .ov-h { flex-wrap: wrap; }
  .ov-mode input[name^="names"] { max-width: 100%; flex: 1 1 100%; }
}
