:root { --dark: #223653; --green: var(--accent); --soft: var(--portal-soft); }
body { min-width: 0; height: 100dvh; display: flex; flex-direction: column; }
h1, h2, p, dl, dd { margin: 0; }
#webhook-state { display: inline-flex; color: var(--portal-quiet); font-size: 12px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; }
.hub, .conversation-status { font-size: 12px; color: var(--portal-quiet); }
.hub { display: inline-flex; gap: 6px; align-items: center; }
.hub i, .conversation-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); display: inline-block; }
.hub[data-ready="true"] i, .conversation-status i { background: var(--success); }
body:has(#workspace[hidden]) .top :is(.hub,.mode,.workspace-label) { display:none; }
body:has(#workspace[hidden]) .compact-brand { display: block; }
.workspace { display: grid; flex: 1; min-height: 0; }
.merchant-rail { min-height: 0; min-width: 0; overflow: auto; background: var(--rail); border-right: 1px solid var(--line); }
.account-chooser { margin: 0 12px 8px; position: relative; flex: none; }
.account-chooser > summary { display: grid; grid-template-columns: 16px minmax(0,1fr) 14px; align-items: center; gap: 8px;
  cursor: pointer; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.account-chooser > summary svg { color: var(--portal-quiet); }
.account-chooser > summary svg:last-child { transform: rotate(90deg); }
.account-chooser[open] > summary svg:last-child { transform: rotate(-90deg); }
#threads-scope { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chooser-menu { margin-top: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
#accounts { max-height: min(240px, 26dvh); overflow: auto; padding: 2px; }
.side-head { display:flex; justify-content:space-between; align-items:center; padding: 2px 3px 5px; gap: 6px; }
.side-head p { color: var(--portal-quiet); font-size: 12px; }
.thread-head h1 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
.account { width:100%; display:grid; grid-template-columns:29px minmax(0,1fr) 7px; gap:9px; align-items:center;
  text-align:left; color:inherit; background:transparent; padding:8px; border:1px solid transparent; border-radius:6px; margin-bottom:4px; }
.account:hover, .thread:hover { background:var(--default); }
.account[aria-pressed=true] { background:var(--soft); border-color:#b2bcf6; }
.account .avatar { width: 29px; height: 29px; font-size: 12px; }
.account strong, .account small, .thread-name, .thread-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 13px; font-weight: 600; }
.account small { color: var(--portal-quiet); font-size: 11px; margin-top: 2px; }
.account .status-dot { width: 7px; height: 7px; background: #82958b; border-radius: 50%; }
.account .status-dot[data-online="true"] { background: var(--success); }
.side-footer { color: var(--portal-quiet); font-size: 12px; margin-top: auto; padding: 18px 10px 0; display: flex; gap: 7px; align-items: center; }
.side-dot { background: var(--success); }
.thread-panel { background: var(--list); border-right: 1px solid var(--line); min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.thread-head { padding: 15px 14px 11px; display: flex; justify-content: space-between; align-items: center; min-height: 65px; }
.help-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.help-field { display: grid; gap: 6px; }
.feature-help { display: inline-flex; flex: none; vertical-align: middle; }
.feature-help-trigger {
  display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; color: var(--portal-quiet);
  background: transparent; font-family: inherit; font-size: 13px; font-weight: 650; line-height: 1; cursor: help;
}
.feature-help-trigger:hover, .feature-help-trigger:focus-visible { color: var(--accent); border-color: currentColor; }
.feature-help-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.feature-help-popup {
  position: fixed; inset: auto; margin: 0; width: max-content;
  max-width: min(310px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  overflow: auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); box-shadow: 0 6px 22px #070d1770;
  font-size: 13px; font-weight: 400; line-height: 1.55; overflow-wrap: anywhere;
}
.feature-help-popup:not(:popover-open) { display: none; }
.conversation-head h2 { font-size: 17px; font-weight: 660; }
.thread-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 5px; }
#account-status-channels > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
#account-status-channels dd { margin: 3px 0 0; }
#account-status-channels small { display: block; color: var(--portal-quiet); }
#account-status-read-at { color: var(--portal-quiet); }
.backfill-history-list { list-style: none; margin: 0; padding: 0; }
.backfill-history-list li { display: grid; gap: 4px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.backfill-history-list li[aria-current="true"] { background: var(--soft); box-shadow: inset 3px 0 var(--green); padding-inline: 12px; }
.backfill-history-list .backfill-position-label { color: var(--green); font-weight: 650; }
.backfill-history-list small { color: var(--portal-quiet); }
.backfill-record-open { justify-self: start; margin-top: 4px; }
#backfill-history { width: min(560px, calc(100vw - 32px)); }
#backfill-history[open] { display: flex; flex-direction: column; overflow: hidden; }
#backfill-history-title { overflow-wrap: anywhere; }
.backfill-history-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; max-width: 70%; }
#backfill-history-scroll { min-height: 0; overflow: auto; scrollbar-gutter: stable; }
#backfill-history-locate {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 6px 8px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
#backfill-history-locate label { margin: 0; }
#backfill-locate-id { min-width: 0; }
.backfill-locate-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.backfill-locate-feedback { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.backfill-locate-feedback:not(:has(> :not([hidden]))) { display: none; }
#backfill-history-resume-note { padding: 6px 0; }
#backfill-history-undo-filters { align-self: flex-start; margin: 6px 0; }
#backfill-history-filter { padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.backfill-history-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.backfill-history-fields select { display: block; width: 100%; color: var(--ink); }
#backfill-history-filter-help { font-size: 12px; margin-top: 4px; }
#backfill-history-filter .dialog-actions { margin-top: 8px; }
.backfill-history-actions { flex-wrap: wrap; }
#backfill-history-positioned { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
#backfill-history-error:not([hidden]), #backfill-detail-error:not([hidden]), #backfill-locate-error:not([hidden]) { color: var(--danger); }
#backfill-detail-fields > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
#backfill-detail-fields dd { margin-top: 3px; overflow-wrap: anywhere; }
#backfill-filter-conflicts h3 { font-size: 14px; margin: 12px 0 4px; }
#backfill-filter-conflict-list { margin: 0; padding-left: 20px; }
#backfill-filter-conflict-list span { display: block; color: var(--portal-quiet); overflow-wrap: anywhere; }
@media (max-width: 440px) {
  .backfill-history-fields { grid-template-columns: 1fr; }
  #backfill-history-locate { grid-template-columns: minmax(0, 1fr); }
}
.thread-search { display: flex; align-items: center; gap: 6px; margin: 0 12px 10px; padding: 0 7px 0 10px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--field); color: var(--portal-quiet); flex: none; }
.thread-search:focus-within { border-color: var(--accent); }
#workspace #search-input { width: 100%; min-width: 0; height: 34px; box-shadow: none; border: 0; background: transparent; padding-inline: 0; }
#search-input:focus-visible { outline: none; }
#search-input::-webkit-search-cancel-button { display: none; }
#thread-search-clear { width: 26px; min-width: 26px; min-height: 26px; }
.threads { scrollbar-gutter: stable; }
.threads { min-height: 0; overflow-y: auto; padding: 0 6px; }
.thread { width: 100%; min-width: 0; padding: 9px 8px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; align-items: center; text-align: left; border: 0; background: transparent; color: var(--ink); border-radius: 6px; }
.thread + .thread { margin-top: 2px; }
.thread[aria-pressed=true] { background: var(--soft); color: var(--ink); }
.thread .avatar { width: 34px; height: 34px; }
.thread-name { font-weight: 620; font-size: 13px; }
.thread-account { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--portal-quiet); }
.thread-preview { color: var(--portal-quiet); font-size: 12px; margin-top: 4px; }
.thread-tail { color: var(--portal-quiet); font-size: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.badge { min-width: 17px; height: 17px; display: inline-grid; place-items: center; padding: 0 4px; border-radius: 20px; background: var(--green); color: var(--accent-foreground); line-height: 1; }
.empty-list, .panel-error { padding: 0 17px; color: var(--portal-quiet); font-size: 13px; }
.panel-error { color: var(--danger); margin-block: 8px; }
.conversation { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; min-width: 0; min-height: 0; }
.conversation-head { display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-bottom: 1px solid var(--line); min-height: 62px; background: var(--panel); }
.conversation-head p { color: var(--portal-quiet); font-size: 12px; }
.conversation-status { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--green); font-size: 12px; white-space: nowrap; }
.timeline { min-height: 0; overflow-y: auto; padding: 22px clamp(15px,4.5vw,70px) 35px; grid-row: 3; background: var(--wash); }
.timeline:has(> #messages-empty:not([hidden])) { display: grid; place-items: center; }
.timeline:has(> #messages-empty:not([hidden])) #messages:empty { display: none; }
.message-empty { color: var(--portal-quiet); }
.day { color: var(--portal-quiet); font-size: 11px; text-align: center; padding: 4px 0 10px; }
.message { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; margin: 12px 0 19px; }
.message .avatar { width: 30px; height: 30px; font-size: 12px; border-radius: 7px; }
.message[data-direction="outgoing"] { flex-direction: row-reverse; }
.message-body { min-width: 0; max-width: min(78%,510px); }
.message[data-direction="outgoing"] .message-body { text-align: right; }
.bubble { text-align: left; border-radius: 2px 11px 11px 11px; border: 1px solid var(--line); background: var(--panel); padding: 10px 13px; overflow-wrap: anywhere; white-space: pre-wrap; width: fit-content; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar img[hidden] { display: none; }
.message-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.message-link-card { display: grid; gap: 5px; width: min(100%, 25rem); text-decoration: none; white-space: normal; }
.message-link-card strong { line-height: 1.4; }
.message-link-card:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.message-link-card small { color: var(--portal-quiet); }
.message-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 3px; }
.message[data-direction="outgoing"] .bubble { border-radius: 11px 2px 11px 11px; border-color: var(--line); background: var(--portal-soft); margin-left: auto; }
.message[data-direction="unknown"] { justify-content: center; }
.message[data-direction="unknown"] .avatar { display: none; }
.message[data-direction="unknown"] .bubble { background: transparent; color: var(--portal-quiet); border: 0; }
.message time { color: var(--portal-quiet); font-size: 10px; display: block; margin-top: 3px; }
.message-meta { display: flex; align-items: baseline; gap: 6px; color: var(--portal-quiet); font-size: 11px; }
.message[data-direction="outgoing"] .message-meta { justify-content: flex-end; }
.message-send-status { background: transparent; border: 0; color: var(--portal-quiet); padding: 2px 0; font-size: 11px; cursor: pointer; }
.message-send-status:hover { text-decoration: underline; }
.conversation-footer { background: var(--panel); padding: 13px 20px; min-height: 48px; border-top: 1px solid var(--line); display: flex; gap: 7px; color: var(--portal-quiet); font-size: 12px; align-items: center; }
.conversation-footer button { margin-left: auto; white-space: nowrap; }
#failed-send-drafts { max-height: 144px; overflow-y: auto; padding: 0 20px 10px; background: var(--panel); }
.failed-send-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-block: 5px; font-size: 12px; }
.failed-send-draft span { overflow-wrap: anywhere; margin-right: auto; }
.foot-icon { background: #e7efe5; border: 1px solid #a7b9aa; width: 12px; height: 12px; border-radius: 50%; }
.button:not([data-slot]), dialog button:not([data-slot]), #demo-users button { border:0; background:var(--default); color:var(--ink); padding:7px 12px; border-radius:6px; font-size:13px; font-weight:550; }
.button.primary:not([data-slot]), dialog button[type=submit]:not([data-slot]) { background:var(--accent); color:var(--accent-foreground); }
.more { margin: 10px auto; display: block; }
.mobile-back { display: none; }
.webhooks { grid-column: 2 / -1; overflow-y: auto; padding: 26px clamp(16px,3vw,38px); }
.hook-card p { color: var(--portal-quiet); margin-top: 5px; }
.hook-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.metric-panel, .hook-card { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 20px; margin-bottom: 16px; }
.hook-card h2, .hook-summary h2 { font-size: 15px; margin-bottom: 10px; }
.hook-summary dl { display: grid; grid-template-columns: repeat(auto-fit,minmax(85px,1fr)); gap: 16px; margin: 6px 0 12px; }
.hook-summary dt { color: var(--portal-quiet); font-size: 12px; }
.hook-summary dd { font-size: 21px; font-weight: 610; }
code, pre { font: 12px/1.6 ui-monospace, monospace; }
pre { margin-bottom: 0; background: var(--wash); padding: 11px; border-radius: 5px; overflow-x: auto; }
.hook-card fieldset { border: 0; margin: 10px 0 0; padding: 0; }
.hook-card fieldset > .inline-form + .inline-form { margin-top: 10px; }
#integration-result { white-space: pre-wrap; overflow-wrap: anywhere; }
#trace-dialog code, #trace-dialog p { overflow-wrap: anywhere; }
#trace-details ol { margin: 10px 0; padding-inline-start: 25px; }
#trace-details li { padding-block: 5px; }
dialog { width: min(470px, calc(100vw - 28px)); }

.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dialog-head h2 { font-size: 21px; }
.close { background: var(--default); color: var(--portal-quiet); font-size: 21px; width: 30px; height: 30px; line-height: 1; border-radius: 6px; }
dialog p { color: var(--portal-quiet); }
dialog label { display: block; font-weight: 600; margin: 14px 0 5px; }
dialog input:not([data-slot]) { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; }
dialog input[type="checkbox"] { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
.form-error { color: var(--danger); margin-top: 8px; }
.qr-box { margin: 17px auto 10px; width: 208px; height: 208px; display: grid; place-items: center; background: var(--wash); border-radius: 9px; }
.qr-box img { width: 190px; height: 190px; object-fit: contain; image-rendering: pixelated; }
.qr-placeholder { width: 92px; height: 92px; display: grid; grid-template: repeat(2,1fr)/repeat(2,1fr); gap: 9px; opacity: .55; }
.qr-placeholder span { border: 6px double #527966; border-radius: 4px; background: #d9e8db; }
.qr-placeholder span:last-child { border-style: dotted; }
.login-state { text-align: center; min-height: 24px; }
.toast { position: fixed; bottom: 20px; right: 18px; z-index: 2; background: var(--dark); color: white; padding: 10px 15px; border-radius: 7px; }
.composer, .inline-form, .demo-users { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px;
  padding: 11px 20px; border-top: 1px solid var(--line); background: var(--panel); }
.composer > :is(.compose-context, textarea, .composer-attachment) { grid-column: 1 / -1; }
.composer textarea { width: 100%; min-height: 58px; max-height: 24dvh; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
.composer-tools, .composer-send, .composer-attachment { display: flex; align-items: center; gap: 6px; min-width: 0; }
.composer-send { justify-content: end; flex-wrap: wrap; }
.composer-attachment { color: var(--portal-quiet); font-size: 12px; }
#draft-file { min-width: 0; overflow-wrap: anywhere; }
.inline-form input:not([data-slot]), .inline-form select, dialog select { border:1px solid var(--line); padding:8px; border-radius:6px; font:inherit; }
.demo-users { margin-top:16px; }
.manage-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; padding:7px 0; border-bottom:1px solid var(--line); }
.group-sender { display:block; color:var(--portal-quiet); }
.attachment-picker { position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 32px;
  padding: 4px 6px; border-radius: 6px; color: var(--portal-quiet); font-size: 12px; cursor: pointer; }
.attachment-picker:hover, .face-picker summary:hover { background: var(--default); color: var(--ink); }
.attachment-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.attachment-picker:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.attachment-picker input { position: absolute; inline-size: 1px; block-size: 1px; clip-path: inset(50%); }
.attachment-link { display:block; color:var(--green); overflow-wrap:anywhere; }
.audit-dialog { width: min(850px, calc(100vw - 32px)); }
.audit-table { overflow-x: auto; }
.audit-table table { border-collapse: collapse; width: 100%; font-size: 13px; }
.audit-table th, .audit-table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }

#signin { padding: 0; max-width: 410px; }
#signin .signin-card { box-shadow: none; }
#signin label { margin: 4px 0 0; }
.dialog-actions { flex-wrap: wrap; }
.account-all .avatar { background:#e4ebfa; color:#36527f; }
.account > span, .thread > span { min-width:0; }
.conversation { grid-template-rows:auto auto minmax(0,1fr) auto auto auto; }
.conversation-head { grid-row:1; }
#message-error { grid-row:2; }
.composer { grid-row:4; }
.conversation-footer { grid-row:5; }
#failed-send-drafts { grid-row:6; }
.message-empty { display:grid; justify-items:center; gap:13px; }
.message-empty::before { content:""; width:34px; height:26px; border:2px solid #637b96; border-radius:12px 12px 12px 3px; }
.metric-panel button { align-self:flex-start; }
.webhooks { min-width:0; background:var(--wash); }
.inline-form input, .inline-form select { max-width:100%; }

@media(max-width:650px) {
  .composer { gap: 6px; }
  .metadata .mode { padding:2px 5px; }
}

#manage-error:not([hidden]) { margin: 0 0 12px; }
.audit-surface:is(.member-card, .hook-card) { padding: 0; }
.audit-surface .audit-table { border-block: 1px solid var(--line); }
.audit-filters, .records-title, .records-footer { padding: 12px var(--surface-inset, 20px); }
.records-title, .records-title p, .records-footer p { margin: 0; }
.records-title:empty, .records-footer:not(:has(> p:not(:empty), > button:not([hidden]))) { display: none; }
.records-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.records-footer > button { margin-inline-start: auto; }
.notice-surface .notification-items { margin: 0; gap: 0; }
.notice-surface .notification-item {
  padding: 13px var(--surface-inset, 20px); border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--panel);
}
.notice-surface > .notification-items:first-child .notification-item:first-child { border-top: 0; border-radius: 12px 12px 0 0; }
.notification-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.notification-item .notification-channel-actions { flex-wrap: wrap; }
.reference-card { max-width: 760px; }
#webhook-activity table td:nth-child(2) { overflow-wrap: anywhere; }
#webhook-activity .records-title { margin-bottom: 0; }
.member-state[data-state=failed] { color: var(--danger); background: var(--danger-bg); }
.audit-table table { min-width: 570px; }
.audit-table th { background: var(--wash); color: var(--portal-quiet); font-weight: 600; }
#merchant-audit-status { color: var(--portal-quiet); }
#retention-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#retention-impact:empty { display: none; }
#retention-impact:not(:empty) { padding: 10px 12px; background: var(--wash); border-radius: 8px; }

dialog :is(input:not([type=checkbox]), select, textarea), .webhooks select, .composer textarea {
  background: var(--field); color: var(--ink);
}
#workspace [data-slot="button"], .top [data-slot="button"] { border-radius: 6px; }
#workspace [data-slot="input"], .member-fields select { border-radius: 6px; box-shadow: none; }

@media (min-width: 651px) {
  body:has(.workspace:not([hidden])) {
    display: grid;
    grid-template: var(--header-height) minmax(0, 1fr) / var(--nav-width) minmax(0, 1fr);
  }
  body:has(.workspace:not([hidden])) .top { grid-area: 1 / 2; z-index: 1; }
  .workspace {
    grid-area: 1 / 1 / -1 / -1;
    grid-template: var(--header-height) minmax(0, 1fr) / var(--nav-width) clamp(272px, 25vw, 340px) minmax(0, 1fr);
  }
  .merchant-rail { grid-area: 1 / 1 / -1 / 2; }
  .thread-panel { grid-area: 2 / 2; }
  .conversation { grid-area: 2 / 3; }
  .webhooks { grid-area: 2 / 2 / 3 / -1; }
}
@media (651px <= width <= 1020px) {
  .workspace { grid-template-columns: var(--nav-width) minmax(212px, 29vw) minmax(0, 1fr); }
  .thread-head { flex-wrap: wrap; gap: 6px; }
}
@media (max-width: 650px) {
  .metadata .mode { padding: 1px 4px; }
  .workspace { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr); }
  .workspace[data-view="settings"], .workspace.reading { grid-template-rows: auto minmax(0, 1fr); }
  .merchant-rail { max-height: 38dvh; border-right: 0; border-bottom: 1px solid var(--line); }
    .conversation { display: none; }
  .workspace.reading .thread-panel { display: none; }
  .workspace.reading .conversation { display: grid; }
  .mobile-back { display: inline-flex; }
  .conversation-head { padding: 8px; min-height: 52px; }
  .conversation-head .avatar { display: none; }
  .conversation-footer, .composer { padding: 8px; }
  .composer { gap: 5px; }
  .composer-send { gap: 4px; }
  .timeline { padding: 14px 12px; }
  .webhooks { grid-column: 1; padding: 15px 12px; }
  .hook-summary { grid-template-columns: 1fr; gap: 0; }
}

.seat-content { max-width: 780px; }
.seat-content h3 { margin: 0; font-size: 15px; }
.seat-facts { display: grid; gap: 10px; }
.seat-facts > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: baseline; }
.seat-facts dt, .seat-setting-entry p, #integration-status { color: var(--portal-quiet); }
.seat-facts dd, #seat-webhook-owner { overflow-wrap: anywhere; }
.seat-setting-entry { display: flex; flex-flow: row wrap; align-items: center; justify-content: space-between; gap: 12px; }
.seat-setting-entry p { margin-top: 4px; }
#integration-controls { padding: 0; margin: 0; min-width: 0; border: 0; }
#integration-controls .member-card { gap: 12px; }
#integration-form { align-items: end; }
#integration-form label { flex: 1 1 240px; min-width: 0; display: grid; gap: 5px; }
#integration-status, #integration-error, #seat-detail-error { margin-bottom: 12px; }
#integration-result { margin: 0; }
#integration-hide-secret { align-self: start; }

#seat-integration-note { display: inline-block; margin-top: 8px; white-space: normal; }
@media (max-width: 480px) {
  dialog.seat-drawer { padding: 16px; }
  .seat-drawer .member-card { padding: 14px; }
}

.account-directory-filter { color: var(--portal-quiet); display: inline-flex; gap: 8px; align-items: center; min-height: 36px; }
.account-directory-filter label { display: inline-flex; gap: 6px; }
.account-filters > label:first-child { flex-basis: 220px; }
@media (max-width: 650px) {
  .account-filters > label:first-child { flex-basis: 100%; }
}
.module-switch { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 7px; }
.module-switch button[aria-pressed=true] { color: var(--accent); background: var(--portal-soft); }
#diagnostics-panel .seat-setting-entry h2 { font-size: 15px; }
.overview-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); }
.account-assignment { display: block; color: var(--warning); }
.audit-more-filters { margin-top: 10px; color: var(--portal-quiet); }
.audit-more-filters summary { cursor: pointer; width: fit-content; }
.audit-more-filters .member-fields { margin-top: 8px; }
.audit-more-filters label { max-width: 100%; }

#send-review-list .manage-row:focus-within { background-color: var(--soft); }
@media (hover: hover) {
  #send-review-list .manage-row:hover { background-color: var(--soft); }
}

.conversation-identity { min-width: 0; flex: 1 1 120px; overflow-wrap: anywhere; }
.conversation-controls { flex-wrap: wrap; justify-content: flex-end; }
@media (651px <= width <= 940px) {
  .conversation-head { flex-wrap: wrap; }
}
@media (max-width: 650px) {
  #roles-page .member-table td:nth-child(2) { grid-row: 2; }
  #roles-page .member-table td:nth-child(3) { justify-self: end; color: var(--portal-quiet); }
}

.compose-context { flex: 1 0 100%; min-width: 0; }
.compose-target { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 12px; }
.compose-target > div { display: flex; gap: 6px; min-width: 0; }
.compose-target dt { flex: none; color: var(--portal-quiet); }
.compose-target dd { overflow-wrap: anywhere; }
#compose-unavailable { margin-top: 4px; color: var(--warning); font-size: 12px; }

.face-picker { position:relative; }
.face-picker summary { color:var(--ink); cursor:pointer; padding:6px 9px; border:1px solid var(--line); border-radius:6px; }
#face-options { position:absolute; bottom:calc(100% + 6px); left:0; z-index:3; display:grid; grid-template-columns:repeat(6, 34px); max-height:220px; overflow:auto; background:var(--panel); padding:7px; border:1px solid var(--line); border-radius:8px; }
#face-options button { cursor:pointer; font-size:20px; padding:4px; border-radius:4px; }
#face-options button:is(:hover,:focus-visible) { background:var(--line); }
.image-preview { padding:0; width:fit-content; max-width:100%; border:0; cursor:zoom-in; background:transparent; }
.image-preview:focus-visible { outline:2px solid var(--green); outline-offset:3px; border-radius:8px; }
.chat-image { max-width:min(100%, 280px); max-height:220px; border-radius:8px; object-fit:contain; }
#image-dialog { max-width:95vw; max-height:92vh; width:fit-content; }
#image-dialog form { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:10px; }
#image-dialog-name { min-width:0; overflow-wrap:anywhere; font-size:16px; }
#image-dialog .close { flex:none; }
#full-image { max-width:85vw; max-height:78vh; object-fit:contain; }

.face-picker summary { display: inline-flex; gap: 5px; align-items: center; min-height: 32px; padding: 4px 6px; border-radius: 6px; }
#mobile-back svg { transform: rotate(180deg); }
#conversation:has(#conversation-foot:empty):not(:has(.conversation-footer button:not([hidden]))) .conversation-footer { display: none; }
@media (max-width: 790px) {
  .composer { grid-template-columns: minmax(0,1fr); }
  .composer-send { justify-content: space-between; }
  .thread-actions { justify-content: start; }
}
@media (pointer: coarse) {
  .account-chooser > summary, .attachment-picker, .face-picker summary { min-height: 40px; }
}

.conversation-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 6px; margin-left: auto; }
.conversation-controls .conversation-status { color: var(--success); }
.conversation-head { background: var(--panel); }
.thread-panel { background: var(--panel); }
.timeline { background: var(--wash); }
.message .bubble { border-radius: 10px; }
.message[data-direction="outgoing"] .bubble { border-radius: 10px; }
@media (max-width: 790px) {
  .conversation-controls { max-width: 48%; }
}

#signin { width: min(750px, calc(100vw - 24px)); max-width: none; border: 0; }
#signin .signin-card { border: 0; }
#signin .signin-intro p { color: var(--rail-quiet); }
.thread-head { min-height: 54px; padding: 14px 15px 7px; }
.thread-head h1 { font-size: 19px; }
.thread-filters { padding: 5px 12px 9px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.thread-filters :is(.account-chooser, .thread-search) { margin-inline: 0; }
.thread-filters .thread-search { margin-bottom: 0; }
.thread-filters .thread-actions { margin: 0 0 8px; justify-content: flex-start; }
.thread-filters .thread-actions:not(:has(button:not([hidden]))) { display: none; }
.thread-filters .account-chooser > summary { background: var(--list); }
.threads { padding: 0 8px; }
.thread { min-height: 57px; padding: 8px; }
.thread[aria-pressed=true] { background: var(--portal-soft); }
.conversation-head { padding-inline: clamp(12px, 2vw, 22px); }
.conversation .timeline { background: var(--list); }
.message-empty { gap: 5px; color: var(--portal-ink); text-align: center; max-width: 28ch; }
.message-empty::before { content: none; }
.message-empty-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px;
  color: var(--accent); background: var(--portal-soft); border-radius: 12px;
}
.message-empty p { color: var(--portal-quiet); font-size: 13px; }
.composer { padding-inline: clamp(12px, 2vw, 22px); border-top-color: var(--line); }
.compose-context { padding-block: 2px; }
.records-head {
  gap: 8px;
}
.records-head label { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--portal-quiet); font-size: 13px; }
.records-head label select { min-height: 33px; padding: 3px 7px; }
.segmented-control { display: flex; flex-wrap: wrap; gap: 5px; }
.segmented-control button[aria-pressed=true] { color: var(--accent); background: var(--portal-soft); }
#webhooks .hook-summary { gap: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 16px; }
#webhooks .metric-panel { border: 0; margin: 0; background: transparent; border-radius: 0; }
#webhooks .metric-panel + .metric-panel { border-left: 1px solid var(--line); }
#notification-channel-page .notice-surface:has(.notification-items:not([hidden])) { overflow: clip; }
@media (max-width: 650px) {
  #webhooks .metric-panel + .metric-panel { border-left: 0; border-top: 1px solid var(--line); }
}

#notification-channel-page .member-filters { padding: var(--surface-block) var(--surface-inset) 4px; margin: 0; }
#notification-channel-page .records-title { padding-block: 8px; }
.access-state { max-width: 460px; display: grid; gap: 8px; }
.access-state svg { color: var(--accent); }
.access-state h2 { font-size: 18px; }
.access-state p { color: var(--portal-quiet); }

.delivery-time { display: block; margin-top: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.metric-drilldown { background: none; border: 0; border-bottom: 1px dotted currentColor; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
@media (max-width: 650px) {
  #delivery-panel .hook-summary { grid-template-columns: 1fr 1fr; }
  #delivery-panel .metric-panel { padding: 10px; }
  #delivery-panel .metric-panel dl { gap: 8px; }
  .delivery-table table { min-width: 0; display: block; }
  .delivery-table thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
  .delivery-table tbody { display: block; }
  .delivery-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); padding: 8px var(--surface-inset); }
  .workbench-surface .delivery-table tr > td:is(:first-child, :last-child, :nth-child(n)) { min-width: 0; padding: 3px; border: 0; overflow-wrap: anywhere; }
  .delivery-table td:nth-child(3) { grid-column: 2; grid-row: 1; }
  .delivery-table td:nth-child(5) { grid-column: 2; grid-row: 2 / span 2; align-self: center; }
}

#retention-layout[data-editing="false"] { grid-template-columns: minmax(0, 640px); }
#delivery-filters { display: flex; flex-wrap: wrap; align-items: end; padding: 12px var(--surface-inset); }
#delivery-read-at { color: var(--portal-quiet); font-size: 12px; margin: 0; }
@media (max-width: 650px) {
  #delivery-filters { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); padding: 10px var(--surface-inset); }
  #delivery-filters label, #delivery-filters input { min-width: 0; width: 100%; }
  #delivery-panel .hook-summary .metric-panel { padding: 8px 12px; }
  #delivery-panel .hook-summary dl { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0; }
}

#delivery-panel .hook-summary .metric-panel { padding: 12px 18px; }
#delivery-panel .hook-summary dl { margin: 6px 0 0; }
#delivery-filters { align-items: end; margin: 0; }
.delivery-advanced { position: relative; align-self: end; }
.delivery-advanced summary { cursor: pointer; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; }
.delivery-advanced-fields { position: absolute; z-index: 3; top: 100%; left: 0; display: grid; gap: 9px; min-width: 230px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 650px) {
  #delivery-panel .hook-summary .metric-panel { padding: 6px 9px; }
  #webhooks #delivery-panel .metric-panel + .metric-panel { border-left: 1px solid var(--line); border-top: 0; }
  #delivery-filters { row-gap: 6px; }
  .delivery-advanced-fields { left: 0; }
}

.notice-filters label { flex: 0 1 220px; }
.notice-surface .notification-item[data-unread=true] { background: var(--wash); }
.notice-surface .notification-item:focus-within { background: var(--portal-soft); }
@media (hover: hover) {
  .notice-surface .notification-item:hover { background: var(--portal-soft); }
}
#notification-items time { color: var(--portal-quiet); font-variant-numeric: tabular-nums; }
#role-detail-groups .builtin-role-permissions { margin-block: 6px 16px; }
#role-detail-groups h3 { margin: 12px 0 0; }
#role-detail-members { margin: 0; }
@media (max-width: 650px) {
  #notification-items .notification-item { display: grid; grid-template-columns: minmax(0,1fr); }
}
