:root {
  color-scheme: light;
  --accent: #0d9488;
  --accent-strong: #08786f;
  --accent-soft: #dff7f3;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-muted: #f8fafb;
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  --text: #202124;
  --muted: #687078;
  --subtle: #939aa1;
  --danger: #c53636;
  --danger-soft: #fff0ef;
  --warning: #a35b00;
  --warning-soft: #fff6dc;
  --success: #16794b;
  --success-soft: #e6f7ee;
  --shadow: 0 12px 35px rgba(30, 38, 45, .1);
  --radius: 12px;
  --topbar-height: 64px;
  --operator-viewport-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #113c39;
  --bg: #121517;
  --panel: #1b1f22;
  --panel-muted: #202528;
  --line: #30363a;
  --line-strong: #444c51;
  --text: #f3f5f6;
  --muted: #a9b0b5;
  --subtle: #7e878d;
  --danger: #ff7a78;
  --danger-soft: #3c2324;
  --warning: #ffc266;
  --warning-soft: #382c16;
  --success: #5bd99c;
  --success-soft: #163529;
  --shadow: 0 12px 35px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
select,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
select:not(:disabled),
input[type="checkbox"]:not(:disabled) {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 27px;
  letter-spacing: -.035em;
  margin-bottom: 5px;
}

h2 {
  font-size: 20px;
  letter-spacing: -.025em;
}

h3 {
  font-size: 13px;
  letter-spacing: .01em;
  margin-bottom: 10px;
}

.hidden {
  display: none !important;
}

.svg-sprite {
  display: none;
}

.ui-icon {
  fill: none;
  height: 17px;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 17px;
}

.primary-icon-button .ui-icon {
  height: 20px;
  width: 20px;
}

.tool-button .ui-icon {
  height: 15px;
  margin-right: 3px;
  width: 15px;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.hint {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 500;
}

.auth-shell {
  align-items: center;
  background:
    radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 34%),
    radial-gradient(circle at 80% 88%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
    var(--bg);
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  max-width: 430px;
  padding: 42px;
  text-align: center;
  width: 100%;
}

.auth-card .brand-mark {
  margin: 0 auto 22px;
}

.auth-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.auth-footnote {
  font-size: 12px;
  margin: 24px 0 0;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(145deg, #16b8a9, #08786f);
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(13, 148, 136, .27);
  color: #fff;
  display: flex;
  font-size: 23px;
  font-weight: 900;
  height: 50px;
  justify-content: center;
  transform: rotate(-3deg);
  width: 50px;
}

.brand-mark-small {
  border-radius: 9px;
  font-size: 17px;
  height: 36px;
  width: 36px;
}

.primary-button,
.secondary-button,
.danger-button,
.action-button,
.send-button,
.send-resolve-button,
.tool-button,
.icon-button,
.primary-icon-button,
.text-button,
.load-more,
.load-earlier,
.more-button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
}

.primary-button,
.send-button,
.primary-icon-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.send-button:hover,
.primary-icon-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.action-button,
.send-resolve-button,
.tool-button,
.load-more,
.load-earlier,
.more-button {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.secondary-button:hover,
.action-button:hover,
.tool-button:hover,
.load-more:hover,
.load-earlier:hover,
.more-button:hover {
  background: var(--panel-muted);
}

.secondary-button.compact {
  min-height: 32px;
  padding: 5px 10px;
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.text-button,
.icon-button {
  background: transparent;
  color: var(--muted);
  min-height: 32px;
}

.text-button:hover,
.icon-button:hover {
  background: var(--panel-muted);
  color: var(--text);
}

.icon-button {
  border-radius: 50%;
  font-size: 18px;
  height: 36px;
  padding: 0;
  width: 36px;
}

.primary-icon-button {
  border-radius: 10px;
  font-size: 22px;
  height: 39px;
  padding: 0;
  width: 39px;
}

.operator-app {
  height: var(--operator-viewport-height, 100vh);
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: var(--topbar-height);
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 30;
}

.brand {
  align-items: center;
  display: flex;
  gap: 11px;
  min-width: 232px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.topnav {
  align-items: center;
  align-self: stretch;
  display: flex;
  gap: 3px;
}

.topnav a {
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  display: flex;
  font-weight: 650;
  height: 100%;
  padding: 0 17px;
}

.topnav a:hover,
.topnav a.active {
  color: var(--text);
}

.topnav a.active {
  border-bottom-color: var(--accent);
}

.nav-count {
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  display: none;
  font-size: 10px;
  margin-left: 6px;
  min-width: 18px;
  padding: 2px 5px;
  text-align: center;
}

.nav-count.visible {
  display: inline-block;
}

.nav-label-mobile {
  display: none;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  min-width: 232px;
}

.connection-pill {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  white-space: nowrap;
}

.connection-pill::before {
  background: var(--warning);
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.connection-pill.connected::before {
  background: var(--success);
}

main,
.page {
  height: calc(var(--operator-viewport-height, 100vh) - var(--topbar-height));
}

.inbox-page {
  display: grid;
  grid-template-columns: 196px minmax(275px, 350px) minmax(440px, 1fr) minmax(255px, 310px);
}

.queue-rail,
.conversation-column,
.thread-column,
.context-column {
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.queue-rail {
  background: var(--panel-muted);
  overflow: auto;
  padding: 15px 11px;
}

.rail-heading,
.section-header,
.editor-header,
.result-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.rail-heading {
  font-size: 16px;
  font-weight: 750;
  padding: 0 8px 11px;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.queue-list hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 8px 7px;
  width: calc(100% - 14px);
}

.queue-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-weight: 650;
  justify-content: space-between;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.queue-button:hover {
  background: var(--panel);
  color: var(--text);
}

.queue-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.queue-button span:last-child {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.saved-view-controls {
  border-top: 1px solid var(--line);
  margin: 14px 5px 0;
  padding-top: 12px;
}

.saved-view-controls > label {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

.saved-view-controls select {
  font-size: 11px;
  max-width: 100%;
  width: 100%;
}

.saved-view-controls > div {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 5px;
}

.filter-drawer {
  border-top: 1px solid var(--line);
  margin: 16px 5px 0;
  padding-top: 13px;
}

.filter-drawer summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.filter-drawer label,
.inline-label,
.form-grid label,
dialog label,
.report-filters label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 700;
  gap: 5px;
  margin-bottom: 10px;
}

input,
select,
textarea {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-weight: 500;
  min-height: 36px;
  padding: 8px 10px;
}

textarea {
  line-height: 1.5;
  resize: vertical;
}

.check-row,
.channel-toggle {
  align-items: center !important;
  flex-direction: row !important;
  gap: 7px !important;
}

.check-row input,
.channel-toggle input {
  min-height: auto;
}

.conversation-column {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversation-search {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  padding: 12px;
}

.search-box {
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex: 1;
  gap: 7px;
  padding: 0 10px;
}

.search-box span {
  color: var(--subtle);
  font-size: 18px;
}

.search-box input {
  background: transparent;
  border: 0;
  min-width: 0;
  outline: 0;
  padding-left: 0;
  width: 100%;
}

.list-status,
.thread-notice,
.gif-status {
  color: var(--muted);
  font-size: 11px;
  min-height: 28px;
  padding: 8px 14px;
}

.list-status.error,
.thread-notice.error,
.notice.error {
  color: var(--danger);
}

.gif-search-meta {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.gif-attribution {
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.05em;
  padding-right: 14px;
  text-transform: uppercase;
}

.conversation-list {
  flex: 1;
  overflow: auto;
}

.conversation-card {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  display: block;
  padding: 14px 15px;
  text-align: left;
  width: 100%;
}

.conversation-card:hover {
  background: var(--panel-muted);
}

.conversation-card.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.conversation-card-head,
.conversation-card-foot {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.conversation-card-head strong {
  max-width: calc(100% - 58px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-card time {
  color: var(--subtle);
  font-size: 10px;
  white-space: nowrap;
}

.conversation-card p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.45;
  margin: 6px 0 9px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.conversation-card-foot {
  color: var(--subtle);
  font-size: 10px;
}

.conversation-card-state {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 6px;
  text-transform: capitalize;
}

.unread-badge {
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  padding: 2px 5px;
  text-align: center;
}

.priority-star {
  color: #e2a500;
  margin-right: 4px;
}

.load-more,
.load-earlier {
  margin: 8px 12px 12px;
}

.thread-column {
  min-width: 0;
  position: relative;
}

.thread-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.thread-empty h2 {
  color: var(--text);
  margin: 17px 0 6px;
}

.thread-empty p {
  line-height: 1.6;
  max-width: 340px;
}

.empty-orbit {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 50%;
  color: var(--accent-strong);
  display: flex;
  font-size: 25px;
  height: 72px;
  justify-content: center;
  width: 72px;
}

.thread-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.thread-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  min-height: 61px;
  padding: 9px 14px;
}

.thread-title {
  flex: 1;
  min-width: 0;
}

.thread-title strong,
.thread-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-title span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.thread-header-actions {
  display: flex;
  gap: 2px;
}

.thread-header-actions #toggle-priority.active {
  color: #e2a500;
}

.thread-header-actions #toggle-priority.active .ui-icon {
  fill: currentColor;
}

.mobile-back {
  display: none;
}

.action-strip {
  align-items: flex-end;
  background: var(--panel-muted);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 7px;
  padding: 8px 12px;
  position: relative;
}

.action-strip label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 9px;
  font-weight: 700;
  gap: 3px;
}

.action-strip select {
  max-width: 145px;
  min-height: 32px;
  padding: 4px 25px 4px 8px;
}

.action-button,
.more-button {
  min-height: 32px;
  padding: 5px 9px;
}

.action-button.resolve {
  border-color: color-mix(in srgb, var(--success) 40%, var(--line));
  color: var(--success);
}

.popover {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 190px;
  padding: 6px;
  position: absolute;
  right: 12px;
  top: 49px;
  z-index: 15;
}

.popover button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: inherit;
  display: block;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.popover button:hover {
  background: var(--panel-muted);
}

.danger-text {
  color: var(--danger) !important;
}

.thread-tags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
  padding: 0 14px;
}

.thread-tags:not(:empty) {
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
  padding-top: 7px;
}

.tag {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
}

.tag-remove {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0 0 0 4px;
}

.message-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px clamp(15px, 4vw, 54px) 20px;
  scroll-behavior: smooth;
}

.message {
  align-self: flex-start;
  max-width: min(76%, 680px);
}

.message.admin {
  align-self: flex-end;
}

.message.note {
  align-self: stretch;
  margin: 2px auto;
  max-width: 86%;
}

.message-warnings {
  display: grid;
  gap: 5px;
  margin-bottom: 6px;
}

.message-warning {
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--line));
  border-radius: 8px;
  color: var(--text);
  display: grid;
  font-size: 10px;
  gap: 2px;
  line-height: 1.35;
  padding: 7px 9px;
}

.message-warning.danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
}

.message-warning strong {
  color: var(--warning);
  font-size: 10px;
}

.message-warning.danger strong {
  color: var(--danger);
}

.message-bubble {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 5px 14px 14px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  padding: 9px 11px;
  white-space: pre-wrap;
}

.message.admin .message-bubble {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 14px 5px 14px 14px;
}

.message.note .message-bubble {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 32%, var(--line));
  border-radius: 9px;
  color: var(--text);
  font-size: 12px;
}

.message-meta {
  color: var(--subtle);
  font-size: 9px;
  margin: 4px 4px 0;
}

.message.admin .message-meta {
  text-align: right;
}

.message-attachment {
  display: block;
  margin-top: 8px;
}

.message-attachment img {
  border: 1px solid var(--line);
  border-radius: 9px;
  display: block;
  max-height: 320px;
  max-width: 100%;
}

.message-attachment audio {
  max-width: 100%;
}

.attachment-download {
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
}

.composer {
  background: var(--panel);
  border-top: 1px solid var(--line);
  margin: 0 12px 12px;
  position: relative;
}

.composer-tabs {
  display: flex;
  gap: 12px;
  padding: 7px 4px 0;
}

.composer-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  padding: 5px 2px;
}

.composer-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.composer textarea {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  min-height: 70px;
  resize: none;
  width: 100%;
}

.composer.note-mode textarea {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 38%, var(--line));
}

.composer-toolbar {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  display: flex;
  justify-content: space-between;
  margin-top: -1px;
  min-height: 43px;
  padding: 5px;
}

.composer-tools,
.composer-send {
  align-items: center;
  display: flex;
  gap: 3px;
}

.tool-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  min-height: 30px;
  padding: 4px 7px;
}

.send-button {
  min-height: 31px;
  padding: 5px 15px;
}

.send-resolve-button {
  color: var(--text);
  min-height: 31px;
  padding: 5px 10px;
  white-space: nowrap;
  width: auto;
}

.channel-toggle {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  margin: 0 4px 0 0 !important;
}

.recording-status {
  color: var(--danger);
  font-size: 10px;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 5px 0;
}

.attachment-chip {
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  font-size: 10px;
  gap: 5px;
  max-width: 220px;
  padding: 5px 7px;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0 2px;
}

.picker {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  bottom: 47px;
  box-shadow: var(--shadow);
  left: 5px;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  position: absolute;
  width: min(330px, calc(100vw - 50px));
  z-index: 16;
}

#emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 290px;
}

#emoji-picker button,
#macro-results button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: inherit;
  padding: 7px;
}

#emoji-picker button:hover,
#macro-results button:hover {
  background: var(--panel-muted);
}

#macro-picker input {
  margin-bottom: 6px;
  width: 100%;
}

#macro-results button {
  display: block;
  font-size: 11px;
  text-align: left;
  width: 100%;
}

.context-column {
  border-right: 0;
  overflow: auto;
}

.context-column > header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 61px;
  padding: 9px 14px;
}

.context-column > section {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.context-column h3 {
  color: var(--muted);
  text-transform: uppercase;
}

.context-column dl {
  display: grid;
  font-size: 11px;
  gap: 7px 10px;
  grid-template-columns: 80px minmax(0, 1fr);
  margin: 0;
}

.context-column dt {
  color: var(--muted);
}

.context-column dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.context-item {
  border-bottom: 1px solid var(--line);
  display: block;
  font-size: 11px;
  padding: 7px 0;
}

button.context-item {
  background: transparent;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  color: inherit;
  text-align: left;
  width: 100%;
}

.context-item strong,
.context-item span,
.context-item small {
  display: block;
}

.context-item span,
.context-item small {
  color: var(--muted);
  margin-top: 3px;
}

.participant-item {
  align-items: start;
  display: grid;
  gap: 3px 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.participant-item strong,
.participant-item span {
  grid-column: 1;
}

.participant-remove {
  align-self: center;
  background: transparent;
  border: 0;
  color: var(--danger);
  font-size: 10px;
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 5px;
}

.participant-form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.participant-form input {
  font-size: 11px;
  min-width: 0;
  width: 100%;
}

.escalation-label {
  background: var(--warning-soft);
  border-radius: 999px;
  color: var(--warning);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  text-transform: uppercase;
}

.context-column pre {
  font-size: 10px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

.contacts-page {
  background: var(--panel);
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  overflow: hidden;
}

.contacts-list-column {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 20px 0 0;
}

.contacts-header,
.contact-search-box,
.contact-filters,
.contact-selection-row,
.contact-bulk-actions {
  margin-left: 18px;
  margin-right: 18px;
}

.contacts-header {
  margin-bottom: 13px;
}

.contacts-header h1 {
  margin-bottom: 0;
}

.contacts-header-actions {
  align-items: center;
  display: flex;
  gap: 7px;
}

.contact-search-box {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.contact-filters {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.contact-filters label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  font-weight: 700;
  gap: 5px;
}

.contact-filters select {
  min-width: 0;
  width: 100%;
}

.contact-selection-row {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 11px;
  justify-content: space-between;
  margin-top: 12px;
  min-height: 39px;
  padding-top: 4px;
}

.contact-selection-row label {
  margin: 0;
}

.contact-bulk-actions {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
  padding: 7px;
}

.contact-bulk-actions select {
  flex: 1 1 120px;
  min-width: 0;
}

.contact-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.contact-row {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  display: flex;
  min-height: 82px;
  padding-left: 13px;
}

.contact-row:hover {
  background: var(--panel-muted);
}

.contact-row.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.contact-row-select {
  align-self: center;
  flex: 0 0 auto;
  height: 17px;
  margin: 0 3px;
  min-height: 17px;
  width: 17px;
}

.contact-card {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  display: flex;
  flex: 1;
  gap: 11px;
  min-width: 0;
  padding: 12px 14px 12px 9px;
  text-align: left;
}

.contact-avatar {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 50%;
  color: var(--accent-strong);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  letter-spacing: .02em;
  width: 38px;
}

.contact-avatar-large {
  font-size: 16px;
  height: 50px;
  width: 50px;
}

.contact-card-body,
.contact-card-heading,
.contact-card-email,
.contact-card-meta {
  display: block;
  min-width: 0;
}

.contact-card-body {
  flex: 1;
}

.contact-card-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.contact-card-heading strong,
.contact-card-email,
.contact-card-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-card-heading time,
.contact-card-email,
.contact-card-meta {
  color: var(--muted);
  font-size: 11px;
}

.contact-card-heading time {
  flex: 0 0 auto;
}

.contact-card-email {
  margin-top: 4px;
}

.contact-card-meta {
  color: var(--subtle);
  font-size: 10px;
  margin-top: 5px;
}

.contact-list-empty,
.contact-detail-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.contact-list-empty {
  height: 100%;
}

.contact-list-empty p {
  margin: 6px 0 0;
}

.contact-detail-column {
  background: var(--bg);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.contact-detail-empty {
  height: 100%;
}

.contact-detail-empty h2 {
  color: var(--text);
  margin: 17px 0 6px;
}

.contact-detail-empty p {
  line-height: 1.6;
  max-width: 360px;
}

.contact-detail-shell {
  height: 100%;
  overflow: auto;
  padding-bottom: 50px;
}

.contact-detail-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 13px;
  min-height: 84px;
  padding: 15px clamp(18px, 3vw, 36px);
  position: sticky;
  top: 0;
  z-index: 3;
}

.contact-detail-back {
  display: none;
}

.contact-detail-title {
  flex: 1;
  min-width: 0;
}

.contact-detail-title h2,
.contact-detail-title p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-detail-title h2 {
  margin-bottom: 3px;
}

.contact-detail-title p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.contact-detail-status {
  margin: 16px clamp(18px, 3vw, 36px) 0;
}

.contact-detail-status:empty {
  display: none;
}

.contact-detail-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, .8fr) minmax(280px, 1.2fr);
  padding: 16px clamp(18px, 3vw, 36px);
}

.contact-profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  padding: 16px;
}

.contact-profile-card h3 {
  color: var(--muted);
  text-transform: uppercase;
}

.contact-profile-card dl {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: minmax(105px, auto) 1fr;
  margin: 0;
}

.contact-profile-card dt {
  color: var(--muted);
}

.contact-profile-card dd {
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}

.contact-memberships {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 26px;
}

.contact-tag-add {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.contact-tag-add select {
  flex: 1;
  min-width: 0;
}

.contact-segment-heading {
  margin-top: 21px;
}

.contact-history-card,
.contact-attributes-card {
  grid-column: 1 / -1;
}

.contact-conversations {
  display: grid;
  gap: 7px;
}

.contact-conversation-card {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: inherit;
  display: block;
  padding: 11px 12px;
  text-align: left;
  width: 100%;
}

.contact-conversation-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.contact-conversation-card > span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-conversation-heading {
  align-items: center;
  color: var(--text) !important;
  display: flex !important;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 5px;
}

.contact-conversation-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-conversation-heading time {
  color: var(--subtle);
  flex: 0 0 auto;
  font-size: 10px;
}

.contact-attributes-card pre {
  background: var(--panel-muted);
  border-radius: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.quarantine-page {
  background: var(--panel);
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  overflow: hidden;
}

.quarantine-list-column {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-top: 20px;
}

.quarantine-header,
.quarantine-tabs {
  margin-left: 18px;
  margin-right: 18px;
}

.quarantine-header {
  align-items: flex-start;
  margin-bottom: 13px;
}

.quarantine-header h1 {
  margin-bottom: 3px;
}

.quarantine-header p:not(.eyebrow) {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  max-width: 260px;
}

.quarantine-tabs {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
}

.quarantine-tabs button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 700;
  gap: 5px;
  justify-content: center;
  min-height: 34px;
  padding: 6px;
}

.quarantine-tabs button.active {
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(30, 38, 45, .08);
  color: var(--text);
}

.quarantine-tabs span {
  background: var(--line);
  border-radius: 999px;
  font-size: 9px;
  min-width: 18px;
  padding: 2px 5px;
}

.quarantine-tabs button.active span {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quarantine-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.quarantine-list-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  display: block;
  padding: 14px 17px;
  text-align: left;
  width: 100%;
}

.quarantine-list-item:hover {
  background: var(--panel-muted);
}

.quarantine-list-item.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.quarantine-list-heading,
.quarantine-list-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.quarantine-list-heading strong,
.quarantine-list-item p,
.quarantine-reason {
  overflow: hidden;
  text-overflow: ellipsis;
}

.quarantine-list-heading strong,
.quarantine-reason {
  white-space: nowrap;
}

.quarantine-list-heading time {
  color: var(--subtle);
  flex: 0 0 auto;
  font-size: 10px;
}

.quarantine-list-item p {
  color: var(--muted);
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.45;
  margin: 7px 0 10px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.quarantine-list-meta {
  color: var(--subtle);
  font-size: 10px;
}

.quarantine-reason {
  min-width: 0;
}

.quarantine-state {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 7px;
  text-transform: uppercase;
}

.quarantine-state.pending {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 32%, var(--line));
  color: var(--warning);
}

.quarantine-state.released {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 32%, var(--line));
  color: var(--success);
}

.quarantine-state.dismissed {
  background: var(--panel-muted);
  color: var(--muted);
}

.quarantine-list-empty,
.quarantine-detail-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.quarantine-list-empty {
  height: 100%;
}

.quarantine-list-empty span {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 7px;
}

.quarantine-detail-column {
  background: var(--bg);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.quarantine-detail-empty {
  height: 100%;
}

.quarantine-detail-empty h2 {
  color: var(--text);
  margin: 17px 0 6px;
}

.quarantine-detail-empty p {
  line-height: 1.6;
  max-width: 390px;
}

.quarantine-detail-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.quarantine-detail-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 13px;
  min-height: 84px;
  padding: 15px clamp(18px, 3vw, 36px);
}

.quarantine-detail-back {
  display: none;
}

.quarantine-detail-title {
  flex: 1;
  min-width: 0;
}

.quarantine-detail-title .eyebrow {
  margin-bottom: 3px;
}

.quarantine-detail-title h2,
.quarantine-detail-title p:not(.eyebrow) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quarantine-detail-title h2 {
  margin-bottom: 3px;
}

.quarantine-detail-title p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.quarantine-detail-status {
  flex: 0 0 auto;
  margin: 14px clamp(18px, 3vw, 36px) 0;
}

.quarantine-detail-content {
  display: grid;
  flex: 1;
  gap: 14px;
  grid-template-columns: minmax(230px, .8fr) minmax(280px, 1.2fr);
  min-height: 0;
  overflow: auto;
  padding: 0 clamp(18px, 3vw, 36px) 18px;
}

.quarantine-card {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  padding: 16px;
}

.quarantine-card h3 {
  color: var(--muted);
  text-transform: uppercase;
}

.quarantine-summary-card dl {
  display: grid;
  gap: 8px 12px;
  grid-template-columns: minmax(100px, auto) 1fr;
  margin: 0;
}

.quarantine-summary-card dt {
  color: var(--muted);
}

.quarantine-summary-card dd {
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}

.quarantine-message-card,
.quarantine-card:last-child {
  grid-column: 1 / -1;
}

#quarantine-body {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
  max-height: 390px;
  min-height: 92px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.quarantine-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quarantine-warning {
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, var(--line));
  border-radius: 9px;
  color: var(--warning);
  padding: 10px;
}

.quarantine-warning.danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--danger);
}

.quarantine-warning.info {
  background: var(--panel-muted);
  border-color: var(--line);
  color: var(--muted);
}

.quarantine-warning strong,
.quarantine-warning span {
  display: block;
}

.quarantine-warning strong {
  font-size: 11px;
}

.quarantine-warning span {
  font-size: 11px;
  line-height: 1.45;
  margin-top: 3px;
}

.quarantine-attachments {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.quarantine-attachment {
  align-items: center;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 11px;
}

.quarantine-attachment > div {
  min-width: 0;
}

.quarantine-attachment strong,
.quarantine-attachment span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quarantine-attachment span,
.quarantine-empty-copy {
  color: var(--muted);
  font-size: 10px;
  margin: 4px 0 0;
}

.quarantine-actions {
  align-items: center;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: flex;
  flex: 0 0 auto;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(18px, 3vw, 36px);
}

.quarantine-actions p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  max-width: 430px;
}

.quarantine-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.quarantine-actions button,
.quarantine-actions a,
.quarantine-attachment button {
  min-height: 44px;
}

.campaigns-page {
  display: grid;
  grid-template-columns: minmax(280px, 350px) 1fr;
  overflow: hidden;
}

.campaign-list-column {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 20px;
}

.section-header {
  margin-bottom: 15px;
}

.section-header h1,
.editor-header h2 {
  margin-bottom: 0;
}

.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.campaign-list-item {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: inherit;
  padding: 12px;
  text-align: left;
}

.campaign-list-item.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.campaign-list-item strong,
.campaign-list-item span {
  display: block;
}

.campaign-list-item span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
  text-transform: capitalize;
}

.campaign-editor-column {
  overflow: auto;
  padding: 24px clamp(20px, 4vw, 56px) 60px;
}

.editor-header,
.reports-header {
  margin-bottom: 15px;
}

.status-badge {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  padding: 5px 9px;
  text-transform: capitalize;
}

.notice,
.result-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 16px;
  padding: 10px 12px;
}

.notice.success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 33%, var(--line));
  color: var(--success);
}

.form-grid {
  display: grid;
  gap: 3px 16px;
  grid-template-columns: 1fr 1fr;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.campaign-builder-section,
.campaign-advanced {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-bottom: 16px;
  padding: 20px;
}

.builder-section-heading {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 17px;
}

.builder-section-heading h3 {
  font-size: 16px;
  letter-spacing: -.015em;
  margin-bottom: 4px;
}

.builder-section-heading p,
.campaign-empty-steps p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.campaign-template-section {
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 56%, var(--panel)), var(--panel) 58%);
}

.campaign-template-grid {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.campaign-template-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: inherit;
  min-height: 94px;
  padding: 13px;
  text-align: left;
}

.campaign-template-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.campaign-template-card.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}

.campaign-template-card strong,
.campaign-template-card span {
  display: block;
}

.campaign-template-card strong {
  font-size: 12px;
  line-height: 1.35;
}

.campaign-template-card span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  margin-top: 6px;
}

.compact-field {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 700;
  gap: 5px;
  margin: 0;
  min-width: 235px;
}

.audience-rule-fields {
  border-top: 1px solid var(--line);
  padding-top: 17px;
}

.audience-consent {
  background: var(--panel-muted);
  border-radius: 9px;
  min-height: 42px;
  padding: 9px 11px;
}

.event-rules,
.step-channel-fieldset,
.step-message-panel {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.event-rules {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-top: 8px;
  padding: 15px;
}

.event-rules > legend,
.step-message-panel > legend,
.step-channel-fieldset > legend {
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  padding: 0 3px;
}

.event-property-heading {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  padding-top: 9px;
}

.event-property-heading strong {
  font-size: 11px;
}

.event-property-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.event-property-row {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(120px, 1fr) 110px minmax(120px, 1fr) auto;
}

.event-property-row .event-property-remove,
.step-remove {
  color: var(--danger);
}

.series-heading {
  align-items: center;
}

.campaign-step-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.campaign-step-card {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.campaign-step-heading {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 9px;
  grid-template-columns: 32px minmax(150px, 1fr) auto auto;
  padding: 11px 13px;
}

.campaign-step-number {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 50%;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.campaign-step-heading > input {
  background: transparent;
  border-color: transparent;
  font-size: 13px;
  font-weight: 750;
  min-width: 0;
}

.campaign-step-heading > input:hover,
.campaign-step-heading > input:focus {
  background: var(--panel-muted);
  border-color: var(--line-strong);
}

.step-enabled {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 6px;
}

.step-enabled input {
  min-height: auto;
}

.step-order-controls {
  display: flex;
  gap: 2px;
}

.step-order-controls .text-button {
  font-size: 10px;
  min-height: 34px;
  padding: 6px 8px;
}

.step-delivery-row {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(145px, .8fr) 100px minmax(300px, 1.5fr);
  padding: 14px 15px 4px;
}

.step-delivery-row > label,
.step-message-panel > label,
.step-cta-row > label {
  color: var(--muted);
  display: flex;
  flex-direction: column;
  font-size: 10px;
  font-weight: 700;
  gap: 5px;
  margin-bottom: 10px;
}

.step-channel-fieldset {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  min-height: 48px;
}

.step-channel-fieldset legend {
  float: left;
  margin-right: 12px;
}

.step-channel-fieldset .check-row {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin: 0;
}

.step-message-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  padding: 8px 15px 15px;
}

.step-message-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
}

.step-cta-row {
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(110px, .7fr) minmax(150px, 1.3fr);
}

.campaign-empty-steps {
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  padding: 28px;
  text-align: center;
}

.campaign-advanced {
  padding: 0;
}

.campaign-advanced summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  padding: 15px 18px;
}

.campaign-advanced[open] {
  padding: 0 18px 18px;
}

.campaign-advanced[open] summary {
  margin: 0 -18px 12px;
}

.advanced-actions {
  align-items: center;
  display: flex;
  gap: 11px;
  margin-top: 8px;
}

.code-input,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.campaign-preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  margin: 8px 0 14px;
  padding: 14px;
}

.campaign-preview-steps {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.campaign-preview-step {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
}

.campaign-preview-step p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 6px 0;
  white-space: pre-wrap;
}

.campaign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 13px 0 20px;
}

.campaign-results-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.result-box dl {
  display: grid;
  gap: 5px 8px;
  grid-template-columns: 1fr auto;
  margin: 0;
}

.result-box dd {
  color: var(--text);
  font-weight: 700;
  margin: 0;
}

.result-heading h3 {
  margin-bottom: 0;
}

.reports-page {
  overflow: auto;
  padding: 26px clamp(20px, 4vw, 58px) 60px;
}

.reports-header {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
}

.reports-header p:not(.eyebrow) {
  color: var(--muted);
  margin-bottom: 0;
}

.report-filters {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.report-filters label {
  margin: 0;
}

.report-filters input,
.report-filters select {
  min-width: 130px;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 15px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  display: block;
  font-size: 11px;
}

.metric-card strong {
  display: block;
  font-size: 24px;
  margin: 7px 0 5px;
}

.report-content-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 2.2fr) minmax(240px, .8fr);
}

.report-table-card,
.coverage-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
}

.report-table-card > header,
.coverage-card {
  padding: 14px;
}

.report-table-card h2,
.coverage-card h2 {
  font-size: 15px;
  margin: 0;
}

.table-scroll {
  overflow: auto;
}

table {
  border-collapse: collapse;
  font-size: 11px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.coverage-item {
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.45;
  padding: 9px 0;
}

.coverage-item strong,
.coverage-item span {
  display: block;
}

.coverage-item span {
  color: var(--muted);
  margin-top: 3px;
}

dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  color: var(--text);
  max-height: calc(var(--operator-viewport-height, 100vh) - 20px);
  max-width: calc(100vw - 30px);
  overflow-y: auto;
  padding: 0;
  width: 450px;
}

dialog::backdrop {
  background: rgba(15, 18, 20, .52);
  backdrop-filter: blur(2px);
}

dialog form {
  padding: 20px;
}

dialog header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

dialog h2 {
  margin-bottom: 0;
}

dialog p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

dialog input,
dialog select,
dialog textarea {
  width: 100%;
}

.dialog-channel-fieldset {
  border: 0;
  margin: 2px 0 0;
  padding: 0;
}

.dialog-channel-fieldset legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 2px;
}

dialog .dialog-channel-fieldset .check-row {
  display: inline-flex;
  margin: 0 18px 0 0;
  min-height: 44px;
}

dialog .dialog-channel-fieldset input[type="checkbox"] {
  width: auto;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 17px;
}

.form-grid-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#founder-alert-settings-dialog {
  max-width: 520px;
}

#founder-alert-settings-dialog .hint {
  line-height: 1.5;
}

.bulk-message-preview {
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 11px;
  margin-top: 12px;
  padding: 13px;
}

.bulk-message-preview-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 9px;
}

.bulk-message-preview-heading h3 {
  font-size: 14px;
  margin: 0;
}

.bulk-message-preview-result dl {
  display: grid;
  gap: 5px 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 11px 0 0;
}

.bulk-message-preview-result dd {
  font-weight: 750;
  margin: 0;
}

.bulk-message-sample {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  margin-top: 11px;
  padding-top: 10px;
}

.bulk-message-sample strong,
.bulk-message-sample span {
  display: block;
}

.bulk-message-sample span + span {
  margin-top: 3px;
}

.bulk-message-actions #send-bulk-message {
  min-width: 176px;
}

.segment-manager-dialog {
  width: 880px;
}

.segment-manager-grid {
  border: 1px solid var(--line);
  border-radius: 11px;
  display: grid;
  grid-template-columns: minmax(210px, .75fr) minmax(0, 1.6fr);
  min-height: 480px;
  overflow: hidden;
}

.segment-manager-list-pane {
  background: var(--panel-muted);
  border-right: 1px solid var(--line);
  padding: 12px;
}

.segment-manager-list-pane > button {
  margin-bottom: 10px;
  width: 100%;
}

.segment-manager-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
  overflow: auto;
}

.segment-manager-list-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: inherit;
  display: block;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.segment-manager-list-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.segment-manager-list-item strong,
.segment-manager-list-item span {
  display: block;
}

.segment-manager-list-item span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.segment-editor {
  min-width: 0;
  padding: 15px;
}

.segment-editor .notice {
  margin-bottom: 12px;
}

.segment-last-contacted-fieldset {
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 12px 0;
  padding: 11px;
}

.segment-last-contacted-fieldset legend {
  font-size: 12px;
  font-weight: 750;
}

.segment-last-contacted-fieldset .hint {
  margin: 0 0 8px;
}

.segment-editor-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  min-height: 18px;
}

.segment-editor-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.segment-editor-spacer {
  flex: 1;
}

.wide-dialog {
  width: 680px;
}

.gif-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(4, 1fr);
  max-height: 470px;
  overflow: auto;
}

.gif-grid button {
  aspect-ratio: 1;
  background: var(--panel-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
}

.gif-grid img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.toast-region {
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 30px));
  position: fixed;
  right: 18px;
  z-index: 100;
}

.toast {
  background: #22282c;
  border-radius: 9px;
  box-shadow: var(--shadow);
  color: #fff;
  line-height: 1.4;
  padding: 11px 13px;
}

.toast.error {
  background: #8e2f2f;
}

@media (max-width: 1250px) {
  .inbox-page {
    grid-template-columns: 176px minmax(270px, 330px) 1fr;
  }

  .context-column {
    bottom: 0;
    box-shadow: -10px 0 28px rgba(20, 25, 29, .14);
    position: fixed;
    right: 0;
    top: var(--topbar-height);
    width: min(340px, 92vw);
    z-index: 22;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .campaign-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step-message-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .brand {
    min-width: auto;
  }

  .brand span:last-child,
  .connection-pill {
    display: none;
  }

  .topbar-actions {
    min-width: auto;
  }

  .topbar-actions .compact {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
  }

  .icon-button,
  .primary-icon-button {
    height: 44px;
    min-height: 44px;
    width: 44px;
  }

  .topbar-actions .compact {
    padding-left: 10px;
    padding-right: 10px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .inbox-page {
    grid-template-columns: 122px minmax(235px, 290px) minmax(0, 1fr);
  }

  .rail-heading span,
  .filter-drawer {
    display: none;
  }

  .queue-button {
    justify-content: space-between;
    min-height: 44px;
    padding: 8px;
  }

  .action-strip label,
  .action-strip select,
  .action-button,
  .more-button,
  .tool-button,
  .send-button,
  .send-resolve-button,
  .channel-toggle {
    min-height: 44px;
  }

  .channel-toggle {
    align-items: center;
    padding: 0 3px;
  }

  .composer-toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .composer-tools,
  .composer-send {
    flex: 1 1 100%;
  }

  .composer-send {
    border-top: 1px solid var(--line);
    justify-content: flex-end;
    padding-top: 4px;
  }

  .campaigns-page {
    grid-template-columns: 280px 1fr;
  }

  .contacts-page {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .quarantine-page {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .quarantine-list-item,
  .quarantine-tabs button,
  .quarantine-actions button,
  .quarantine-actions a,
  .quarantine-attachment button {
    min-height: 44px;
  }

  .quarantine-detail-content {
    grid-template-columns: 1fr;
  }

  .quarantine-message-card,
  .quarantine-card:last-child {
    grid-column: auto;
  }

  .contact-row-select,
  .contact-selection-row input {
    min-height: 20px;
    min-width: 20px;
  }

  .contact-card,
  .contact-conversation-card,
  .contact-tag-add button,
  .contact-bulk-actions button,
  .contact-detail-header .primary-button {
    min-height: 44px;
  }

  .contact-detail-grid {
    grid-template-columns: 1fr;
  }

  .contact-history-card,
  .contact-attributes-card {
    grid-column: auto;
  }

  .builder-section-heading,
  .audience-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-field {
    min-width: 0;
  }

  .step-delivery-row {
    grid-template-columns: minmax(145px, 1fr) 100px;
  }

  .step-channel-fieldset {
    grid-column: 1 / -1;
  }

  .event-property-row {
    grid-template-columns: minmax(100px, 1fr) 100px minmax(100px, 1fr);
  }

  .event-property-row .event-property-remove {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .reports-header {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
  }

  .report-filters {
    justify-content: flex-start;
  }

  .report-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: 58px;
  }

  body {
    overflow: auto;
  }

  .topbar {
    padding: 0 8px;
  }

  .brand {
    display: none;
  }

  .topnav {
    flex: 1;
  }

  .topnav a {
    flex: 1;
    font-size: 11px;
    justify-content: center;
    padding: 0 5px;
  }

  .nav-label-wide {
    display: none;
  }

  .nav-label-mobile {
    display: inline;
  }

  .topnav .nav-count {
    margin-left: 3px;
  }

  .inbox-page {
    display: block;
    height: calc(var(--operator-viewport-height, 100dvh) - var(--topbar-height));
    position: relative;
  }

  .queue-rail {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    height: 60px;
    overflow: auto hidden;
    padding: 7px;
    white-space: nowrap;
  }

  .rail-heading,
  .queue-list {
    display: inline-flex;
  }

  .filter-drawer {
    display: none;
  }

  .saved-view-controls {
    border-top: 0;
    display: inline-flex;
    gap: 4px;
    margin: 0 0 0 5px;
    padding: 0;
    vertical-align: top;
  }

  .saved-view-controls > label {
    display: none;
  }

  .saved-view-controls select {
    min-height: 40px;
    width: 150px;
  }

  .saved-view-controls > div {
    margin-top: 0;
  }

  .rail-heading {
    padding: 0;
    vertical-align: top;
  }

  .queue-list {
    flex-direction: row;
    gap: 3px;
  }

  .queue-list hr {
    display: none;
  }

  .queue-button {
    gap: 5px;
    width: auto;
  }

  .queue-button span:first-child {
    display: inline;
  }

  .conversation-column {
    border-right: 0;
    height: calc(100% - 60px);
  }

  .thread-column {
    background: var(--panel);
    bottom: 0;
    display: none;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 18;
  }

  .inbox-page.thread-open .thread-column {
    display: block;
  }

  .mobile-back {
    display: inline-flex;
  }

  .thread-header-actions #export-thread,
  .thread-header-actions #print-thread {
    display: none;
  }

  .action-strip {
    overflow: auto;
  }

  .message-list {
    padding-left: 12px;
    padding-right: 12px;
  }

  .message {
    max-width: 88%;
  }

  .composer {
    margin: 0 7px 7px;
  }

  .composer-toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .composer-tools,
  .composer-send {
    flex: 1 1 100%;
  }

  .composer-send {
    border-top: 1px solid var(--line);
    justify-content: flex-end;
    padding-top: 4px;
  }

  .channel-toggle {
    display: inline-flex !important;
    font-size: 9px;
    white-space: nowrap;
  }

  .channel-toggle input {
    height: 14px;
    width: 14px;
  }

  .context-column {
    top: var(--topbar-height);
    width: 94vw;
  }

  .campaigns-page {
    display: block;
    height: calc(var(--operator-viewport-height, 100dvh) - var(--topbar-height));
    overflow: auto;
  }

  .campaign-list-column {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    max-height: 42vh;
  }

  .campaign-editor-column {
    overflow: visible;
    padding: 20px 14px 50px;
  }

  .contacts-page {
    display: block;
    height: calc(var(--operator-viewport-height, 100dvh) - var(--topbar-height));
    overflow: hidden;
    position: relative;
  }

  .quarantine-page {
    display: block;
    height: calc(var(--operator-viewport-height, 100dvh) - var(--topbar-height));
    overflow: hidden;
    position: relative;
  }

  .quarantine-list-column {
    border-right: 0;
    height: 100%;
    padding-top: 13px;
  }

  .quarantine-header,
  .quarantine-tabs {
    margin-left: 12px;
    margin-right: 12px;
  }

  .quarantine-tabs button {
    font-size: 10px;
    min-height: 44px;
  }

  .quarantine-detail-column {
    background: var(--bg);
    bottom: 0;
    display: none;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 19;
  }

  .quarantine-page.detail-open .quarantine-detail-column {
    display: block;
  }

  .quarantine-detail-back {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .quarantine-detail-header {
    min-height: 70px;
    padding: 8px 10px;
  }

  .quarantine-detail-status {
    margin: 10px 12px 0;
  }

  .quarantine-detail-content {
    display: block;
    padding: 0 12px 12px;
  }

  .quarantine-card {
    margin-bottom: 10px;
  }

  .quarantine-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  .quarantine-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .quarantine-actions > div > :only-child,
  .quarantine-actions #quarantine-open-conversation:not(.hidden) {
    grid-column: 1 / -1;
  }

  .quarantine-attachment button,
  .quarantine-actions button,
  .quarantine-actions a {
    min-height: 44px;
  }

  .contacts-list-column {
    border-right: 0;
    height: 100%;
    padding-top: 13px;
  }

  .contacts-header,
  .contact-search-box,
  .contact-filters,
  .contact-selection-row,
  .contact-bulk-actions {
    margin-left: 12px;
    margin-right: 12px;
  }

  .contact-filters {
    grid-template-columns: 1fr 1fr auto;
  }

  .contact-detail-column {
    background: var(--bg);
    bottom: 0;
    display: none;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 19;
  }

  .contacts-page.detail-open .contact-detail-column {
    display: block;
  }

  .contact-detail-back {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .contact-detail-header {
    flex-wrap: wrap;
    gap: 9px;
    padding: 8px 10px;
  }

  .contact-detail-header .contact-avatar-large {
    height: 42px;
    width: 42px;
  }

  .contact-detail-header .primary-button {
    flex: 1 1 100%;
  }

  .contact-detail-grid {
    padding: 12px;
  }

  .contact-detail-status {
    margin: 12px 12px 0;
  }

  .contact-bulk-actions select {
    flex-basis: 100%;
  }

  .contact-bulk-actions button {
    flex: 1;
  }

  .bulk-message-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .bulk-message-actions button {
    min-height: 44px;
    width: 100%;
  }

  .contacts-header-actions .secondary-button {
    min-height: 44px;
  }

  .segment-manager-grid {
    display: block;
    min-height: 0;
  }

  .segment-manager-list-pane {
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }

  .segment-manager-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
  }

  .segment-manager-list-item {
    flex: 0 0 190px;
  }

  .segment-editor-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .segment-editor-actions button {
    min-height: 44px;
    width: 100%;
  }

  .segment-editor-spacer {
    display: none;
  }

  .campaign-builder-section {
    border-radius: 12px;
    padding: 15px;
  }

  .campaign-template-grid,
  .step-message-grid,
  .step-cta-row,
  .event-property-row {
    grid-template-columns: 1fr;
  }

  .campaign-template-card {
    min-height: 76px;
  }

  .campaign-step-heading {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .step-enabled {
    grid-column: 2;
  }

  .step-order-controls {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .step-delivery-row {
    grid-template-columns: minmax(0, 1fr) 90px;
  }

  .step-order-controls .text-button,
  .event-property-row .text-button,
  .campaign-template-card,
  #add-campaign-step,
  #add-event-property,
  #apply-campaign-json {
    min-height: 44px;
  }

  .event-property-row .event-property-remove {
    grid-column: auto;
  }

  .form-grid,
  .campaign-results-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .reports-page {
    height: calc(var(--operator-viewport-height, 100dvh) - var(--topbar-height));
    padding: 20px 12px 50px;
  }

  .report-filters,
  .report-filters label {
    align-items: stretch;
    width: 100%;
  }

  .report-filters input,
  .report-filters select {
    width: 100%;
  }

  .auth-card {
    padding: 30px 22px;
  }

  .gif-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-height: 500px) {
  :root {
    --topbar-height: 48px;
  }

  .topbar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .topnav a {
    padding-left: 10px;
    padding-right: 10px;
  }

  .contact-detail-header {
    min-height: 48px;
    position: static;
  }

  .contact-detail-header .contact-avatar-large {
    display: none;
  }

  .contact-detail-header .primary-button {
    flex: 0 0 auto;
  }

  .contact-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thread-header {
    min-height: 48px;
    padding: 2px 8px;
  }

  .action-strip {
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 48px;
    overflow-x: auto;
    padding: 2px 6px;
  }

  .action-strip label {
    align-items: center;
    flex: 0 0 auto;
    flex-direction: row;
    gap: 4px;
  }

  .action-strip select,
  .action-button,
  .more-button {
    min-height: 44px;
  }

  .thread-tags:not(:empty) {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    max-height: 34px;
    overflow-x: auto;
    padding-bottom: 3px;
    padding-top: 3px;
  }

  .thread-notice:empty,
  .attachment-preview:empty,
  .recording-status:empty {
    display: none;
  }

  .thread-notice {
    flex: 0 0 auto;
    min-height: 0;
    padding: 4px 10px;
  }

  .message-list {
    gap: 6px;
    min-height: 96px;
    padding: 6px 12px;
  }

  .message-bubble {
    padding: 7px 9px;
  }

  .composer {
    flex: 0 1 auto;
    margin: 0 6px 4px;
    max-height: calc(100% - 48px - 48px - 96px - 6px);
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .composer-tabs {
    gap: 8px;
    padding-top: 0;
  }

  .composer-tabs button {
    min-height: 36px;
    padding-bottom: 3px;
    padding-top: 3px;
  }

  .composer textarea {
    height: 44px;
    max-height: 54px;
    min-height: 44px;
    padding-bottom: 6px;
    padding-top: 6px;
  }

  .attachment-preview {
    flex-wrap: nowrap;
    margin-bottom: 2px;
    margin-top: 2px;
    overflow-x: auto;
  }

  .attachment-chip {
    flex: 0 0 auto;
    min-height: 36px;
  }

  .attachment-chip button {
    min-height: 32px;
    min-width: 32px;
  }

  .composer-toolbar {
    flex-wrap: nowrap;
    min-height: 44px;
    overflow-x: auto;
    padding: 0;
  }

  .composer-tools,
  .composer-send {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .composer-send {
    border-top: 0;
    padding-top: 0;
  }

  .tool-button,
  .send-button,
  .send-resolve-button,
  .channel-toggle {
    min-height: 44px;
  }
}

@media (max-width: 680px) and (max-height: 500px) {
  .contact-detail-grid {
    grid-template-columns: 1fr;
  }

  .contact-detail-header .primary-button {
    flex: 1 1 100%;
  }
}

@media print {
  body {
    background: #fff;
    overflow: visible;
  }

  .topbar,
  .queue-rail,
  .conversation-column,
  .context-column,
  .action-strip,
  .composer,
  .thread-header-actions,
  .thread-notice,
  .load-earlier {
    display: none !important;
  }

  main,
  .page,
  .thread-column,
  .thread-shell {
    display: block !important;
    height: auto;
  }

  .inbox-page {
    display: block;
  }

  .message-list {
    display: block;
    overflow: visible;
    padding: 20px;
  }

  .message {
    margin: 10px 0 10px auto;
    page-break-inside: avoid;
  }

  .message.teacher,
  .message.note {
    margin-left: 0;
    margin-right: auto;
  }
}
